How do I change the page load Timeouts in Watir-Webdriver (timeout in .click method)

て烟熏妆下的殇ゞ 提交于 2020-01-09 12:51:40

问题


I have the following code

browser.link(:text => 'Generate Report').click  
browser.radio(:value => 'byTotalValue').wait_until_present(180)  

which requests that a report be generated and then waits for the report by looking for an element on the report page. The report can take upwards of 2 minutes to appear.

What is happening is a Timeout::Error is being raised from the click method after 60 seconds. I suspect that Watir-Webdriver has implemented some form of wait for page load within the click method but I don't see a way to adjust the value.

Any help understanding this would be appreciated.


回答1:


I'd try upping the client timeout:

client = Selenium::WebDriver::Remote::Http::Default.new
client.timeout = 180 # seconds – default is 60

b = Watir::Browser.new :firefox, :http_client => client



回答2:


Update: This monkey patch has been merged into watir-webdriver and so will no longer be needed in watir-webdriver v0.6.5. You will be able to set the timeout using:

Watir.default_timeout = 90

from: Is it possible to globally increase Watir-Webdriver when_present wait time?



来源:https://stackoverflow.com/questions/9014121/how-do-i-change-the-page-load-timeouts-in-watir-webdriver-timeout-in-click-met

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!