title: Capybara session not closing at end of test
body: <p>I have a series of automated tests using selenium/capybara/rspec. For one of my tests, I am dirtying a form and verifying that certain errors are triggered. That is the end of the test... The problem is that when the test finishes running, the and the code tries to close the browser, a JavaScript message pops up with <code>This page is asking you to confirm that you want to leave - data you have entered may not be saved.</code></p>
  
  <p>In my spec helper I have:</p>
  
  <pre><code>Capybara.register_driver :firefox do |app|
    Capybara::Selenium::Driver.new(app, browser: :firefox)
  end
  
  Capybara.default_driver = :firefox
  Capybara.app_host = ********* #redacted
  Capybara.default_max_wait_time = 5
  
  RSpec.configure do |config|
    config.before(:each) do
      config.include Capybara::DSL
    end
  
    config.after(:each) do
      Capybara.reset_sessions!
    end
  end
  </code></pre>
  
  <p>and am getting a test failure with <code>Capybara::ExpectationNotMet: Timed out waiting for Selenium session reset</code></p>
  
  <p>How do I make the test close the browser at the end?</p>