我想使用VBS打开一些URL,并且需要直接输入登录凭据。 PFB我的代码:
WScript.Quit Main
Function Main
Set IE = WScript.CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.Navigate "https://accounts.google.com/ServiceLogin?hl=en&continue=https://www.google.co.in/%3Fgws_rd%3Dcr%26ei%3DoSiwUqWmO8LvkQXGhIGoBg"
Wait IE
With IE.Document
.get
ElementByID("Email").value = "xyz@gmail.com"
.getElementByID("Passwd").value = "123"
End With
IE.Navigate "https://accounts.google.com/ServiceLogin?hl=en&continue=https://www.google.co.in/%3Fgws_rd%3Dcr%26ei%3DoSiwUqWmO8LvkQXGhIGoBg"
Wait IE
With IE.Document
.getElementByID("Email").value = "abc@gmail.com"
.getElementByID("Passwd").value = "12345"
End With
End Function
Sub Wait(IE)
Do
WScript.Sleep 500
Loop While IE.ReadyState < 4 And IE.Busy
Do
WScript.Sleep 500
Loop While IE.ReadyState < 4 And IE.Busy
End Sub
Sub IE_OnQuit
On Error Resume Next
WScript.StdErr.WriteLine "IE closed before script finished."
WScript.Quit
End Sub
如果有人能为我澄清以下疑惑,我将不胜感激:
第一次尝试VBS,所以我可能会觉得有点幼稚! 请耐心! :)
提前致谢! :)