There are a few threads about this problem (just google the title of this post) and this is the code that worked for me, built on the suggestions found in a couple of them.
Capybara::Selenium::Driver.class_eval do def quit puts "Press RETURN to quit the browser" $stdin.gets @browser.quit rescue Errno::ECONNREFUSED # Browser must have already gone end end
It’s a monkey patch of what I found in gems/capybara-1.1.2/lib/capybara/selenium/driver.rb and I put it in a file loaded by spec_helper.rb
I just added the puts and the gets lines to the original code.
There is a last annoyance left: the browser doesn’t stop at the page that triggered the error but it stops on a blank page. I have to click the back button to get to the page with the error, which might not always work. If anybody knows how to stop on the page with the error please leave a comment. Thanks!