Wednesday, February 9, 2011

How to wait in Watir?

Watir does not wait for new page to load, except:

when you "attach" to an existing

window
use the "click" method
"set" or "clear" radio buttons or checkboxes
when you select an item in a select list
when you clear a text field
when you "goto" a new page
when you "submit" a form
when you "back", "forward" or "refresh" the browser
when you "fire_event" on any element


ie = Watir::IE.attach(:title, 'My Window')
# no need to wait, ie.wait called implicitly
ie.link(:id, 'mylink').click
# no need to wait, ie.wait called implicitly
assert(ie.link(:id, 'mynewlink).exists?)

"Watir is deterministic. Watir does not wait X seconds. It waits until the page is loaded. Period."

No comments:

Post a Comment