如何选择 VBA 以选择浏览器上的按钮以登录 Gmail?

Posted

技术标签:

【中文标题】如何选择 VBA 以选择浏览器上的按钮以登录 Gmail?【英文标题】:How to select VBA to select button on browser to sign into Gmail? 【发布时间】:2018-01-18 04:41:56 【问题描述】:

如何让 VBA 单击浏览器上的“下一步”按钮?不知道怎么选。

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

 HTMLDoc.all.identifierId.Value = "testaddress@gmail.com" '''Enter your email idhere


'''this where I'm stuck, I can't figure out how to
'''select for the Next button on GMAIL!



Err_Clear:
 If Err <> 0 Then
 Err.Clear
 Resume Next
 End If
 End Sub

【问题讨论】:

找到元素 By.className("RveJvd snByac") 然后 next.click 您尝试过@Continue9 脚本吗?你的反馈是什么? 【参考方案1】:

试试这个。它应该让您登录。

Sub MyGmail()

    With CreateObject("InternetExplorer.Application")
        .Visible = True
        .navigate "https://www.gmail.com"
        While .Busy = True Or .readyState < 4: DoEvents: Wend
        .document.getElementById("identifierId").Value = "your_email"
        .document.getElementById("identifierNext").Click
        Application.Wait Now + TimeValue("00:00:03")
        .document.getElementsByClassName("whsOnd zHQkBf")(0).Value = "your_password"
        .document.getElementById("passwordNext").Click
    End With
End Sub

【讨论】:

以上是关于如何选择 VBA 以选择浏览器上的按钮以登录 Gmail?的主要内容,如果未能解决你的问题,请参考以下文章

利用VBA如何将批量图片导入WORD的指定表格格式里?

利用VBA如何将批量图片导入WORD的指定表格格式里?

MS Word 中的 VBA 影响整个文档,而不仅仅是选择

使用firebase google身份验证单击登录按钮时总是会自动登录,而没有选择以其他用户身份登录的选项

如何提示用户在 VBA 中选择文件位置以将文件合并到一个工作簿中

如何用函数或VBA调用(引用)另外一个工作表的数据