Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save mikegehard/922296 to your computer and use it in GitHub Desktop.
Save mikegehard/922296 to your computer and use it in GitHub Desktop.
Setting longer HTTP timeout in capybara
# We need this to fix the random timeout error that we were seeing in CI.
# May be related to: http://code.google.com/p/selenium/issues/detail?id=1439
Capybara.register_driver :selenium_with_long_timeout do |app|
client = Selenium::WebDriver::Remote::Http::Default.new
client.timeout = 120
Capybara::Driver::Selenium.new(app, :browser => :firefox, :http_client => client)
end
Capybara.javascript_driver = :selenium_with_long_timeout
@woto
Copy link

woto commented May 22, 2013

Same reason here.
Not sure, but also

Capybara.default_wait_time = 10

@Nuru
Copy link

Nuru commented Sep 6, 2013

Using Capybara 1.0.0 or later, it is Capybara::Selenium::Driver not Capybara::Driver::Selenium.

See release notes ("Changed") for 1.0.0 at https://github.com/jnicklas/capybara/blob/master/History.md

Also, Capybara.default_wait_time is how long Capybara waits for AJAX calls to modify the DOM when testing conditions and has nothing to do with Timeouts.

@iloveitaly
Copy link

Note that a recent capybara change requires Capybara::Selenium::Driver instead of Capybara::Driver::Selenium

@epipheus
Copy link

does this work the same with the capabilities syntax? where does read_timeout go now?

@mikegehard
Copy link
Author

@epipheus I'm not sure. I've moved out of the Ruby ecosystem so can't confirm where it goes now. Sorry...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment