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.
Thanks!
-Tiffany
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.
Move up to more current watir or better yet watir-webdriver and use the .when_present decorator?