[Wtr-general] Seemingly bogus error in simple script
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=6823messageID=19642#19642 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Seemingly bogus error in simple script
I can only assume there are some timing issues. I'd recommend using a more recent version of Watir which you can pull from the home page on openqa: http://www.openqa.org/watir or build your own from the repository which is on the FAQ page under Installing a Gem from the latest development source. If you use the latest version of Watir, you should be able to wait for controls on the page to exist. require 'watir' include Watir ie = IE.start('http://blah) wait_until{ie.text_field(:name, 'j_username').exists?} ie.text_field(:name, j_username).set(blah) ie.text_field(:name, j_password).set(blah) ie.button(:value, Submit).click Without any insight into your actual problem, code snippets or the like, this is my best guess. -Charley On 3/7/07, Steven List [EMAIL PROTECTED] wrote: 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=6823messageID=19642#19642 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Seemingly bogus error in simple script
Upgrading to the latest development version fixed the problem. - Posted via Jive Forums http://forums.openqa.org/thread.jspa?threadID=6823messageID=19650#19650 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Seemingly bogus error in simple script
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=6823messageID=19647#19647 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general
Re: [Wtr-general] Seemingly bogus error in simple script
You didn't say there was an error or anything went wrong. I'd recommend ie developer toolbar over show_all_objects. The link is on the FAQ site. Otherwise, are you having problems? -Charley On 3/7/07, matt [EMAIL PROTECTED] wrote: 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=6823messageID=19647#19647 ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general ___ Wtr-general mailing list Wtr-general@rubyforge.org http://rubyforge.org/mailman/listinfo/wtr-general