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

2

21

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.

Och answered 26/1, 2012 at 4:59 Comment(2)
I found the following discussion concerning internal timeouts for selenium. This seems to be my problem however when trying to use the code recommended to adjust the internal timeouts for watir-webdriver I get a "connection refused" exception from net/http.rb.Och
see internal timeouts hereOch
E
59

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
Execrative answered 28/1, 2012 at 11:38 Comment(3)
Great job Alister, I've give you 10 upclicks for that if the system would let meCarrico
How do I set the timeout to infinity ? -1 perhaps ?Dagney
AlisterScott - sorry for the shameless advertising. Can you please help me with this one - #29424300 . thanks!!!Dagney
B
16

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?

Bobbe answered 4/4, 2014 at 22:56 Comment(1)
Just to be clear, the option to adjust the default timeout in Watir will not affect the client timeout that was the concern in this question.Mauceri

© 2022 - 2024 — McMap. All rights reserved.