由於某種原因,下面的VBS像IE 8中的魅力,但在我的筆記本電腦上的IE9上 我在.getElement
獲得Object Required。IE 9錯誤getElementbyId:對象需要
我該如何解決此問題。
WScript.Quit Main
Function Main
Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
IE.Visible = True
IE.Navigate "http://desistream.tv/en/index.shtml"
Wait IE
With IE.Document
.getElementByID("login_username").value = "myuser"
.getElementByID("login_password").value = "mypass"
.getElementByID("frmLogin").submit
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
編輯
這是我在JScript
var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.Run("Chrome www.desistream.tv", 10, true);
WScript.Sleep(500);
還沒有見過像永遠VBS。爲什麼不用JavaScript重新做呢,我肯定會更加兼容。 – elclanrs
我不知道如何:(我試過 – Mowgli
你想用這段代碼做什麼? – elclanrs