Consulting

Results 1 to 1 of 1

Thread: Click Login button using VBA

  1. #1
    VBAX Newbie
    Joined
    May 2014
    Posts
    2
    Location

    Question Click Login button using VBA

    Hi,

    Hope everyone is doing fine. I am trying to upload my resume everyday with help of macro.

    Would request to help me with code for HTML code. I am trying to click login buttion using VBA.



    HMTL CODE

    HTML Code:
    <div class="action row mb0">
    <div class="col s12">
    <div class="g-recaptcha" data-sitekey="6Lfr8SEUAAAAACgWL1C--Pup9o8uBElCNXYZ4vfL" data-callback="loginRecaptchaCallback" data-size="invisible"></div><button class="waves-effect waves-light btn-large btn-block btn-bold blue-btn textTransform" type="submit" data-ga-track="spa-event|login|login|Save">Login</button>

    So For My VBA CODE

    Dim htmldoc As HTMLDocument
    Dim mybrowser As InternetExplorer
    Sub connecttoO1C()
    Dim IE As Object
    Dim myhtml_element As IHTMLElementCollection
    Dim htmlInput As MSHTML.HTMLInputElement
    Dim htmlInput1 As Object
    Dim elemCollection As Object
    Dim htmlcoll As MSHTML.IHTMLElementCollection
    Dim frm As Object
    Dim objElement As Object
    Dim objCollection As Object
    Dim i As Long
    Dim i1 As Long
    Dim User_ID As String
    Dim Password_ID As String
    Dim a As String
    Dim x As Workbook
    Dim links, link
    Application.EnableEvents = True
    Set x = ThisWorkbook
    User_ID = "XXXXXXXXXXXXX"
        Password_ID = "XXXXXXXX"
    If User_ID = "" Then
            MsgBox ("Untill you type the NAUKRI username, macro will not run futher")
            On Error GoTo username
            Exit Sub
        ElseIf Password_ID = "" Then
            MsgBox ("Untill you type the NAUKRI password, macro will not run futher")
            On Error GoTo passwordid
            Exit Sub
        Else
        Set IE = CreateObject("InternetExplorer.application")
        IE.navigate "https://www.naukri.com/nlogin/login?msg=0&URL=https%3A%2F%2Fmy.naukri.com"
        IE.Visible = True
        Do
        Loop Until IE.readyState = READYSTATE_COMPLETE: DoEvents
        Application.Wait (Now + TimeValue("0:00:00"))
        IE.document.getElementById("usernameField").Value = User_ID
        IE.document.getElementById("passwordField").Value = Password_ID

    'I AM STRUCK HERE

    IE.document.getElementByTagName("Login").Click 
    '- DON'T KNOW WHAT CODE SHOULD I WRITE
    End Sub


    Thanks,
    Rao
    Last edited by Aussiebear; 04-20-2023 at 01:28 AM. Reason: Adjusted the required code tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •