[Ironruby-core] Watir under IronRuby Error

Shri Borde Shri.Borde at microsoft.com
Thu Aug 27 14:11:33 EDT 2009

The backtrace indicates that the exception was thrown from "set" which would imply that the call to text_field succeeded. Could you break up the line "b.text_field(:name, "q").set("pickaxe")" into two statements to see narrow down where the problem might be happening?

Also, could you run with "ir.exe -D", attach with VS, and get the full call stack for all the exceptions thrown by the problematic statement? There might be other exceptions thrown before Watir::Exception::UnknownObjectException, and the those other exceptions might be more useful to track down the problem. One suspect could be that COM Interop is misbehaving somehow.

Also, what was the patch to watir.rb (and what exact version of watir are you using) so we could try to repro the problem? 

-----Original Message-----
From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Qwerty Qwerty
Sent: Thursday, August 27, 2009 8:48 AM
To: ironruby-core at rubyforge.org
Subject: Re: [Ironruby-core] Watir under IronRuby Error

Ok, so after hacking watir.rb, I managed to get IE to open and navigate 
to the URL, but then using the following basic script:

 require 'watir'                         # use watir gem
 test_site = 'http://www.google.com'     # set a variable
 b = Watir::IE.new                  # open the IE browser
 b.goto(test_site)                       # load url, go to site
 b.text_field(:name, "q").set("pickaxe") # load text "pickaxe" into 
search field named "q"
 b.button(:name, "btnG").click           # "btnG" is the name of the 
Search button, click it

 if b.text.include?("Programming Ruby")
   puts "Test Passed. Found the test string: 'Programming Ruby'."
   puts "Test Failed! Could not find: 'Programming Ruby'"

I now get the following error:

./watir/element.rb:54:in `assert_exists': Unable to locate element, 
using :name, "q" (Watir::Exception::UnknownObjectException)
        from ./watir/element.rb:288:in `enabled?'
        from ./watir/element.rb:60:in `assert_enabled'
        from ./watir/input_elements.rb:328:in `set'
        from Simplewatirscript.rb:6

Posted via http://www.ruby-forum.com/.
Ironruby-core mailing list
Ironruby-core at rubyforge.org

More information about the Ironruby-core mailing list