Question

I'm using Watir 1.6.7.

I'm working on developing some regression tests for a PeopleSoft App using Watir and Cucumber. I have run into a few issues with forms in the application.

First, when entering a value into a text_field, the page refreshes when the user clicks outside the text_field. Waiting for the next text_field element to exist is problematic because it may locate the element before the page reloads, or after the page reloads as expected. Increasing the wait time never feels like a good solution, even though it "works".

The second issue is that the page refresh is not triggered until the user clicks outside the current field. In this case, that happens when the script tries to access the next text_field to be populated. One solution here would be to send a or keystroke, but I can feel the script becoming more brittle with every addition like this.

Are there any other approaches that would be less brittle, and not require 2-3 extra commands in between each text_field action?

The play-by-play looks like:

  • Browser navigates to page that contains the form.
  • Browser fills in first form field. (fix: send keystroke to cause page refresh, wait_until second field is visible again)
  • Browser selects the second form field to be filled out. (again, keystroke & wait_until)
  • Page refreshes, script fails. (resolved)
  • Browser selects the third form field...

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top