Signing into Gmail Account using VBA

dubey

New Member
Joined
May 18, 2016
Messages
5
Hi There,

I am trying to automate signing into Gmail account using VBA. I have the code, the issue I'm facing is it takes the username, hits the Next button but does not take the Password, throws an error. Tried the same code with facebook.com and it works fine. For the password field I'm using the "getElementsByName("Passwd").Item.innerText =pwd" as I do not find any Id element in the View Source page of Gmail.

Here is the code I have:
Rich (BB code):
Dim HTMLDoc As HTMLDocument
Dim MyBrowser As InternetExplorer
Sub MyGmail()


Dim MyHTML_Element As IHTMLElement
Dim MyURL As String
On Error GoTo Err_Clear
MyURL = "https://www.gmail.com"
Set MyBrowser = New InternetExplorer
MyBrowser.Silent = True
MyBrowser.navigate MyURL
MyBrowser.Visible = True
Do
Loop Until MyBrowser.readyState = READYSTATE_COMPLETE
Set HTMLDoc = MyBrowser.document


With HTMLDoc
                .getElementsByName("identifier").Item.innerText = "XXX" (OR) .getElementById("identifier").Value = "XXX"
                .getElementById("identifierNext").Click
               .getElementsByName("Passwd").Item.innerText = "XXX"----> Issue appears to be here
               .getElementById("passwordNext").Click
End With
Err_Clear:
If Err <> 0 Then
Err.Clear
Resume Next
End If
End Sub
 
Last edited by a moderator:

Some videos you may like

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Watch MrExcel Video

Forum statistics

Threads
1,095,424
Messages
5,444,384
Members
405,279
Latest member
yousef alotra

This Week's Hot Topics

Top