问题
I am attempting to login to a password protected site. I'm using the InternetExplorer Object in VBScript. Error lies after oIE.readystate
value is read one time - that is, in my loop, it reads the oIE.readystate
value one time, but upon the second time oIE.readystate
value is attempting to be read, I get a "800A01CE" runtime error, stating "The remote server machine does not exist or is unavailable:'oIE.readystate'"
This code worked fine in IE6; my company implimented new AD policy (not sure how/if that affects this at all) and we are now using IE7. Im not sure if IE7 is somehow blocking the process after oIE.readystate
. Any suggestions are greatly appreciated.
Notation:
"-->" indicates that I am writing commentary about the output of the process directly after that particular line of code executes.
set oIe=wscript.createobject("InternetExplorer.Application", "IE_")
oIe.navigate "www.google.com"
do while oIe.readystate<>4
msgbox "oIE readystate: " & oIE.readystate
''#-->gets here one time and outputs "oIE readstate: 0"
wscript.sleep 1000
msgbox "oIE readystate: " & oIE.readystate
''#-->errors out.
loop
msgbox "outside of oIE readystate: " & oIE.readystate
''#--->never gets here.
回答1:
It might be the call to MsgBox that's fouling it up. Doing a MsgBox changes the focus from IE to the script interpreter, which might make IE paranoid that it's being hijacked or something. Change them to
WScript.Echo "oIE readystate: " & oIE.ReadyState
And run it from the command line using cscript myscript.vbs
instead.
来源:https://stackoverflow.com/questions/3046177/why-does-internetexplorer-object-become-unresponsive