Take the 2-minute tour ×

One of our developers wants to run my data load framework on his Windows 7 PC with IE 9, but when he tries, it immediately fails because it can't find the first element we perform an action on (in this case, the username field).

I've never had a problem with this as Watir is really good about waiting for a page to finish loading before it moves on. I can run the same code from one of my PCs hitting his dev machine without a problem, but when he runs both my framework and the app locally, Watir doesn't seem to be waiting for the page to finish loading (or the way his machine serves the page is tricking it).

He's running Ruby 1.8.7 with Watir 1.9.1

Any ideas?

I can't remember what it is that Watir polls to confirm that the page load is complete - please let me know if you do and that might be a hint for us to follow on the Dev PC.



Adding some more details:

Our QA site isn't public, but our production site is and since the first thing I hit is the login screen....


Here's the code that is failing:

ie.text_field(:name, 'j_username').set(producer)

The error we're getting is that the element doesn't exist on the page when the developer tries to run my tests from his local machine where he's also running the app under test.

This doesn't happen on any other PC (he did this on his old machine all the time). There's something weird happening where Watir is not waiting for the page to load - that's why I'm wondering what Watir polls to make sure the page is loaded. I could add a workaround to make sure that the element is present before the test starts, but I don't really want to do that for one Dev machine.

share|improve this question
Can you provide HTML and Watir code? Link to the page, if it is public, would help too. –  Željko Filipin Mar 29 '12 at 4:50
Tiffany, I implemented Jenkins over a year ago for compatibility issues just like this and never looked back. 9/10 times there was some nagging issue with timing, or the Ruby/library versions. I gave our devs a few slave VMs to use (to let Jenkins use) and they could use any script of mine they wanted. I know this doesn't answer your question, but it has made my life so much easier! Also, passing parameters from Jenkins -> scripts is very easy and allows anyone to run test with custom settings. –  adam reed Mar 29 '12 at 14:24
Thanks for the Jenkins suggestion Adam - I'll look into it! –  tcfodor Mar 30 '12 at 17:43
add comment

2 Answers

up vote 0 down vote accepted

Move up to more current watir or better yet watir-webdriver and use the .when_present decorator?

browser.text_field(:how, 'what').when_present.set 'john-doe'
share|improve this answer
Looking forward to moving to watir-webdriver! –  tcfodor Apr 2 '12 at 17:08
add comment

Turns out, my problem was that his command prompt wasn't being opened with admin rights. Argh! I should have remembered that from the Vista days.

share|improve this answer
That would do it! –  Chuck van der Linden Apr 3 '12 at 18:29
add comment

Your Answer


