Why does InternetExplorer Object become unresponsive?

一笑奈何 提交于 2019-12-25 04:41:38

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!