module Selenium::WebDriver::Error

Constants

DEPRECATED_ERRORS
ERRORS

@api private

ElementNotDisplayedError
NoAlertOpenError
ObsoleteElementError

Aliases for backwards compatibility.

ScriptTimeoutError

Aliases for OSS dialect.

TimeoutError
UnexpectedJavascriptError
UnhandledError

Public Class Methods

const_missing(const_name) click to toggle source
Calls superclass method
# File lib/selenium/webdriver/common/error.rb, line 369
def self.const_missing(const_name)
  super unless DEPRECATED_ERRORS.key?(const_name)
  if DEPRECATED_ERRORS[const_name]
    WebDriver.logger.deprecate("Selenium::WebDriver::Error::#{const_name}",
                               "#{DEPRECATED_ERRORS[const_name]} (ensure the driver supports W3C WebDriver specification)")
    DEPRECATED_ERRORS[const_name]
  else
    WebDriver.logger.deprecate("Selenium::WebDriver::Error::#{const_name}")
    WebDriverError
  end
end
for_code(code) click to toggle source

Returns exception from code (Integer - OSS, String - W3C). @param [Integer, String, nil] code

# File lib/selenium/webdriver/common/error.rb, line 29
def self.for_code(code)
  case code
  when nil, 0
    nil
  when Integer
    Object.const_get(ERRORS.fetch(code).to_s)
  when String
    klass_name = code.split(' ').map(&:capitalize).join.sub(/Error$/, '')
    const_get("#{klass_name}Error", false)
  end
rescue KeyError, NameError
  WebDriverError
end