Capybara increases maximum page load time

I have a page that sometimes loads in a minute. Suppose this expected behavior does not change. In these cases, I get Net::ReadTimeout .

Please note that this is after going to the page by clicking the button on the previous page, not an ajax request. Therefore, Capybara.using_wait_time does not help.

I tried a few radical things (some of which I knew would not work):

  • Setting page.driver.browser.manage.timeouts implicit_wait , script_timeout and page_load .
  • Quoting over the entire space of objects and setting the entire value of Selenium::WebDriver::Remote::Http::Default timeout .
  • Cycling through the entire space of objects and setting all Net::HTTP read_timeout .
  • page.driver.browser.send(:bridge).http.instance_variable_get(:@http).read_timeout=

No, it seems to work. This should be very trivial, but I could not find a way to do this.

If you know that an agnostic webdriver solution would be great. If not, I use selenium.

+5
source share
1 answer

Selenium has many different timeout settings, some of which can be changed at runtime, others that must be set when the driver is initialized. Most likely you are using the Http: Default timeout by default - 60 seconds. You can override this by passing your own instance to the Selenium driver as http_client

 Capybara.register_driver :slow_selenium do |app| client = Selenium::WebDriver::Remote::Http::Default.new client.timeout = 120 Capybara::Selenium::Driver.new(app, http_client: client) end 

and then use the driver: slow_selenium for tests that take more than a minute to load the page

+11
source

All Articles