selenium.webdriver.remote.errorhandler#

Classes

ErrorCode()

Error codes defined in the WebDriver wire protocol.

ErrorHandler()

Handles errors returned by the WebDriver server.

ExceptionMapping()

Maps each errorcode in ErrorCode object to corresponding exception.

class ExceptionMapping[source]#

Bases: object

Maps each errorcode in ErrorCode object to corresponding exception.

Please refer to https://www.w3.org/TR/webdriver2/#errors for w3c specification.

NO_SUCH_ELEMENT#

alias of NoSuchElementException

NO_SUCH_FRAME#

alias of NoSuchFrameException

NO_SUCH_SHADOW_ROOT#

alias of NoSuchShadowRootException

STALE_ELEMENT_REFERENCE#

alias of StaleElementReferenceException

ELEMENT_NOT_VISIBLE#

alias of ElementNotVisibleException

INVALID_ELEMENT_STATE#

alias of InvalidElementStateException

UNKNOWN_ERROR#

alias of WebDriverException

ELEMENT_IS_NOT_SELECTABLE#

alias of ElementNotSelectableException

JAVASCRIPT_ERROR#

alias of JavascriptException

TIMEOUT#

alias of TimeoutException

NO_SUCH_WINDOW#

alias of NoSuchWindowException

alias of InvalidCookieDomainException

alias of UnableToSetCookieException

UNEXPECTED_ALERT_OPEN#

alias of UnexpectedAlertPresentException

NO_ALERT_OPEN#

alias of NoAlertPresentException

SCRIPT_TIMEOUT#

alias of TimeoutException

IME_NOT_AVAILABLE#

alias of ImeNotAvailableException

IME_ENGINE_ACTIVATION_FAILED#

alias of ImeActivationFailedException

INVALID_SELECTOR#

alias of InvalidSelectorException

SESSION_NOT_CREATED#

alias of SessionNotCreatedException

MOVE_TARGET_OUT_OF_BOUNDS#

alias of MoveTargetOutOfBoundsException

INVALID_XPATH_SELECTOR#

alias of InvalidSelectorException

INVALID_XPATH_SELECTOR_RETURN_TYPER#

alias of InvalidSelectorException

ELEMENT_NOT_INTERACTABLE#

alias of ElementNotInteractableException

INSECURE_CERTIFICATE#

alias of InsecureCertificateException

INVALID_ARGUMENT#

alias of InvalidArgumentException

INVALID_COORDINATES#

alias of InvalidCoordinatesException

INVALID_SESSION_ID#

alias of InvalidSessionIdException

alias of NoSuchCookieException

UNABLE_TO_CAPTURE_SCREEN#

alias of ScreenshotException

ELEMENT_CLICK_INTERCEPTED#

alias of ElementClickInterceptedException

UNKNOWN_METHOD#

alias of UnknownMethodException

DETACHED_SHADOW_ROOT#

alias of DetachedShadowRootException

class ErrorCode[source]#

Bases: object

Error codes defined in the WebDriver wire protocol.

SUCCESS = 0#
NO_SUCH_ELEMENT = [7, 'no such element']#
NO_SUCH_FRAME = [8, 'no such frame']#
NO_SUCH_SHADOW_ROOT = ['no such shadow root']#
UNKNOWN_COMMAND = [9, 'unknown command']#
STALE_ELEMENT_REFERENCE = [10, 'stale element reference']#
ELEMENT_NOT_VISIBLE = [11, 'element not visible']#
INVALID_ELEMENT_STATE = [12, 'invalid element state']#
UNKNOWN_ERROR = [13, 'unknown error']#
ELEMENT_IS_NOT_SELECTABLE = [15, 'element not selectable']#
JAVASCRIPT_ERROR = [17, 'javascript error']#
XPATH_LOOKUP_ERROR = [19, 'invalid selector']#
TIMEOUT = [21, 'timeout']#
NO_SUCH_WINDOW = [23, 'no such window']#
UNEXPECTED_ALERT_OPEN = [26, 'unexpected alert open']#
NO_ALERT_OPEN = [27, 'no such alert']#
SCRIPT_TIMEOUT = [28, 'script timeout']#
INVALID_ELEMENT_COORDINATES = [29, 'invalid element coordinates']#
IME_NOT_AVAILABLE = [30, 'ime not available']#
IME_ENGINE_ACTIVATION_FAILED = [31, 'ime engine activation failed']#
INVALID_SELECTOR = [32, 'invalid selector']#
SESSION_NOT_CREATED = [33, 'session not created']#
MOVE_TARGET_OUT_OF_BOUNDS = [34, 'move target out of bounds']#
INVALID_XPATH_SELECTOR = [51, 'invalid selector']#
INVALID_XPATH_SELECTOR_RETURN_TYPER = [52, 'invalid selector']#
ELEMENT_NOT_INTERACTABLE = [60, 'element not interactable']#
INSECURE_CERTIFICATE = ['insecure certificate']#
INVALID_ARGUMENT = [61, 'invalid argument']#
INVALID_COORDINATES = ['invalid coordinates']#
INVALID_SESSION_ID = ['invalid session id']#
UNABLE_TO_CAPTURE_SCREEN = [63, 'unable to capture screen']#
ELEMENT_CLICK_INTERCEPTED = [64, 'element click intercepted']#
UNKNOWN_METHOD = ['unknown method exception']#
DETACHED_SHADOW_ROOT = [65, 'detached shadow root']#
METHOD_NOT_ALLOWED = [405, 'unsupported operation']#
class ErrorHandler[source]#

Bases: object

Handles errors returned by the WebDriver server.

check_response(response)[source]#

Check that a JSON response from the WebDriver does not have an error.

Parameters:

response (dict[str, Any]) – The JSON response from the WebDriver server as a dictionary object.

Raises:

WebDriverException – If the response contains an error message.

Return type:

None