mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Conditionally handle removed error types
This commit is contained in:
parent
e137980d4d
commit
6423f16979
2 changed files with 28 additions and 8 deletions
|
@ -264,6 +264,10 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
|
|||
|
||||
private
|
||||
|
||||
def selenium_4?
|
||||
defined?(Selenium::WebDriver::VERSION) && (Selenium::WebDriver::VERSION.to_f >= 4)
|
||||
end
|
||||
|
||||
def native_args(args)
|
||||
args.map { |arg| arg.is_a?(Capybara::Selenium::Node) ? arg.native : arg }
|
||||
end
|
||||
|
@ -278,15 +282,23 @@ private
|
|||
end
|
||||
|
||||
def clear_browser_state_errors
|
||||
::Selenium::WebDriver.logger.suppress_deprecations do
|
||||
[Selenium::WebDriver::Error::UnhandledError, Selenium::WebDriver::Error::UnknownError]
|
||||
errors = [Selenium::WebDriver::Error::UnknownError]
|
||||
unless selenium_4?
|
||||
::Selenium::WebDriver.logger.suppress_deprecations do
|
||||
errors << Selenium::WebDriver::Error::UnhandledError
|
||||
end
|
||||
end
|
||||
errors
|
||||
end
|
||||
|
||||
def unhandled_alert_errors
|
||||
::Selenium::WebDriver.logger.suppress_deprecations do
|
||||
[Selenium::WebDriver::Error::UnhandledAlertError, Selenium::WebDriver::Error::UnexpectedAlertOpenError]
|
||||
errors = [Selenium::WebDriver::Error::UnexpectedAlertOpenError]
|
||||
unless selenium_4?
|
||||
::Selenium::WebDriver.logger.suppress_deprecations do
|
||||
errors << Selenium::WebDriver::Error::UnhandledAlertError
|
||||
end
|
||||
end
|
||||
errors
|
||||
end
|
||||
|
||||
def delete_all_cookies
|
||||
|
@ -367,9 +379,13 @@ private
|
|||
end
|
||||
|
||||
def find_modal_errors
|
||||
::Selenium::WebDriver.logger.suppress_deprecations do
|
||||
[Selenium::WebDriver::Error::TimeoutError, Selenium::WebDriver::Error::TimeOutError]
|
||||
errors = [Selenium::WebDriver::Error::TimeoutError]
|
||||
unless selenium_4?
|
||||
::Selenium::WebDriver.logger.suppress_deprecations do
|
||||
errors << Selenium::WebDriver::Error::TimeOutError
|
||||
end
|
||||
end
|
||||
errors
|
||||
end
|
||||
|
||||
def silenced_unknown_error_message?(msg)
|
||||
|
|
|
@ -46,9 +46,13 @@ private
|
|||
end
|
||||
|
||||
def cdp_unsupported_errors
|
||||
::Selenium::WebDriver.logger.suppress_deprecations do
|
||||
[Selenium::WebDriver::Error::UnhandledError, Selenium::WebDriver::Error::WebDriverError]
|
||||
errors = [Selenium::WebDriver::Error::WebDriverError]
|
||||
unless selenium_4?
|
||||
::Selenium::WebDriver.logger.suppress_deprecations do
|
||||
errors << Selenium::WebDriver::Error::UnhandledError
|
||||
end
|
||||
end
|
||||
errors
|
||||
end
|
||||
|
||||
def execute_cdp(cmd, params = {})
|
||||
|
|
Loading…
Add table
Reference in a new issue