Module: Selenium::WebDriver::Error

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

Defined Under Namespace

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

Constant Summary collapse

SUPPORT_MSG =
'For documentation on this error, please visit:'
ERROR_URL =
'https://www.selenium.dev/documentation/webdriver/troubleshooting/errors'

Class Method Summary collapse

Class Method Details

.for_error(error) ⇒ Object

Returns exception from its string representation.

Parameters:

  • error (String, nil)


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

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