由服务员的execute_script引起的OLE错误代码80020101 [英] OLE error code 80020101 caused by execute_script of waitr

查看:136
本文介绍了由服务员的execute_script引起的OLE错误代码80020101的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚尝试过:$browser.execute_script("alert(\"aaa\")")

然后出现以下错误:

h:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.2.0/lib/watir-classic/page-container.rb:46:in `method_missing': (in OLE method `execScript': ) (WIN32OLERuntimeError)
OLE error code:80020101 in <Unknown>
  Could not complete the operation due to error 80020101.HRESULT error code:0x80020009
  Exception occurred.
    from h:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.2.0/lib/watir-classic/page-container.rb:46:in `rescue in execute_script'
    from h:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-classic-3.2.0/lib/watir-classic/page-container.rb:39:in `execute_script'

我想念一些东西吗?

推荐答案

该异常表示运行脚本时发生了JavaScript错误.

The exception means that a javascript error occurred when running the script.

虽然修复脚本会更好,但是如果您确实想忽略该异常,则可以将其包装在开始救援中:

While it would be better to fix the script, but if you really want to ignore the exception, you could wrap it in a begin-rescue:

begin
    $browser.execute_script("asdfasd") 
rescue WIN32OLERuntimeError
    #Ignore javascript error that occurred
end

发生异常时,救援人员将其捕获并允许程序继续运行.

When the exception occurs, the rescue will catch it and allow the program to continue.

这篇关于由服务员的execute_script引起的OLE错误代码80020101的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆