Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Capybara patch to avoid `'about:blank')` which hangs sometimes.
# Monkey-patch on Capybara!!!
class Capybara::Selenium::Driver < Capybara::Driver::Base
# Patch to avoid `'about:blank')` which hangs sometimes.
def reset!
# Use instance variable directly so we avoid starting the browser just to reset the session
if @browser
begin @browser.manage.delete_all_cookies
rescue Selenium::WebDriver::Error::UnhandledError
# delete_all_cookies fails when we've previously gone
# to about:blank, so we rescue this error and do nothing
# instead.
# about:blank is broken for this purpose. Use app's /ping"#{Capybara.app_host}/ping")

This comment has been minimized.

Copy link
Owner Author

mars commented Aug 13, 2014

Note the "#{Capybara.app_host}/ping" URL should be revised to use a page in your subject app.

This was applied successfully with Capybara 2.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.