在 Firefox 上测试 Watir 会抛出 JsshSocket::JSReferenceError
我在 Windows 上使用 Watir,当我的脚本尝试在 Firefox 上运行时,我在控制台上看到此错误:
JsshSocket::JSReferenceError: Components is not definedReferenceError: Components is not defined
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/jssh_socket.rb:12:in `js_eval'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/firefox.rb:195:in `goto'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/firefox.rb:164:in `start'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/commonwatir-1.6.5/lib/watir/browser.rb:71:in `start'
./test.rb:12:in `test_prepare'
其他人也会发生这种情况吗?我可以做什么来修复它?
I am using Watir on Windows and when my script tries to run on Firefox, I see this error on my console:
JsshSocket::JSReferenceError: Components is not definedReferenceError: Components is not defined
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/jssh_socket.rb:12:in `js_eval'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/firefox.rb:195:in `goto'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/firefox.rb:164:in `start'
C:/xampp/Ruby/lib/ruby/gems/1.8/gems/commonwatir-1.6.5/lib/watir/browser.rb:71:in `start'
./test.rb:12:in `test_prepare'
Does this happen to anyone else? What can I do to fix it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我以前没有见过这样的错误。这是失败的代码。
您的错误在于此错误处理代码中,在我看来,该代码过于复杂。如果这个错误处理代码更好,我们就能更好地了解真正导致问题的原因。抱歉,我无法提供更好的帮助。
I haven't seen an error like this before. Here is the code that is failing.
Your error is in this error-handling code, which to my eyes is overly complicated. If this error handling code were better, we'd have a better idea what is really causing your problem. Sorry I can't be of better help.
“组件未定义”消息是一个 JavaScript 错误 - 它是从 jssh_socket.send 操作返回的。
support.mozilla.com 上的讨论 将错误描述为间歇性且无害的,这也是我在 Mac OS X 上使用 Watir + Firefox 时的经验(JSReferenceError 来来去去,并且不会阻止我尝试执行的操作)。
所以我所做的就是捕获异常,然后忽略它:
让我的 Watir 程序继续。
The "Components is not defined" message is a javascript error — it's coming back from the jssh_socket.send operation.
This discussion at support.mozilla.com describes the error as intermittent and harmless, which has been my experience too when using Watir + Firefox on Mac OS X (the JSReferenceError comes and goes, and doesn’t prevent the operations I’m trying to do).
So all I do is capture the exception, and ignore it:
and let my Watir program continue.