Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. WebDriver
  3. Reference
  4. Errors

WebDriver errors

Any WebDrivercommand that is sent to might plausibly receive an errorresponse. An error is represented by anHTTP response with anHTTP status code in the 4xx or 5xx range, and a JSON payload holding details of the error.

Payload

Theerror object is a JSON Object that bears three, and sometimes four, fields:

error

Error type.

message

Human-readable description of the nature of the error.

stacktrace

Stacktrace report of the active stack frames at the time when the error occurred.

data (optional)

Arbitrary and implementation-defined data that it can be useful to present the user with.

Many drivers include theuser prompt's text when encountering anunexpected alert open error.

Example

For example aGET request to/session/1234/url, where1234 is a bogus session, would return a response with the404 Not Found status and the following body:

json
{  "value": {    "error": "invalid session id",    "message": "No active session with ID 1234",    "stacktrace": ""  }}

It is optional for the driver to annotate errors with additional error data. Notably, this is common when a user prompt, such aswindow.alert, has opened a modal dialog after execution of your previous WebDriver command request.

Because both WebDriver and JavaScript execution is halted by such a dialog, we see anunexpected alert open error in the subsequent response:

json
{  "value": {    "error": "unexpected alert open",    "message": "",    "stacktrace": "",    "data": {      "text": "Message from window.alert"    }  }}

In mostclients the error would be represented by some sort of errortype orobject representation. In Python it is represented as aWebDriverException, in Node.js as aWebDriverError, and in Java also as aWebDriverException.

Table of errors

Error typeHTTP status codeDescription
element click intercepted400 Bad RequestTheElement Clickcommand could not be completed because theelement receiving the events is obscuring the element that was requested clicked.
element not interactable400 Bad RequestAcommand could not be completed because the element is not pointer- or keyboard interactable.
insecure certificate400 Bad RequestNavigation caused the user agent to hit a certificate warning, which is usually the result of an expired or invalid TLS certificate.
invalid argument400 Bad RequestThe arguments passed to acommand are either invalid or malformed.
invalid cookie domain400 Bad RequestAn illegal attempt was made to set a cookie under a different domain than the current page.
invalid element state400 Bad RequestAcommand could not be completed because the element is in an invalid state, e.g., attempting toclear an element that isn't both editable and resettable.
invalid selector400 Bad RequestAn element retrieval command provided an unknown selector strategy.
invalid session id404 Not FoundGiven session ID is not recognized, meaning the session either does not exist of that it's not active. Note that a session thathas been deleted cannot be re-used.
JavaScript error500 Internal Server ErrorAn error occurred while executing JavaScript supplied by the user.
move target out of bounds500 Internal Server ErrorThe target for mouse interaction is not in the browser's viewport and cannot be brought into that viewport.
no such alert404 Not FoundAn attempt was made to operate on a user prompt when one was not open.
no such cookie404 Not FoundNo cookie matching the given path name was found amongst thecookies of the currentdocument.
no such element404 Not FoundAn element could not be located on the page using the given search parameters.
no such frame404 Not FoundAcommand to switch to a frame could not be satisfied because the frame could not be found.
no such window404 Not FoundAcommand to switch to a window could not be satisfied because the window could not be found.
script timeout408 Request TimeoutA script did not complete before its timeout expired.
session not created500 Internal Server ErrorA new session could not be created, either because the browser could not be started or because the providedcapabilities to start the session did not match.
stale element reference404 Not FoundAcommand failed because the referencedelement is no longer attached to the DOM.
timeout408 Request TimeoutAn operation did not complete before its timeout expired.
unable to set cookie500 Internal Server ErrorAcommand to set a cookie's value could not be satisfied.
unable to capture screen500 Internal Server ErrorA screen capture was made impossible.
unexpected alert open500 Internal Server ErrorA modal dialog was open, blocking this operation.
unknown command404 Not FoundAcommand could not be executed because the driver was unaware of it.
unknown error500 Internal Server ErrorAn unknown error occurred in the driver whilst processing thecommand.
unknown method405 Method Not AllowedThe requestedcommand matched a known URL but did not match a method for that URL.
unsupported operation500 Internal Server ErrorIndicates that acommand that should have executed properly cannot be supported for some reason.

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp