在我的办公室,有一个需要登录的在线文件查看系统。我正在考虑使用VBS自动执行此操作,并接受以下操作:
Call Main
Function Main
Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
IE.Visible = True
IE.Navigate "***WEBSITE CENSORED***"
Wait IE
With IE.Document
.getElementByID("username").value = "USERNAME"
.getElementByID("password").value = "PASSWORD"
.getElementByID("loginbtn")(0).Submit
End With
End Function
Sub Wait(IE)
Do
WScript.Sleep 500
Loop While IE.ReadyState < 4 And IE.Busy
End Sub
Call Main
Function Main
Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
IE.Visible = True
IE.Navigate "***WEBSITE CENSORED***"
Wait IE
With IE.Document
.getElementByID("username").value = "USERNAME"
.getElementByID("password").value = "PASSWORD"
.getElementByID("loginbtn")(0).Submit
End With
End Function
Sub Wait(IE)
Do
WScript.Sleep 500
Loop While IE.ReadyState < 4 And IE.Busy
End Sub
从理论上讲,这应该有效( I 认为),但它不是。
我哪里错了?
编辑:以下是我网站的登录表格。出于安全原因,我已将其链接到example.com。
&#13;
答案 0 :(得分:0)
感谢@SearchAndResQ的回答。
需要改变
.getElementByID( “loginbtn”)(0).Submit
到
.getElementByID( “loginbtn”)。然后按