我正在尝试创建一个Excel宏,它将登录我的网站.我已经编写了宏来登录到其他网站,但这个有点不同.
当我使用以下代码以编程方式插入用户名和密码,然后以编程方式单击"登录"按钮,网页返回该消息
错误:请提供用户名和错误:请提供密码
Sub LogIn()
' Open IE and navigate to the log-in page
Set ie = CreateObject("InternetExplorer.Application")
With ie
.Visible = True
.navigate "https://www.prudential.com/login"
' Loop until the page is fully loaded
Do Until Not ie.Busy And ie.ReadyState = 4
DoEvents
Loop
Application.Wait (Now + TimeValue("0:00:10"))
' Enter the necessary information on the Login web page and click the submit button
ie.document.getElementById("username").Value = "abcdef"
ie.document.getElementById("password").Value = "12345678"
ie.document.getElementsByClassName("btn btn-primary btn-login btn-sm-block analytics-login")(0).Click
' Loop until the page …Run Code Online (Sandbox Code Playgroud)