How to fix (some) UnknownError and InvalidArgumentError in Capybara

The other day, our headless system specs in a Ruby on Rails project started failing with a bunch of errors we hadn’t seen before. Mostly Selenium::WebDriver::Error::UnknownError: unknown error: failed to close window in 20 seconds but in some cases also Selenium::WebDriver::Error::InvalidArgumentError: invalid argument: 'handle' must be a string.

Usually random errors in browser tests can be fixed by upgrading selenium-webdriver, Chrome, chromedriver or any combination thereof, but not this time.

Recent entries

Explore the archives

I have written about BiQ on Rails, Copenhagen.rb, Substance Lab, blogging, browsers, business, development, email, games, hardware, ideas, life, mentalized.net, movies, process, product management, programming, projects, reboot, software, technology, usability and webdesign.