From eb4d1711c49a42c0184f375beb5b5f5f2f78a512 Mon Sep 17 00:00:00 2001 From: Barne Kleinen Date: Mon, 2 Sep 2024 13:40:32 +0200 Subject: [PATCH 1/2] tentatively remove call to selenium browser --- lib/capybara/selenium/driver.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/capybara/selenium/driver.rb b/lib/capybara/selenium/driver.rb index ab22fa141..c4e6edb0c 100644 --- a/lib/capybara/selenium/driver.rb +++ b/lib/capybara/selenium/driver.rb @@ -353,7 +353,7 @@ def clear_storage end def clear_session_storage - if @browser.respond_to? :session_storage + if false # && @browser.respond_to? :session_storage @browser.session_storage.clear else begin @@ -367,7 +367,7 @@ def clear_session_storage end def clear_local_storage - if @browser.respond_to? :local_storage + if false # && @browser.respond_to? :local_storage @browser.local_storage.clear else begin From be7f4b2179ad83dbf07f9912b07293aac02f722c Mon Sep 17 00:00:00 2001 From: Barne Kleinen Date: Mon, 2 Sep 2024 15:24:01 +0200 Subject: [PATCH 2/2] remove call to @browser.session_storage.clear and @browser.local_storage.clear completely --- lib/capybara/selenium/driver.rb | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/lib/capybara/selenium/driver.rb b/lib/capybara/selenium/driver.rb index c4e6edb0c..2be49c40e 100644 --- a/lib/capybara/selenium/driver.rb +++ b/lib/capybara/selenium/driver.rb @@ -353,29 +353,21 @@ def clear_storage end def clear_session_storage - if false # && @browser.respond_to? :session_storage - @browser.session_storage.clear - else - begin - @browser&.execute_script('window.sessionStorage.clear()') - rescue # rubocop:disable Style/RescueStandardError - unless options[:clear_session_storage].nil? - warn 'sessionStorage clear requested but is not supported by this driver' - end + begin + @browser&.execute_script('window.sessionStorage.clear()') + rescue # rubocop:disable Style/RescueStandardError + unless options[:clear_session_storage].nil? + warn 'sessionStorage clear requested but is not supported by this driver' end end end def clear_local_storage - if false # && @browser.respond_to? :local_storage - @browser.local_storage.clear - else - begin - @browser&.execute_script('window.localStorage.clear()') - rescue # rubocop:disable Style/RescueStandardError - unless options[:clear_local_storage].nil? - warn 'localStorage clear requested but is not supported by this driver' - end + begin + @browser&.execute_script('window.localStorage.clear()') + rescue # rubocop:disable Style/RescueStandardError + unless options[:clear_local_storage].nil? + warn 'localStorage clear requested but is not supported by this driver' end end end