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?
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.