Module: Selenium::WebDriver::Error

Defined in:
build/rb/lib/selenium/webdriver/common/error.rb,
build/rb/lib/selenium/webdriver/remote/server_error.rb

Defined Under Namespace

Classes: ElementClickInterceptedError, ElementNotInteractableError, InsecureCertificateError, InvalidArgumentError, InvalidCookieDomainError, InvalidElementStateError, InvalidSelectorError, InvalidSessionIdError, JavascriptError, MoveTargetOutOfBoundsError, NoSuchAlertError, NoSuchCookieError, NoSuchElementError, NoSuchFrameError, NoSuchWindowError, ScriptTimeoutError, ServerError, SessionNotCreatedError, StaleElementReferenceError, TimeoutError, UnableToCaptureScreenError, UnableToSetCookieError, UnexpectedAlertOpenError, UnknownCommandError, UnknownError, UnknownMethodError, UnsupportedOperationError, WebDriverError

Class Method Summary collapse

Class Method Details

.for_error(error) ⇒ Object

Returns exception from its string representation.

Parameters:

  • error (String, nil)


29
30
31
32
33
34
35
36
# File 'build/rb/lib/selenium/webdriver/common/error.rb', line 29

def self.for_error(error)
  return if error.nil?

  klass_name = error.split(' ').map(&:capitalize).join.sub(/Error$/, '')
  const_get("#{klass_name}Error", false)
rescue NameError
  WebDriverError
end