[Wtr-general] Seemingly bogus error in simple script

matt forum-watir-users at openqa.org
Wed Mar 7 13:24:19 EST 2007


I am a new user to ruby/watir as well...maybe we can get through this together :)

Basically, I did the same thing...launch irb and type commands to see what happens.  It was my experience that if it worked in irb, it worked in the script.  However, I am using ie6.  I haven't tried ruby/watir with ie7 yet...

In irb, try using the ie.show_all_objects.  This generates a table of all the objects on the current page.  This was helpful for me to build the list of objects for my script.

Maybe using a later version of watir is required?  I am using 1.5.1.1158.

ruby -e 'require "watir"; puts Watir::IE::VERSION'
1.5.1.1158

ruby --version
ruby 1.8.5 (2006-12-25 patchlevel 12) [i386-mswin32]

> I'm brand new at this.
> 
> I've created a very simple script to test a login
> page...
> 
> require 'watir'
> 
> ie = Watir::IE.start("http://mysite")
> 
> ie.text_field(:name, "j_username").set("blah")
> ie.text_field(:name, "j_password").set("blah")
> ie.button(:value, "Submit").click
> 
> If I execute these commands manually in irb, I have
> no problem.
> 
> If I execute the script that contains them from the
> command line, I get this error:
> 
> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.4.1/./watir.rb:
> 1928:in `assert_exists': Unable to locate object,
> using name and j_username
> (Watir::Exception::UnknownObjectException)
> from
> c:/ruby/lib/ruby/gems/1.8/gems/watir-1.4.1/./watir.rb:
> 3382:in `set'
> from Z:/Customers/Beneplace/Beneplace
>  Redesign/WATIR tests/admin-login.rb:5
> 
> Even though I get the error, the actions occur - the
> text is entered into the text boxes, the button is
> clicked, and I see the next page.
> 
> If I put additional commands AFTER the click, they do
> not get executed.
> 
> This is being used with a JSP page, if that makes any
> difference, and IE7.
> 
> Thanks for any help.
> 
> Steven
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6823&messageID=19647#19647


More information about the Wtr-general mailing list