【问题标题】:Why does InternetExplorer Object become unresponsive?为什么 InternetExplorer 对象变得无响应?
【发布时间】:2011-03-04 00:51:51
【问题描述】:

我正在尝试登录受密码保护的站点。我在 VBScript 中使用 InternetExplorer 对象。错误在于 oIE.readystate 值被读取一次之后 - 也就是说,在我的循环中,它会读取一次 oIE.readystate 值,但在第二次尝试读取 oIE.readystate 值时,我得到一个“800A01CE”运行时错误,提示“远程服务器机器不存在或不可用:'oIE.readystate'”

这段代码在 IE6 中运行良好;我的公司实施了新的广告政策(不知道这会如何/是否会影响这一点),我们现在正在使用 IE7。我不确定 IE7 是否在 oIE.readystate 之后以某种方式阻止了该进程。非常感谢任何建议。


符号: “-->”表示我正在写关于该特定代码行执行后的进程输出的评论。

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.

【问题讨论】:

    标签: internet-explorer vbscript readystate


    【解决方案1】:

    可能是对 MsgBox 的调用弄乱了它。执行 MsgBox 会将焦点从 IE 转移到脚本解释器,这可能会使 IE 偏执地认为它被劫持了。将它们更改为

    WScript.Echo "oIE readystate: " & oIE.ReadyState
    

    然后使用cscript myscript.vbs 从命令行运行它。

    【讨论】:

      猜你喜欢
      • 2015-05-26
      • 2012-12-06
      • 2021-07-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多