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: <a href="http://www.openqa.org/watir">http://www.openqa.org/watir</a> or build your own from the repository which is on the FAQ page under Installing a Gem from the latest development source.
<br><br> If you use the latest version of Watir, you should be able to wait for controls on the page to exist. <br><br>require 'watir'<br>include Watir <br> <br>ie = IE.start('<a href="http://blah">http://blah
</a>)<br>wait_until{ie.text_field(:name, 'j_username').exists?}<br>ie.text_field(:name, "j_username").set("blah")<br>ie.text_field(:name, "j_password").set("blah")<br>ie.button
(:value, "Submit").click<br><br>Without any insight into your actual problem, code snippets or the like, this is my best guess. <br><br>-Charley<br><br><br><div><span class="gmail_quote">On 3/7/07, <b class="gmail_sendername">
Steven List</b> <<a href="mailto:forum-watir-users@openqa.org">forum-watir-users@openqa.org</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I'm brand new at this.<br><br>I've created a very simple script to test a login page...<br><br>require 'watir'<br><br>ie = Watir::IE.start("<a href="http://mysite">http://mysite</a>")<br><br>ie.text_field
(:name, "j_username").set("blah")<br>ie.text_field(:name, "j_password").set("blah")<br>ie.button(:value, "Submit").click<br><br>If I execute these commands manually in irb, I have no problem.
<br><br>If I execute the script that contains them from the command line, I get this error:<br><br>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)
<br> from c:/ruby/lib/ruby/gems/1.8/gems/watir-1.4.1/./watir.rb:3382:in `set'<br> from Z:/Customers/Beneplace/Beneplace Redesign/WATIR tests/admin-login.rb:5<br><br>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.
<br><br>If I put additional commands AFTER the click, they do not get executed.<br><br>This is being used with a JSP page, if that makes any difference, and IE7.<br><br>Thanks for any help.<br><br>Steven<br>---------------------------------------------------------------------
<br>Posted via Jive Forums<br><a href="http://forums.openqa.org/thread.jspa?threadID=6823&messageID=19642#19642">http://forums.openqa.org/thread.jspa?threadID=6823&messageID=19642#19642</a><br>_______________________________________________
<br>Wtr-general mailing list<br><a href="mailto:Wtr-general@rubyforge.org">Wtr-general@rubyforge.org</a><br><a href="http://rubyforge.org/mailman/listinfo/wtr-general">http://rubyforge.org/mailman/listinfo/wtr-general</a>
<br></blockquote></div><br>