Allow new errors returned by selenium-webdriver 3.4.x
This commit is contained in:
parent
14d9f2afc8
commit
084cf8eded
|
@ -35,6 +35,13 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
|
||||||
def initialize(app, options={})
|
def initialize(app, options={})
|
||||||
begin
|
begin
|
||||||
require 'selenium-webdriver'
|
require 'selenium-webdriver'
|
||||||
|
# Fix for selenium-webdriver 3.4.0 which misnamed these
|
||||||
|
if !defined?(::Selenium::WebDriver::Error::ElementNotInteractableError)
|
||||||
|
::Selenium::WebDriver::Error.const_set('ElementNotInteractableError', Class.new(::Selenium::WebDriver::Error::WebDriverError))
|
||||||
|
end
|
||||||
|
if !defined?(::Selenium::WebDriver::Error::ElementClickInterceptedError)
|
||||||
|
::Selenium::WebDriver::Error.const_set('ElementClickInterceptedError', Class.new(::Selenium::WebDriver::Error::WebDriverError))
|
||||||
|
end
|
||||||
rescue LoadError => e
|
rescue LoadError => e
|
||||||
if e.message =~ /selenium-webdriver/
|
if e.message =~ /selenium-webdriver/
|
||||||
raise LoadError, "Capybara's selenium driver is unable to load `selenium-webdriver`, please install the gem and add `gem 'selenium-webdriver'` to your Gemfile if you are using bundler."
|
raise LoadError, "Capybara's selenium driver is unable to load `selenium-webdriver`, please install the gem and add `gem 'selenium-webdriver'` to your Gemfile if you are using bundler."
|
||||||
|
@ -250,10 +257,12 @@ class Capybara::Selenium::Driver < Capybara::Driver::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def invalid_element_errors
|
def invalid_element_errors
|
||||||
[Selenium::WebDriver::Error::StaleElementReferenceError,
|
[::Selenium::WebDriver::Error::StaleElementReferenceError,
|
||||||
Selenium::WebDriver::Error::UnhandledError,
|
::Selenium::WebDriver::Error::UnhandledError,
|
||||||
Selenium::WebDriver::Error::ElementNotVisibleError,
|
::Selenium::WebDriver::Error::ElementNotVisibleError,
|
||||||
Selenium::WebDriver::Error::InvalidSelectorError] # Work around a race condition that can occur with chromedriver and #go_back/#go_forward
|
::Selenium::WebDriver::Error::InvalidSelectorError, # Work around a race condition that can occur with chromedriver and #go_back/#go_forward
|
||||||
|
::Selenium::WebDriver::Error::ElementNotInteractableError,
|
||||||
|
::Selenium::WebDriver::Error::ElementClickInterceptedError]
|
||||||
end
|
end
|
||||||
|
|
||||||
def no_such_window_error
|
def no_such_window_error
|
||||||
|
|
Loading…
Reference in New Issue