I\'m trying to tell my watir script to wait for an ajax-injected login box to open up. I am using watir-webdriver, and testing in Chrome. I cannot get wait_until
I run into the same issue few weeks ago. The point is that Watir::Wait.until{} waits ONLY for the main page to load (tested mainly on Firefox). If you have some JavaScript code loading other components, these are not waited for.
So, the only solution is to pick and element and explicitly wait for it to appear (using methods 2 & 3).
You can also set timeout with browser.it will wait for it 700 seconds, like this.
client = Selenium::WebDriver::Remote::Http::Default.new
client.timeout = 700 # seconds � default is 60 second
ie=Watir::Browser.new:firefox, :http_client => client
Do this first:
require "watir-webdriver/wait"
Then try these:
Watir::Wait.until { ... }
browser.text_field(:id => 'username').when_present.set("name")
browser.text_field(:id => 'username').wait_until_present
Note that "present" here means "the element both exists and is visible".