Molfar
Molfar

Reputation: 1491

Set page load timeout

I use watir webdriver gem with chromedriver. I know (https://code.google.com/p/chromedriver/issues/detail?id=9#c25) that in new version 2.1 of chromedriver there is a special page load timeout. How can I set it from ruby code?

Upvotes: 1

Views: 5634

Answers (1)

Justin Ko
Justin Ko

Reputation: 46826

There is a page load timeout that specifies how long to wait for a page to load before throwing an exception.

This is set within the underlying selenium-webdriver object:

browser.driver.manage.timeouts.page_load = 10 #seconds

For example, an exception will now be thrown when a page does not load fast enough:

browser = Watir::Browser.new :chrome
browser.driver.manage.timeouts.page_load = 0
browser.goto 'http://www.google.ca'
#=> Selenium::WebDriver::Error::TimeOutError

Upvotes: 5

Related Questions