There is a some heavy page, that after visiting it Selenium doesn't respond to Capybara for a minute, so whatever do I call, throws Net::ReadTimeout.
I could edit it globally somehow like:
http_client = Selenium::WebDriver::Remote::Http::Default.new
http_client.timeout = 120
Capybara::Selenium::Driver.new(app,
http_client: http_client,
But in the case of some repetitive timeouts my tests would last for too long, so I do not want to increase timeout globally.
I want to increase it for a single test somehow like:
before do
@timeout = page.driver.bridge.http.timeout
page.driver.bridge.http.timeout = 120
end
after do
page.driver.bridge.http.timeout = @timeout
end
But in /lib/selenium/webdriver/common/driver.rb the bridge method is private, while only browser and capabilities are exposed to public.
So what is the correct way to edit this timeout attribute globally?
UPD: Even if I find how to set this attribute, seems like the before/after approach doesn't work, because @http ||= ( saves the default timeout value in the first before in the chain of setUps, that precede mine.
Capybara has a default_wait_time that can be changed in the middle of tests:
using_wait_time 120 do
foo(bar)
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With