Skip to content

selenium.exception

WebDriver error hierarchy and mapping from server error responses.

WebDriverException

class WebDriverException: object.Exception;

Base type for every error raised by the library.

NoSuchElementException

class NoSuchElementException: selenium.exception.WebDriverException;

No element matched the requested locator.

StaleElementReferenceException

class StaleElementReferenceException: selenium.exception.WebDriverException;

The referenced element is no longer attached to the DOM.

InvalidElementStateException

class InvalidElementStateException: selenium.exception.WebDriverException;

The element is in a state that does not permit the command.

WebDriverTimeoutException

class WebDriverTimeoutException: selenium.exception.WebDriverException;

A command did not complete within its configured timeout.

WebDriverConnectionException

class WebDriverConnectionException: selenium.exception.WebDriverException;

The driver process could not be reached or a session could not be created.

InvalidArgumentException

class InvalidArgumentException: selenium.exception.WebDriverException;

A command argument was missing or malformed.

InvalidSelectorException

class InvalidSelectorException: selenium.exception.WebDriverException;

The selector expression was not valid for its strategy.

InvalidSessionIdException

class InvalidSessionIdException: selenium.exception.WebDriverException;

The session id is unknown, which usually means the session has ended.

JavaScriptException

class JavaScriptException: selenium.exception.WebDriverException;

Injected JavaScript threw an error during evaluation.

ElementNotInteractableException

class ElementNotInteractableException: selenium.exception.WebDriverException;

The element cannot receive the attempted interaction.

ElementClickInterceptedException

class ElementClickInterceptedException: selenium.exception.WebDriverException;

Another element intercepted the click on the target element.

NoSuchWindowException

class NoSuchWindowException: selenium.exception.WebDriverException;

The targeted window or tab no longer exists.

NoSuchFrameException

class NoSuchFrameException: selenium.exception.WebDriverException;

The targeted frame could not be found.

NoSuchShadowRootException

class NoSuchShadowRootException: selenium.exception.WebDriverException;

The element does not have a shadow root.

DetachedShadowRootException

class DetachedShadowRootException: selenium.exception.WebDriverException;

The referenced shadow root is no longer attached to the DOM.

ScriptTimeoutException

class ScriptTimeoutException: selenium.exception.WebDriverException;

An asynchronous script did not complete within the script timeout.

UnknownCommandException

class UnknownCommandException: selenium.exception.WebDriverException;

The driver does not recognize the requested command.

UnsupportedOperationException

class UnsupportedOperationException: selenium.exception.WebDriverException;

The driver recognizes the command but does not support it.

UnexpectedAlertOpenException

class UnexpectedAlertOpenException: selenium.exception.WebDriverException;

A user prompt is open and blocking the command.

NoSuchAlertException

class NoSuchAlertException: selenium.exception.WebDriverException;

No user prompt is currently open.

UnableToSetCookieException

class UnableToSetCookieException: selenium.exception.WebDriverException;

The cookie could not be set.

InvalidCookieDomainException

class InvalidCookieDomainException: selenium.exception.UnableToSetCookieException;

The cookie's domain is not valid for the current document.

NoSuchCookieException

class NoSuchCookieException: selenium.exception.WebDriverException;

No cookie matched the requested name.