From 320846e2fb1e5a91a7a32e4c459b45bcf2d89273 Mon Sep 17 00:00:00 2001 From: Robin Daugherty Date: Wed, 13 Jan 2021 09:23:00 -0500 Subject: [PATCH] Fix failing status code at quit from InvalidSessionIdError --- History.md | 5 +++++ lib/capybara/selenium/driver.rb | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/History.md b/History.md index eadf578e..d26d34ac 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,8 @@ +# Version 3.34.1 +Release date: unreleased + +* Ignore Selenium::WebDriver::Error::InvalidSessionIdError when quitting driver [Robin Daugherty] + # Version 3.34.0 Release date: 2020-11-26 diff --git a/lib/capybara/selenium/driver.rb b/lib/capybara/selenium/driver.rb index 862931e0..6bb3824f 100644 --- a/lib/capybara/selenium/driver.rb +++ b/lib/capybara/selenium/driver.rb @@ -265,7 +265,8 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base def quit @browser&.quit - rescue Selenium::WebDriver::Error::SessionNotCreatedError, Errno::ECONNREFUSED + rescue Selenium::WebDriver::Error::SessionNotCreatedError, Errno::ECONNREFUSED, + Selenium::WebDriver::Error::InvalidSessionIdError # Browser must have already gone rescue Selenium::WebDriver::Error::UnknownError => e unless silenced_unknown_error_message?(e.message) # Most likely already gone