Abstract

WebDriver is a remote control interface that enables introspection and control of user agents. It provides a platform- and language-neutral wire protocol as a way for out-of-process programs to remotely instruct the behaviour of web browsers.

Provided is a set of interfaces to discover and manipulate DOM elements in web documents and to control the behaviour of a user agent. It is primarily intended to allow web authors to write tests that automate a user agent from a separate controlling process, but may also be used in such a way as to allow in-browser scripts to control a — possibly separate — browser.

The standard forms part of the Web Testing Activity that authors a larger set of tools commonly used for testing.

Status of This Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.

This document was published by the Browser Testing and Tools Working Group as a Working Draft. This document is intended to become a W3C Recommendation. If you wish to make comments regarding this document, please send them to public-browser-tools-testing@w3.org (subscribe, archives). All comments are welcome.

Publication as a Working Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.

This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

This document is governed by the 1 September 2015 W3C Process Document.

Table of Contents

1. Conformance

All diagrams, examples, and notes in this specification are non-normative, as are all sections explicitly marked non-normative. Everything else in this specification is normative.

The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this document are to be interpreted as described in [RFC2119]. The key word “OPTIONALLY” in the normative parts of this document is to be interpreted with the same normative meaning as “MAY” and “OPTIONAL”.

Conformance requirements phrased as algorithms or specific steps may be implemented in any manner, so long as the end result is equivalent.

The standard defines four broad conformance classes:

Local End

The local end represents the client side of the protocol, which is usually in the form of language-specific libraries providing an API on top of the WebDriver protocol. This specification does not place any restrictions on the details of those libraries above the level of the wire protocol.

Issue 1

Define the requirements on the local end somewhere.

Remote End
The remote end hosts the server side of the protocol. Defining the behaviour of a remote end in response to the WebDriver protocol forms the largest part of this specification.
Intermediary Node
Intermediary nodes are those that act as proxies, implementing both the client and server sides of the protocol. Intermediary nodes must be black-box indistinguishable from a remote end from the point of view of local end, and so are bound by the requirements on a remote end in terms of the wire protocol. However they are not expected to implement remote end steps directly.
Endpoint Node
An endpoint node is the final remote end in a chain of nodes that is not an intermediary node. The endpoint node is implemented by a user agent or a similar program. An endpoint node must be, like intermediary nodes, indistinguishable from a remote end.

1.1 Dependencies

This specification relies on several other underlying specifications.

DOM

The following terms are defined in the Document Object Model specification: [DOM]

The following attributes are defined in the DOM Parsing and Serialisation specification: [DOM-PARSING]

ECMAScript

The following terms are defined in the ECMAScript Language Specification: [ECMA-262]

This specification also presumes that you are able to call some of the internal methods from the ECMAScript Language Specification:
The ECMAScript Language Specification also defines the following types and values that are used throughout this specification:
Fetch

The following terms are defined in the WHATWG Fetch specification: [FETCH]

HTML

The following terms are defined in the HTML specification: [HTML]

The HTML specification also defines a number of elements which this specification has special-cased behaviour for:

The following types are also defined in the HTML specification, and referenced here:

The HTML Editing APIs specification defines the following terms: [EDITING]

The following events are also defined in the HTML specification:

The “data” URL scheme specification defines the following terms: [RFC2397]

HTTP and related specifications

The following terms are defined in the Cookie specification: [RFC6265]

The following terms are defined in the Hypertext Transfer Protocol (HTTP) Status Code Registry:

The following terms are defined in the Netscape Navigator Proxy Auto-Config File Format:

The specification uses URI Templates. [URI-TEMPLATE]

Styling
The following terms are defined in the CSS Values and Units Module Level 3 specification: [CSS3-VALUES]
The following properties are defined in the CSS Basic Box Model Level 3 specification: [CSS3-BOX]
The following terms are defined in the CSS Device Adaptation Module Level 1 specification: [CSS-DEVICE-ADAPT]
The following properties are defined in the CSS Display Module Level 3 specification: [CSS3-DISPLAY]
The following terms are defined in the Geometry Interfaces Module Level 1 specification: [GEOMETRY-1]
The following terms are defined in the CSS Cascading and Inheritance Level 4 specification: [CSS-CASCADE-4]
The following terms are defined in the CSS Object Model: [CSSOM]:
The following functions are defined in the CSSOM View Module: [CSSOM-VIEW]:
URLs
The following terms are defined in the WHATWG URL standard: [URL]
Web IDL

The IDL fragments in this specification must be interpreted as required for conforming IDL fragments, as described in the Web IDL specification. [WEBIDL]

2. Terminology

In equations, all numbers are integers, addition is represented by “+”, subtraction is represented by “−”, and bitwise OR by “|”. The characters “(” and “)” are used to provide logical grouping in these contexts.

The shorthand min(value, value[, value]) returns the smallest item of two or more values. Conversely, the shorthand max(value, value[, value]) returns the largest item of two or more values.

An ASCII string is a string in the range U+0000 to U+007F, inclusive.

A Universally Unique IDentifier (UUID) is a 128 bits long URN that requires no central registration process. [RFC4122]

3. Interface

partial interface Navigator {
    readonly    attribute boolean webdriver;
};

The webdriver IDL attribute of the Navigator interface must return the value of the webdriver-active flag, which is initially false.

This property allows websites to determine that the user agent is under control by WebDriver, and can be used to help mitigate denial-of-service attacks.

4. Protocol

WebDriver remote ends must provide an HTTP-based, RESTish wire protocol where the endpoints map to different commands.

As this standard only defines the remote end protocol, it puts no demands to how local ends should be implemented. Local ends are only expected to be compatible to the extent that they can speak the remote end’s protocol; no requierements are made upon their exposed user-facing API.

4.1 Algorithms

Various parts of this specification are written in terms of step-by-step algorithms. The details of these algorithms do not have any normative significance; implementations are free to adopt any implementation strategy that produces equivalent output to the specification. In particular algorithms in this document are optimised for readability rather than performance.

Where algorithms that return values are fallible, they are written in terms of returning either success or error. A success value has an associated data field which encapsulates the value returned, whereas an error response has an associated error code.

The result of getting a property with name from an Object is defined as the result of calling the [[GetOwnProperty]] internal method of with property name name.

4.2 Commands

The WebDriver protocol is organised into commands. Each HTTP request with a method and template defined in this specification represents a single command and therefore each command produces a single HTTP response. In response to a command, a remote end will run a series of actions against the remote browser.

Each command defined in this specification has an associated list of remote end steps. This provides the sequence of actions that a remote end takes when it receives a particular command.

4.3 Processing Model

The remote end acts as a HTTP server reading requests from the client and writing responses, typically over TCP socket. For the purposes of this specification we model the data transmission between a particular local end and remote end with a connection to which the remote end may write bytes and read bytes. However the exact details of how this connection works and how it is established are out of scope.

After such a connection has been established, a remote end MUST run the following steps:

Issue 2

Should mention what happens if it can’t be decoded as HTTP. Note that Fetch isn’t quite right because it doesn’t specify how to construct a request from network data, or serialize a response.

  1. Read bytes from the connection until a complete HTTP request can be constructed from the data. Let request be a request constructed from the received data, according to the requirements of [RFC7230].

  2. Let request match be the result of the algorithm to match a request with request’s method and URL as arguments.

  3. If request match is of type error, send an error with request match’s error code and jump to step 1.

    Otherwise, let command and url variables be request match’s data.

  4. Let session id be the corresponding variable from url variables.

  5. If command is not New Session:

    1. If session id is not equal to the ID of any session in the list of active sessions, send an error with error code invalid session id, then jump to step 1 in this overall algorithm.

      Otherwise, let the current session be the session with ID session id.

  6. If request’s method is POST:

    1. Let parse result be the result of parsing as JSON with request’s body as the argument.

    2. If parse result is an error or if it is a success but its associated data is not an Object, send an error with error code invalid argument and jump back to step 1 in this overall algorithm.

      Otherwise, let parameters be parse result’s data.

    Otherwise, let parameters be null.

  7. Let response result be the return value obtained by running the remote end steps for command with url variables as arguments.

  8. If response result is an error, send an error with error code equal to response result’s error code.

    Otherwise, if response result is a success, let response data be response result’s data.

  9. Send a response with status 200 and response data.

  10. Jump to step 1.

When required to send an error, with error code, a remote end must run the following steps:

  1. Let http status and name be the error response data for error code.

  2. Let message be an implementation-defined string containing a human-readable description of the reason for the error.

  3. Let stacktrace be an implementation-defined string containing a stack trace report of the active stack frames at the time when the error occurred.

  4. Issue 3

    Really need a better way to construct JSON literals.

    Let data be a new JSON Object initialised with the following properties:

    "error"
    Value of name.
    "message"
    Value of message.
    "stacktrace"
    Value of stacktrace.
  5. Send a response with status and data as arguments.

When required to send a response, with arguments status and data, a remote end must run the following steps:

  1. Let response be a new response.

  2. Set response’s HTTP status to status, and status message to the string corresponding to the description of status in the status code registry.

  3. If data is not null, let response’s body be the result of serializing as JSON with data as the argument.

  4. Let response bytes be the byte sequence resulting from serializing response according to the rules in [RFC7230].

  5. Write response bytes to the connection.

4.4 Routing Requests

Request routing is the process of going from a HTTP request to the series of steps needed to implement the command represented by that request.

A remote end has an associated URL prefix, which is used as a prefix on all WebDriver-defined URLs on that remote end. This must either be undefined or an path-absolute URL.

In order to match a request given a method and URL, the following steps must be taken:

  1. Let endpoints be a list containing each row in the table of endpoints.

  2. Remove each entry from endpoints for which the concatenation of the URL prefix and the entry’s URI template does not match URL’s path.

  3. If there are no entries in endpoints, return error with error code unknown command.

  4. Remove each entry in endpoints for which the method column is not an exact case-sensitive match for method.

  5. If there are no entries in endpoints, return error with error code unknown method.

  6. There is now exactly one entry in endpoints; let entry be this entry.

  7. Let parameters be the result of extracting the variables from URL using entry’s URI template.

  8. Let command be entry’s command.

  9. Return success with data command and parameters.

4.5 List of Endpoints

The following table of endpoints lists the method and URI template for each endpoint node command.

Method URI Template Command
POST /session New Session
DELETE /session/{session id} Delete Session
POST /session/{session id}/url Get
GET /session/{session id}/url Get Current URL
POST /session/{session id}/back Back
POST /session/{session id}/forward Forward
POST /session/{session id}/refresh Refresh
GET /session/{session id}/title Get Title
GET /session/{session id}/window Get Window Handle
DELETE /session/{session id}/window Close Window
POST /session/{session id}/window Switch To Window
GET /session/{session id}/window/handles Get Window Handles
POST /session/{session id}/window/fullscreen Fullscreen Window
POST /session/{session id}/window/maximize Maximize Window
POST /session/{session id}/window/size Set Window Size
GET /session/{session id}/window/size Get Window Size
POST /session/{session id}/frame Switch To Frame
POST /session/{session id}/frame/parent Switch To Parent Frame
POST /session/{session id}/element Find Element
POST /session/{session id}/element/{element id}/element Find Element From Element
POST /session/{session id}/elements Find Elements
POST /session/{session id}/element/{element id}/elements Find Elements From Element
GET /session/{session id}/element/active Get Active Element
GET /session/{session id}/element/{element id}/selected Is Element Selected
GET /session/{session id}/element/{element id}/attribute/{name} Get Element Attribute
GET /session/{session id}/element/{element id}/property/{name} Get Element Property
GET /session/{session id}/element/{element id}/css/{property name} Get Element CSS Value
GET /session/{session id}/element/{element id}/text Get Element Text
GET /session/{session id}/element/{element id}/name Get Element Tag Name
GET /session/{session id}/element/{element id}/rect Get Element Rect
GET /session/{session id}/element/{element id}/enabled Is Element Enabled
POST /session/{session id}/execute/sync Execute Script
POST /session/{session id}/execute/async Execute Async Script
GET /session/{session id}/cookie/{name} Get Cookie
POST /session/{session id}/cookie Add Cookie
DELETE /session/{session id}/cookie/{name} Delete Cookie
DELETE /session/{session id)/cookie Delete All Cookies
POST /session/{session id}/timeouts Set Timeout
POST /session/{session id}/actions Actions
POST /session/{session id}/element/{element id}/click Element Click
POST /session/{session id}/element/{element id}/clear Element Clear
POST /session/{session id}/element/{element id}/sendKeys Element Send Keys
POST /session/{session id}/alert/dismiss Dismiss Alert
POST /session/{session id}/alert/accept Accept Alert
GET /session/{session id}/alert/text Get Alert Text
POST /session/{session id}/alert/text Send Alert Text
GET /session/{session id}/screenshot Take Screenshot
GET /session/{session id}/element/{element id}/screenshot Take Element Screenshot

4.6 Handling Errors

Errors are represented in the WebDriver protocol with a HTTP response with a HTTP status in the 4xx or 5xx range, and a JSON body containing details of the error. This JSON body has three fields: error, containing a string indicating the error type; message, containing an implementation-defined string with a human readable description of the kind of error that occured; and stacktrace, containing an implementation-defined string with a stack trace report of the active stack frames at the time when the error occurred.

The following table lists each error code, its associated HTTP status, JSON error code, and a non-normative description of the error. The error response data for a particular error code is the values of the HTTP Status and JSON Error Code columns for the row corresponding to that error code.

Error Code HTTP Status JSON Error Code Description
element not selectable 400 element not selectable An attempt was made to select an element that cannot be selected.
element not visible 400 element not visible An element command could not be completed because the element is not visible on the page.
invalid argument 400 invalid argument The arguments passed to a command are either invalid or malformed.
invalid cookie domain 400 invalid cookie domain An illegal attempt was made to set a cookie under a different domain than the current page.
invalid element coordinates 400 invalid element coordinates The coordinates provided to an interactions operation are invalid.
invalid element state 400 invalid element state An element command could not be completed because the element is in an invalid state, e.g. attempting to click an element that is no longer attached to the document.
invalid selector 400 invalid selector Argument was an invalid selector.
invalid session id 404 invalid session id Occurs if the given session id is not in the list of active sessions, meaning the session either does not exist or that it’s not active.
javascript error 500 javascript error An error occurred while executing JavaScript supplied by the user.
move target out of bounds 500 move target out of bounds The target for mouse interaction is not in the browser’s viewport and cannot be brought into that viewport.
no such alert 400 no such alert An attempt was made to operate on a modal dialog when one was not open.
no such element 404 no such element An element could not be located on the page using the given search parameters.
no such frame 400 no such frame A request to switch to a frame could not be satisfied because the frame could not be found.
no such window 400 no such window A request to switch to a window could not be satisfied because the window could not be found.
script timeout 408 script timeout A script did not complete before its timeout expired.
session not created 500 session not created A new session could not be created.
stale element reference 400 stale element reference An element command failed because the referenced element is no longer attached to the DOM.
timeout 408 timeout An operation did not complete before its timeout expired.
unable to set cookie 500 unable to set cookie A request to set a cookie’s value could not be satisfied.
unable to capture screen 500 unable to capture screen A screen capture was made impossible.
unexpected alert open 500 unexpected alert open A modal dialog was open, blocking this operation.
unknown command 404 unknown command A command could not be executed because the remote end is not aware of it.
unknown error 500 unknown error An unknown error occurred in the remote end while processing the command.
unknown method 405 unknown method The requested command matched a known URL but did not match an method for that URL.
unsupported operation 500 unsupported operation Indicates that a command that should have executed properly cannot be supported for some reason.

4.7 Protocol Extensions

The protocol is designed to allow extension to meet vendor-specific needs. Commands that are specific to a user agent are called extension commands and behave no differently than other commands; each has a dedicated HTTP endpoint and a set of remote end steps.

Each extension command has an associated extension command name that is a lowercased ASCII string, and which should bear some resemblance to what the command performs. The name is used to form an extension command’s URL.

The extension command’s extension command URL is a URL composed of the extension prefix, followed by "/", and the extension command’s name. The extension command URL, along with the HTTP method and extension command, is added to the table of endpoints and thus follows the same rules for request routing as that of other built-in commands.

The remote end’s extension prefix is a lowercased ASCII string that forms a URL path element, separating extension commands from other commands to avoid potential resource conflicts with other implementations. It is suggested that vendors use their vendor prefixes without additional characters as outlined in [CSS21], notably in section 4.1.2.2 on vendor keywords, as the name for this path element.

5. Capabilities

WebDriver capabilities allow the local end to specify what features it requires the remote end to fulfill to be able to create a new session.

When processing capabilities with argument parameters a remote end must run the following steps:

  1. Let server capabilities be a JSON Object with the following entries:

    "browserName"
    The lowercase name of the user agent.
    "browserVersion"
    The version of the user agent.
    "platformName"
    The lowercase name of the platform.
    "platformVersion"
    The version of the platform.
    "acceptSslCerts"
    Be true if the User Agent can handle invalid SSL certifications else let it be false.
  2. Let required capabilities be the result of getting a property named requiredCapabilities from capabilities.

  3. If required capabilities is not a JSON Object, set the value to an empty JSON Object.
  4. Let desired capabilities be the result of getting a property named desiredCapabilities from capabilities.

  5. If desired capabilities is not a JSON Object, set the value to an empty JSON Object.
  6. Let length be the length of required capabilities.

  7. Let k be 0.

  8. While k < length:

    1. Let capability be the entry in required capabilities at index k.

    2. If the name of the capability is among the names of entries in desired capabilities, remove the corresponding entry from desired capabilities.

    3. Increase k by 1.
  9. Let unmet capabilities be an empty JSON List.

  10. Let unprocessed capabilities be a JSON Object that contains all entries from required capabilities and all entries from desired capabilities.

  11. Let j be 0.

  12. Let capabilties length be the length of unprocessed capabilities.

  13. While j < capabilities length:

    1. Let unprocessed capability be the entry at index j in unprocessed capabilities.

    2. If during the steps below the unprocessed capability equals an entry in required capabilities and name of unprocessed capability entry among the names of entries in server capabilities and the values do not match do the following:

      1. Append a string containing the property name and the differences between the values.

    3. Let browser name be the result of getting a property named browserName from unprocessed capability. If browser name is undefined move to the next step.

    4. Let browser version be the result of getting a property named browserVersion from unprocessed capability. If browser version is undefined move to the next step.

    5. Let platform name be the result of getting a property named platformName from unprocessed capability. If platform name is undefined move to the next step.

    6. Let platform version be the result of getting a property named platformVersion from unprocessed capability. If platform version is undefined move to the next step.

    7. Let proxy be the result of getting a property named proxy from unprocessed capability. If proxy is undefined move to the next step. If proxy is defined and not a map, append a string saying that a JSON Object is required, else call set the proxy passing in proxy.

    8. Let page load strategy be the result of getting a property named pageLoadStrategy from unprocessed capability. If page load strategy is undefined, then set the entry pageLoadStrategy in server capabilities to normal.

  14. If the length of unmet capabilities is not equal to 0, return session not created with data unmet capabilities.

  15. Return server capabilities.

To set the proxy from a JSON Object proxy:

  1. Let proxy type be the result of getting a property named proxyType from proxy.

  2. Switch on proxy type:

    "pac"

    If the implementation supports proxy autoconfiguration, set the implementation’s autoproxy configuration URL to proxy autoconfiguration url.

    Otherwise return an error with error code invalid argument.

    "noproxy"

    Set the proxy to No Proxy using implementation defined steps. If this can not be set during this process return error.

    "autodetect"

    Set the proxy to Auto-Detect proxy setting from the network using implementation defined steps. If this can not be set during this process return error.

    "system"

    Set the proxy to use system proxy settings using implementation defined steps. If this can not be set during this process return error.

    "manual"
    1. Let ftp proxy be the result of getting a property named ftpProxy from proxy.

    2. Let ftp proxy port be the result of getting a property named ftpProxyPort from proxy.

    3. Let http proxy be the result of getting a property named httpProxy from proxy.

    4. Let http proxy port be the result of getting a property named httpProxyPort from proxy.

    5. Let ssl proxy be the result of getting a property named sslProxy from proxy.

    6. Let ssl proxy port be the result of getting a property named sslProxyPort from proxy.

    7. Let socks proxy be the result of getting a property named socksProxy from proxy.

    8. Let socks proxy port be the result of getting a property named socksProxyPort from proxy.

    9. If socks proxy and socks proxy port is defined:

      1. Let socks version be the result of getting a property named socksVersion from proxy.

      2. Let socks username be the result of getting a property named socksUsername from proxy.

      3. Let socks password be the result of getting a property named socksPassword from proxy.

    10. Follow implementation defined steps to set the proxy using defined variables from previous steps. If there are items that can not be set during this process return error.

    Otherwise

    Return error with error code invalid argument.

6. Sessions

A session is equivalent to a single instantiation of a particular user agent, including all its child browsers. WebDriver gives each session a unique session ID that can be used to differentiate one session from another, allowing multiple user agents to be controlled from a single HTTP server, and allowing sessions to be routed via a multiplexer (known as an intermediary node).

A session is started when a New Session is invoked. It is an error to send any commands before starting a session, or to continue to send commands after the session has been closed. Maintaining session continuity between requests to the remote end requires passing a session ID.

A WebDriver session represents the connection between a local end and a specific remote end. A remote end that is not an intermediary node has at most one active session at a given time.

The session is set up at the invocation of a New Session, and torn down at some later point; either explicitly by invoking Delete Session, or implicitly when Close Window is called at the last remaining top-level browsing context.

A remote end has an associated list of active sessions, which is a list of all sessions that are currently started.

Requests, except New Session requests, have an associated current session, which is the session in which that request's command will run.

A remote end has an associated maximum active sessions (an integer) that defines the number of active sessions that are supported. This may be “unlimited” for intermediary nodes, but must be exactly one for a remote end that is an endpoint node.

A session has an associated session ID (a UUID) used to uniquely identify this session. Unless stated otherwise it is null.

A session has an associated current browsing context, which is the browsing context against which commands will run.

A session has an associated current top-level browsing context, which is the current browsing context if it itself is a top-level browsing context, or the top-level browsing context for which the current browsing context is an ancestor browsing context.

The top-level browsing context is said to be no longer open if it has been discarded.

Each top-level browsing context has an associated window handle, which is a string uniquely identifying that browsing context. This string is implementation defined but MUST not be "current".

A session has an associated session script timeout that specifies a time to wait for scripts to run. Unless stated otherwise it is 30,000 milliseconds.

A session has an associated session page load timeout that specifies a time to wait for the page loading to complete. Unless stated otherwise it is 300,000 milliseconds.

A session has an associated session implicit wait timeout that specifies a time to wait for the implicit element location strategy when locating elements using Find Element and Find Elements. Unless stated otherwise it is zero milliseconds.

A session has an associated page loading strategy, which is one of none, normal, and eager. Unless stated otherwise, it is normal.

A session has an associated user prompt handler.

When asked to close the session, a remote end must take the following steps:

  1. Set the webdriver-active flag to false.

  2. Close any top-level browsing contexts associated with the session, without prompting to unload.

  3. Remove the current session from active sessions.

  4. Perform any implementation-specific cleanup steps.

Closing a session might cause the associated browser process to be killed. It is assumed that any implementation-specific cleanup steps are performed after the response has been sent back to the client so that the connection is not prematurely closed.

6.1 New Session

HTTP Method Path Template
POST /session

The New Session command creates a new WebDriver session with the endpoint node. If the maximum active sessions has been reached, that is if the endpoint node already has a current session, there is a problem processing the given capabilities, or the provisioning of a remote end is impossible, a session not created error is returned.

If the remote end is an intermediary node, they are allowed to freely use the capabilities data e.g. to select a specific browser to test based on a combination of the required and desired capabilities. Typically the New Session response from the endpoint node selected in this process will then be relayed directly to the local end, as outlined in step 1 of the remote end steps.

The remote end steps are:

  1. If the remote end is an intermediary node, take implementation-defined steps that either result in returning an error with error code session not created, or in returning a success with data that is isomorphic to that returned by remote ends according to the rest of this algorithm.

  2. If the maximum active sessions is equal to the length of the list of active sessions, return error with error code session not created.

  3. If there is a current user prompt, return error with error code session not created.

  4. Let capabilities be the result of getting a property named "capabilities" from the parameters argument.

  5. Let capabilities result be the result of processing capabilities with capabilities as an argument.

  6. If capabilities result is an error, return error with error code session not created.

  7. Let capabilities be capabilities result’s data.

  8. Let session id be the result of generating a UUID.

  9. Let session be a new session with the session ID of session id.

  10. Set the current session to session.

  11. Append session to active sessions.

  12. Let body be a JSON Object initialised with:

    "sessionId"
    The value of session id.
    "capabilities"
    The value of capabilities result.
  13. Initialise the following if not set while processing capabilities:

    1. Set the current session’s session script timeout to 30,000 milliseconds.

    2. Set the current session’s session page load timeout to 300,000 milliseconds.

    3. Set the current session’s session implicit wait timeout to 0 (zero) milliseconds.

    4. Set the current session’s page loading strategy to normal.

    5. Set the webdriver-active flag to true.

  14. Return success with data body.

6.2 Delete Session

HTTP Method Path Template
DELETE /session/{session id}

The Delete Session command closes any top-level browsing contexts associated with the current session, terminates the connection, and finally closes the current session.

The remote end steps are:

  1. Close the session.

  2. Return success with data null.

6.3 Set Timeout

HTTP Method Path Template
POST /session/{session id}/timeouts

The Set Timeout command sets timeouts associated with the current session. The timeouts that can be controlled are the session script timeout, the session page load timeout, and the session implicit wait timeout.

The following table of session timeouts lists pairs of different timeouts that may be changed with the string codes used to identify them:

Type Identifier
session script timeout "script"
session page load timeout "page load"
session implicit wait timeout "implicit"

The remote end steps for the Set Timeout command are:

  1. For each row in the table of session timeouts, enumerated as type and identifier:

    1. If parameters does not have an own property identifier, continue to the next entry.

    2. Let timeout be the result of getting a property using identifier from parameters.

    3. If timeout is of the Number type and a non-negative integer, set the type timeout to timeout’s value in milliseconds.

      Otherwise, return error with error code invalid argument.

  2. Return success.

8. Invalid SSL Certificates

Issue 8

Warning: This section has not yet been redefined to match the routing requests model, and uses old concepts and definitions. Please do not rely on it yet.

Capability Name Type
secureSsl boolean

WebDriver implementations MUST support users accessing sites served via HTTPS. Access to those sites using self-signed or invalid certificates, and where the certificate does not match the serving domain MUST be the same as if the HTTPS was configured properly.

Note

The reason for this is that implementations of this spec are often used for testing. It's a sorry fact that many QA engineers and testers are asked to verify that apps work on sites that have insecure HTTPS configurations.

The exception to requirement is if the Capabilities used to initialize has the WebDriver session had the capability secureSsl set to true. In this case, implementations MAY choose to make accessing a site with bad HTTPS configurations cause a WebDriverException to be thrown. Remote end implementations MUST return an unknown error error code in this case. If this is the case, the Capabilities describing the session MUST also set the secureSsl capability to "true".

9. Command Contexts

Many WebDriver commands happen in the context of either the current browsing context or current top-level browsing context. The current top-level browsing context is represented in the protocol by its associated window handle. A top-level browsing context is selected using the Switch To Window command. Once this is done, a specific browsing context can be selected using the Switch to Frame command.

Note

The use of the term “window” to refer to a top-level browsing context is legacy and doesn’t correspond with either the operating system notaion of a “window” or the DOM Window object.

Note

In accordance with the focus section of the [HTML] specification, commands are unaffected by whether the operating system window has focus or not.

9.1 Get Window Handle

HTTP Method Path Template
GET /session/{session id}/window

The Get Window Handle command returns the window handle for the current top-level browsing context. It can be used as an argument to Switch To Window.

The remote end steps are:

  1. If the current top-level browsing context is no longer open, return error with error code no such window.

  2. Let data be a new JSON Object.

  3. Set the property "value" on data to the value of the window handle associated with the current top-level browsing context.

  4. Return success with data data.

9.2 Close Window

HTTP Method Path Template
DELETE /session/{session id}/window

The remote end steps for the Close Window command are:

  1. If the current top-level browsing context is no longer open, return error with error code no such window.

  2. Issue 9

    This can prompt unload, in which case the operation really failed.

    Close the current top-level browsing context.

  3. If there are no more open top-level browsing contexts, then close the session.

  4. Return the result of running the remote end steps for the Get Window Handles command.

9.3 Switch To Window

HTTP Method Path Template
POST /session/{session id}/window

The Switch To Window command is used to select the current top-level browsing context for the current session, i.e. the one that will be used for processing commands.

The remote end steps are:

  1. If there is an active user prompt, that due to the uniqueness of the user agent prevents the focussing of another top-level browsing context, return error with error code unsupported operation.

  2. Let handle be the result of getting a property named "handle" from the parameters argument.

  3. If handle is equal to the associated window handle for some top-level browsing context in the current session, set the session’s current top-level browsing context to that browsing context, and return success with data null.

    Otherwise, return error with error code no such window.

9.4 Get Window Handles

HTTP Method Path Template
GET /session/{session id}/window/handles

The Get Window Handles command returns a list of window handles for every open top-level browsing context. The order in which the window handles are returned is arbitary.

The remote end steps are:

  1. Let handles be a JSON List.

  2. For each top-level browsing context in the remote end, push the associated window handle onto handles.

  3. Let body be a JSON object with the property "value" set to handles.

  4. Return success with data body.

9.5 Switch To Frame

HTTP Method Path Template
POST /session/{session id}/frame

The Switch To Frame command is used to select the current top-level browsing context or a child browsing context of the current browsing context to use as the current browsing context for subsequent commands.

The remote end steps are:

  1. If the current browsing context is no longer open, return error with error code no such window.

  2. Handle any user prompts and return its value if it is an error.

  3. Let id be the result of getting a property named "id" from the parameters argument.

  4. Run the substeps of the first matching condition:

    id is null
    1. Set the current browsing context to the current top-level browsing context.

    id is a Number object
    1. If id is less than 0 or greater than 216 – 1, return error with error code no such frame.

    2. Let window be the associated window of the current browsing context’s active document.

    3. If id is not a supported property index of window, return error with error code no such frame.

    4. Let child window be the WindowProxy object obtained by determining the value of an indexed property of window with index id.

    5. Set the current browsing context to new window’s browsing context.

    id represents a web element
    1. Issue 10

      Note that representing a web element will have to do the same document checks, or something.

      Let element be the result of getting a known element by UUID id.

    2. If element is not a frame or iframe element, return error with error code no such frame.

    3. Set the current browsing context to element’s nested browsing context.

    Otherwise
    1. Return error with error code no such frame.

  5. Return success with data null.

Note

WebDriver is not bound by the same origin policy, so it is always possible to switch into child browsing contexts, even if they are different origin to the current browsing context.

9.6 Switch To Parent Frame

HTTP Method Path Template
POST /session/{session id}/frame/parent

The Switch to Parent Frame command sets the current browsing context for future commands to the parent of the current browsing context.

The remote end steps are:

  1. If the current browsing context is no longer open, return error with error code no such window.

  2. Handle any user prompts and return its value if it is an error.

  3. If the current browsing context is not equal to the current top-level browsing context, set the current browsing context to the parent browsing context of the current browsing context.

  4. Return success with data null.

9.7 Resizing and Positioning Windows

WebDriver provides commands for interacting with the operating system window containing the current browsing context. Because different operating system's window managers provide different abilities, not all of the commands in this section can be supported by all remote ends. Where a command is not supported, an unsupported operation error is returned.

9.7.1 Get Window Size

HTTP Method Path Template
GET /session/{sessionId}/window/size

The Get Window Size command returns the size of the operating system window corresponding to the current top-level browsing context.

The remote end steps are:

  1. If the current top-level browsing context is no longer open, return error with error code no such window.

  2. Handle any user prompts and return its value if it is an error.

  3. Let width be the width in CSS reference pixels of the operating system window containing the current top-level browsing context, including any browser chrome and externally drawn window decorations.

  4. Let height be the height in CSS reference pixels of the operating system window containing the current top-level browsing context, including any browser chrome and any externally drawn window decorations.

  5. Let body be a new JSON Object initialised with:

    "width"
    The value of width.
    "height"
    The value of height.
  6. Return success with data body.

Note

In some user agents the dimensions of the browser including window decorations are provided by the proprietary window.outerWidth and window.outerHeight properties.

9.7.2 Set Window Size

HTTP Method Path Template
POST /session/{session id}/window/size

The Set Window Size command alters the size of the operating system window corresponding to the current top-level browsing context.

The remote end steps are:

  1. If the current top-level browsing context is no longer open, return error with error code no such window.

  2. Handle any user prompts and return its value if it is an error.

  3. If the remote end does not support the Set Window Size command for the current top-level browsing context for any reason, return error with error code unsupported operation.

  4. Let width be the result of getting a property named width from the parameters argument.

  5. Let height be the result of getting a property named height from the parameters argument.

  6. Set the width, in CSS reference pixels, of the operating system window containing the current top-level browsing context, including any browser chrome and externally drawn window decorations to a value that is as close as possible to width.

  7. Set the height, in CSS reference pixels, of the operating system window containing the current top-level browsing context, including any browser chrome and externally drawn window decorations to a value that is as close as possible to height.

  8. Return success with data null.

Note

The specification does not guarantee that the resulting window size will exactly match that which was requested. In particular the implementation is expected to clamp values that are larger than the physical screen dimensions, or smaller than the minimum window size. Particular implemetations may have other limitations such as not being able to resize in single-pixel increments.

9.7.3 Maximize Window

HTTP Method Path Template
POST /session/{session id}/window/maximize

The Maximize Window command invokes the window manager-specific “maximize” operation, if any, on the window containing the current top-level browsing context. This typically increases the window to the maximum available size without going full-screen.

The remote end steps are:

  1. If the current top-level browsing context is no longer open, return error with error code no such window.

  2. Handle any user prompts and return its value if it is an error.

  3. If the remote end does not support the Maximize Window command for the current top-level browsing context for any reason, return error with error code unsupported operation.

  4. Run the implementation-specific steps to increase the dimensions of the operating system level window containing the current top-level browsing context to the maximum available size allowed by the window manager.

  5. Return success with data null.

9.7.4 Fullscreen Window

HTTP Method Path Template
POST /session/{session id}/window/fullscreen

The Fullscreen Window command invokes the window manager-specific “full screen” operation, if any, on the window containing the current top-level browsing context. This typically increases the window to the size of the physical display and can hide browser UI elements such as toolbars.

The remote end steps are:

  1. If the current top-level browsing context is no longer open, return error with error code no such window.

  2. Handle any user prompts and return its value if it is an error.

  3. If the remote end does not support the Fullscreen Window command for the current top-level browsing context for any reason, return error with error code unsupported operation.

  4. Run the implementation-specific steps, which should have the effect of making the dimensions of the window containing the current top-level browsing context as close as possible to the dimensions of the display containing the window, and may hide browser-provided UI such as toolbars.

  5. Return success with data null.

10. Elements

A web element is an abstraction used to identify an element when it is transported across the protocol, between remote- and local ends.

The web element identifier is a constant with the string "element-6066-11e4-a52e-4f735466cecf".

Each element has an associated web element reference (a UUID) that uniquely identifies the the element across all browsing contexts. The web element reference for every element representing the same element is the same.

An ECMAScript Object represents a web element if it has a web element identifier own property holding a UUID value.

Each browsing context has an associated list of known elements. When the browsing context is discarded, the list of known elements is discarded along with it.

To get a known element by a UUID reference, return success with the known element which web element reference matches reference. If there are none, return error with error code no such element.

To create a web element reference for an element:

  1. For each known element of the current browsing context’s known elements:

    1. If known element equals element, return success with known element’s web element reference.

  2. Let new reference be the result of generating a new UUID.

  3. Set element’s web element reference to new reference.

  4. Append element to the known elements of the current browsing context.

  5. Return success with data element’s web element reference.

When asked to serialize the element element:

  1. Let object be a new JSON Object with properties:

    web element identifier

    Value of element’s web element reference.

  2. Return object.

When required to deserialize the web element by a JSON Object object that represents a web element:

  1. If object has no own property web element identifier, return error with error code invalid argument.

  2. Let reference be the result of getting the web element identifier property from object.

  3. Let element result be the result of getting a known element by UUID reference.

  4. If element result is a success, let element be element result’s data.

    Otherwise, return element result.

  5. Return success with data element.

A stale element is a reference to a node that has been disconnected from the current browsing context’s DOM. To determine if an element is stale, run the following substeps:

  1. Let document be the current browsing context’s document element.

  2. If element is not in the same tree as document, return true.

  3. Otherwise return false.

An element is scrolled into view by calling scrollIntoView().

An element is considered editable if it is either an input element whose type attribute is not in the Button, Hidden, Image Button, Reset Button, or Submit Button states, or a textarea element, or is content editable.

An element is said to have pointer events disabled if the resolved value of its "pointer-events" style property is "none".

An element is to be considered read only if it is an input element whose readOnly attribute is set.

10.1 Element Interactability

In order to determine if an element can be interacted with using pointer actions, WebDriver performs hit-testing to find if the interaction will be able to reach the requested element.

An interactable element is an element which is either pointer-interactable or keyboard-interactable.

A pointer-interactable element is defined to be the first non-transparent element, defined by the paint order found at the centre point of its rectangle that is inside the viewport, excluding the size of any rendered scrollbars.

In order to produce a pointer-interactable elements tree from an element:

  1. If element is not in the same tree as the current browsing context’s active document, return an empty sequence.

  2. Let visible width be element’s bounding rectangle’s (max(x coordinate, x coordinate + width dimension) – the current browsing context’s innerWidth).

  3. Let visible height be element’s bounding rectangle’s (max(y coordinate, y coordinate + height dimension) – the current browsing context’s innerWidth).

  4. Let vertical centre offset be (visible width / 2.0).

  5. Let horizontal centre offset be (visible height / 2.0).

  6. Let centre point be a pair of element’s (rectangle x coordinate + horizontal centre offset) and (rectangle y coordinate + vertical centre offset).

  7. Return the elements from point given the coordinates centre point.

To get the first pointer-interactable element given a pointer-interactable elements tree, return with success the first element which style property opacity has the computed value of "1"; otherwise return an error.

10.2 Get Active Element

HTTP Method Path Template
GET /session/{session id}/element/active

Get Active Element returns the active element of the current browsing context’s document element.

The remote end steps are:

  1. If the current top-level browsing context is no longer open, return error with error code no such window.

  2. Handle any user prompts and return its value if it is an error.

  3. Let active element be the active element of the current browsing context’s document element.

  4. Let active web element be the serialization of the element active element.

  5. Return success with data active web element.

11. Element Retrieval

The Find Element and Find Elements commands allows look up of individual and a collection of elements, respectively. Elements are serialised and returned as web elements. Web element references are needed to interact with individual elements.

An element location strategy is an enumerated attribute which decides what technique should be used to search for elements in the current browsing context. The following table lists the keywords and states defined for this attribute:

State Keyword
CSS selector "css selector"
Link text selector "link text"
Partial link text selector "partial link text"
XPath selector "xpath"
Issue 11

Warning: This rest of this section has not yet been redefined to match the routing requests model, and uses old concepts and definitions. Please do not rely on it yet.

11.1 CSS Selectors

Strategy name: css selector

If a browser supports the CSS Selectors API ([SELECTORS-API]) it MUST support locating elements by CSS Selector. If the browser does not support the browser CSS Selector spec it MAY choose to implement locating by this mechanism. If the browser can support locating elements by CSS Selector, it MUST set the "cssSelector" capability to boolean true when responding to the newSession(). Elements MUST be returned in the same order as if "querySelectorAll" had been called with the Locator's value. Compound selectors are allowed.

11.2 ECMAScript

Finding elements by ecmascript is covered in the ecmascript part of this spec.

11.5 XPath

Strategy name: xpath

All WebDriver implementations MUST support finding elements by XPath 1.0 [XPATH] with the edits from section 3.3 of the [html51] specification made. If no native support is present in the browser, a pure JS implementation MAY be used. When called, the returned values MUST be equivalent of calling "evaluate" function from [DOM-LEVEL-3-XPATH] with the result type set to ORDERED_NODE_SNAPSHOT_TYPE (7).

When the findElement() or findElements() WebDriver Command is called the following must be parameters after the local end has made a request to the remote end:

  1. Let using contain the Element Location Strategy. If it is not a valid stategy:
    • Set the HTTP Response status code to 500
    • Let status be equal to Invalid Selector
    • Let value be a statement that the strategy is invalid. It MAY return a list of valid search strategies.
  2. Let value contain a string that will be passed to the Element Location Strategy call. If value is an empty string or null:
    • Set the HTTP Response status code to 500
    • Let status be equal to Invalid Selector
    • Let value to a stating that the strategy is invalid. It MAY return a list of valid search strategies.
  3. Call the relevant Element Location Strategy and return what is described in findElement() or findElements() WebDriver Command described below.

11.6 Find Element

Issue 12

Warning: This section has not yet been redefined to match the routing requests model, and uses old concepts and definitions. Please do not rely on it yet.

HTTP Method Path Template
POST /session/{session id}/element
  1. Let id be an identifier for a DOMElement returned from Element Location Strategy. If a NodeList is returned, the first element in the NodeList MUST be used.

    If id is empty:

    • Let the HTTP response status code be 501
    • Let status contain the error no such element
    • Let value contain the details of the search contained in using and value above.

    If an error is returned from Element Location Strategy do the following.(todo describe how the error is returned)

    • Let the HTTP response status code be 501
    • Let status contain the error invalid selector
    • Let value contain the details of the search contained in using and value above.
  2. Let result be equal to {"element-6066-11e4-a52e-4f735466cecf": id}
  3. Return result. The object returned will look like the following:
    {
    "value": {"element-6066-11e4-a52e-4f735466cecf": id}
    }

When searching from an element from another element the following algorithm should be used:

HTTP Method Path Template
POST /session/{session id}/element/{element id}/element
  1. Let element be the start node for the query in the Element Location Strategy
  2. Let id be a unique identifier for the DOMElement returned from Element Location Strategy. If a NodeList is returned, the first DOMElement in the NodeList MUST be used.

    If id is empty:

    • Let the HTTP response status code be 501
    • Let status contain the error no such element
    • Let value contain the details of the search contained in using and value above.

    If an error is returned from Element Location Strategy do the following.(todo describe how the error is returned)

    • Let the HTTP response status code be 501
    • Let status contain the error invalid selector
    • Let value contain the details of the search contained in using and value above.
  3. Let result be equal to {"element-6066-11e4-a52e-4f735466cecf": id}
  4. Return result. The object returned will look like the following:
    {
    "value": {"element-6066-11e4-a52e-4f735466cecf": id}
    }

11.7 Find Elements

Issue 13

Warning: This section has not yet been redefined to match the routing requests model, and uses old concepts and definitions. Please do not rely on it yet.

When there is a need to find multiple elements on a document that we can return to the local end we use the following algorithm:

HTTP Method Path Template
POST /session/{session id}/elements
  1. Let result be equal to an empty list
  2. Let queryResult be a NodeList returned from Element Location Strategy
  3. Repeat for every value in queryResult if not an empty set else return result
    1. Let id be the unique identifier for the DOMElement.
    2. Append {"element-6066-11e4-a52e-4f735466cecf": id} to result
  4. Return result. The object returned will look like the following:
    {
    "value": [{"element-6066-11e4-a52e-4f735466cecf": id}, {"element-6066-11e4-a52e-4f735466cecf": id}]
    }

When there is a need to search from an element to find the next WebElement we use the following algorithm:

HTTP Method Path Template
POST /session/{session id}/element/{element id}/elements
  1. Let result be equal to an empty list.
  2. Let element be the start node for the query in the Element Location Strategy
  3. Let queryResult be a NodeList returned from Element Location Strategy
  4. Repeat for every value in queryResult if not an empty set else return result
    1. Let id be the unique identifier for the DOMElement.
    2. Append {"element-6066-11e4-a52e-4f735466cecf": id} to result
  5. Return result. The object returned will look like the following:
    {
    "value": [{"element-6066-11e4-a52e-4f735466cecf": id}, {"element-6066-11e4-a52e-4f735466cecf": id}]
    }

12. Element State

To calculate the absolute position of element:

  1. Let x and y both be 0.

  2. While element’s offsetParent is not null:

    1. Set x to (x + element’s offsetLeft).

    2. Set y to (y + element’s offsetTop).

    3. Set element to element’s offsetParent.

  3. Return a pair of (x, y).

When a node is said to be not in the same tree as another node, other, the following steps must be taken:

  1. If the node’s ownerDocument attribute is not other, return true.

  2. If the result of calling the node’s compareDocumentPosition with other as argument is DOCUMENT_POSITION_DISCONNECTED (1), return true.

  3. Return false.

12.1 Is Element Selected

HTTP Method Path Template
GET /session/{session id}/element/{element id}/selected

Is Element Selected determines if the referenced element is selected or not. This operation only makes sense on input elements of the Checkbox- and Radio Button states, or option elements.

The remote end steps are:

  1. If the current top-level browsing context is no longer open, return error with error code no such window.

  2. Handle any user prompts and return its value if it is an error.

  3. Let element result be the result of getting a known element by UUID reference element id.

  4. If element result is a success, let element be element result’s data.

    Otherwise, return element result.

  5. If element is stale, return error with error code stale element reference.

  6. Let selected be the value corresponding to the first matching statement:

    element is an input with a type attribute in the Checkbox- or Radio Button state

    The result of element’s checkedness.

    element is an option element

    The result of element’s selectedness.

    Otherwise
    False.
  7. Let body be a JSON Object with the "value" member set to selected.

  8. Return success with data body.

12.2 Get Element Attribute

HTTP Method Path Template
GET /session/{session id}/element/{element id}/attribute/{name}

The Get Element Attribute command will return the attribute of a web element.

The remote end steps are:

  1. If the current top-level browsing context is no longer open, return error with error code no such window.

  2. Handle any user prompts and return its value if it is an error.

  3. Let element result be the result of getting a known element by UUID reference element id.

  4. If element result is a success, let element be element result’s data.

    Otherwise, return element result.

  5. If element is stale, return error with error code stale element reference.

  6. If name is undefined, return error with error code invalid argument.

  7. Let result be the result of the first appropriate step below:
    If name is a boolean attribute

    "true" (string) if the element has the attribute, otherwise null.

    Otherwise

    The result of getting an attribute by name name.

  8. Let body be a JSON Object with the "value" member set to result.

  9. Return success with data body.

12.3 Get Element Property

HTTP Method Path Template
GET /session/{session id}/element/{element id}/property/{name}

The Get Element property command will return the result of getting a property of a element.

The remote end steps are:

  1. If the current top-level browsing context is no longer open, return error with error code no such window.

  2. Handle any user prompts and return its value if it is an error.

  3. Let element result be the result of getting a known element by UUID reference element id.

  4. If element result is a success, let element be element result’s data.

    Otherwise, return element result.

  5. If element is stale, return error with error code stale element reference.

  6. Let property be the result of calling the [[GetProperty]] internal method of element with property name name.

  7. Let result be the value of property if not undefined, or null.

  8. Let body be a JSON Object with the "value" property set to result.

  9. Return success with data body.

12.4 Get Element CSS Value

HTTP Method Path Template
GET /session/{session id}/element/{element id}/css/{property name}

The Get Element CSS Value command retrieves the computed value of the given CSS property of the given web element.

The remote end steps are:

  1. If the current top-level browsing context is no longer open, return error with error code no such window.

  2. Handle any user prompts and return its value if it is an error.

  3. Let element result be the result of getting a known element by UUID parameter element id.

  4. If element result is a success, let element be element result’s data.

    Otherwise, return element result.

  5. If element is stale, return error with error code stale element reference.

  6. Let computed value be the computed value of parameter property name from element’s style declarations if the current browsing context’s document type is not "xml", else let it be "".

  7. Let body be a JSON Object with the "value" member set to computed value.

  8. Return success with data body.

12.5 getElementText()

Issue 14

Warning: This section has not yet been redefined to match the routing requests model, and uses old concepts and definitions. Please do not rely on it yet.

Issue 15

There is concern that element text visibility is not something WebDriver should define because there does not exist enough platform primitives to future-proof it. Specifically this relates to technologies such as web components and shadow DOM. Note that a decision on this matter will also affect the future of the elements selector strategies for link text and partial link text.

HTTP Method Path Template
GET /session/{session id}/element/{element id}/text

The following definitions are used in this section:

Whitespace
Any text that matches the ECMAScript regular expression class \s.
Whitespace excluding non-breaking spaces
Any text that matches the ECMAScript regular expression [^\S\xa0]
Block level element
A block-level element is one which is not a table cell, and whose effective CSS display style is not in the set ['inline', 'inline-block', 'inline-table', 'none', 'table-cell', 'table-column', 'table-column-group']
Horizontal whitespace characters
Horizontal whitespace characters are defined by the ECMAScript regular expression [\x20\t\u2028\u2029].

The expected return value is roughly what a text-only browser would display. The algorithm for determining this text is as follows:

Let lines equal an empty array. Then:

  1. if the element is in the head element of the document, return an empty string otherwise carry on with the algorithm below.
  2. For each descendent of node, at time of execution, in order:
    1. Get whitespace, text-transform, and then, if descendent is:
      • a node which is not displayed, do nothing
      • a [DOM] text node let text equal the nodeValue property of descendent. Then:
        1. Remove any zero-width spaces (\u200b, \u200e, \u200f), form feeds (\f) or vertical tab feeds (\v) from text.
        2. Canonicalize any recognized single newline sequence in text to a single newline (greedily matching (\r\n|\r|\n) to a single \n)
        3. If the parent's effective CSS whitespace style is 'normal' or 'nowrap' replace each newline (\n) in text with a single space character (\x20). If the parent's effective CSS whitespace style is 'pre' or 'pre-wrap' replace each horizontal whitespace character with a non-breaking space character (\xa0). Otherwise replace each sequence of horizontal whitespace characters except non-breaking spaces (\xa0) with a single space character
        4. Apply the parent's effective CSS text-transform style as per the CSS 2.1 specification ([CSS21])
        5. If last(lines) ends with a space character and text starts with a space character, trim the first character of text.
        6. Append text to last(lines) in-place
      • an element which is displayed. If the element is a:
        • BR element: Push '' to lines and continue
        • Block-level element and if last(lines) is not '', push '' to lines.
        And then recurse depth-first to step 1 at the beginning of the algorithm with descendent set to the current element
      • If element is a TD element, or the effective CSS display style is 'table-cell', and last(lines) is not '', and last(lines) does not end with whitespace append a single space character to last(lines) [Note: Most innerText implementations append a \t here]
      • If element is a block-level element: push '' to lines
  3. The string MUST then have the white space normalised as defined in the [XPATH] normalize-space function which is then returned.

If the ELEMENT does not represent a Document element, or it represents a Document element that is no longer attached to the document's node tree, then the WebDriver implementation MUST immediately abort the command and return a stale element reference error. If the top level browsing context currently receiving commands is no longer open a no such window error MUST be raised.

12.6 Get Element Tag Name

HTTP Method Path Template
GET /session/{session id}/element/{element id}/name

The Get Element Tag Name command returns the qualified tag name name of the given web element.

The remote end steps are:

  1. If the current top-level browsing context is no longer open, return error with error code no such window.

  2. Handle any user prompts and return its value if it is an error.

  3. Let element result be the result of getting a known element by UUID reference parameter element id.

  4. If element result is an error, return element result.

  5. Let element be element result’s data.

  6. If element is stale, return error with error code stale element reference.

  7. Let qualified name be the result of getting element’s tagName content attribute.

  8. Let body be a JSON Object with the "value" member set to qualified name.

  9. Return success with data body.

12.7 Get Element Rect

HTTP Method Path Template
GET /session/{session id}/element/{element id}/rect

The Get Element Rect command returns the dimensions and coordinates of the given web element. The returned value is a dictionary with the following members:

x
X axis position of the top-left corner of the web element relative to the current browsing context’s document element in CSS reference pixels.
y
Y axis position of the top-left corner of the web element relative to the current browsing context’s document element in CSS reference pixels.
height
Height of the web element’s bounding rectangle in CSS reference pixels.
width
Width of the web element’s bounding rectangle in CSS reference pixels.

The remote end steps are:

  1. If the current top-level browsing context is no longer open, return error with error code no such window.

  2. Handle any user prompts and return its value if it is an error.

  3. Let element result be the result of getting a known element by UUID reference parameter element id.

  4. If element result is an error, return element result.

  5. Let element be element result’s data.

  6. If the element is stale, return error with error code stale element reference.

  7. Calculate the absolute position of element and let it be coordinates.

  8. Let rect be element’s bounding rectangle.

  9. Let body be a new JSON Object initialised with:

    "x"
    The first value of coordinates.
    "y"
    The second value of coordinates.
    "width"
    Value of rect’s width dimension.
    "height"
    Value of rect’s height dimension.
  10. Return success with data body.

12.8 Is Element Enabled

HTTP Method Path Template
GET /session/{session id}/element/{element id}/enabled

Is Element Enabled determines if the referenced element is enabled or not. This operation only makes sense on form controls.

The remote end steps are:

  1. If the current top-level browsing context is no longer open, return error with error code no such window.

  2. Handle any user prompts and return its value if it is an error.

  3. Let element result be the result of getting a known element by UUID reference element id.

  4. If element result is a success, let element be element result’s data.

    Otherwise, return element result.

  5. If element is stale, return error with error code stale element reference.

  6. Let enabled be a boolean initially set to true if the current browsing context’s document type is not "xml".

    Otherwise, let enabled to false and jump to the last step of this algorithm.

  7. Set enabled to false if a form control is disabled.

  8. Let body be a JSON object with the "value" member set to enabled.

  9. Return success with data body.

13. Element Interaction

The element interaction commands provide a high-level instruction set for manipulating form controls. Unlike the Actions interface, they will implicitly scroll elements into view and check that it is an interactable element.

13.1 Element Click

HTTP Method Path Template
POST /session/{session id}/element/{element id}/click

The Element Click command scrolls into view the element and then attempts to click the centre of its visible area. In case the element is not displayed, an element not visible error is returned.

The remote end steps are:

  1. If the current top-level browsing context is no longer open, return error with error code no such window.

  2. Let element result be the result of getting a known element by UUID reference element id.

  3. Let element be element result’s data if it is a success. Otherwise return element result.

  4. If element is not displayed, return error with error code element not visible.

  5. Scroll into view the element.

  6. Issue 16

    Get the element’s bounding box and calculate centre position.

  7. Issue 17

    Run interaction steps on coordinate.

  8. Return success with data null.

13.2 Element Clear

HTTP Method Path Template
POST /session/{session id}/element/{element id}/clear

The Element Clear command scrolls into view a submittable element excluding buttons or editable element, and then attempts to clear its value, checkedness, or text content.

The remote end steps are:

  1. If the current top-level browsing context is no longer open, return error with error code no such window.

  2. Let element result be the result of getting a known element by UUID reference element id.

  3. Let element be element result’s data if it is a success. Otherwise return element result.

  4. If element is not displayed, return error with error code element not visible.

  5. If element is disabled, non-editable, read only, or has pointer events disabled, return error with error code invalid element state.

  6. Scroll into view the element.

  7. If element is editable, set its innerHTML IDL attribute to an empty string.

    Otherwise:

    1. Match on element’s type attribute:
      Checkbox state
      Radio Button state

      Set the checkedness to false.

      Otherwise

      Set the value to an empty string.

    2. Fire a change event.

  8. Return success with data null.

13.3 Element Send Keys

HTTP Method Path Template
POST /session/{session id}/element/{element id}/sendKeys

The Element Send Keys command scrolls into view the form control element and then sends the provided keys to the element. In case the element is not displayed, an element not visible error is returned.

Issue 18

Should this also work for contenteditable elements?

The remote end steps are:

  1. If the current top-level browsing context is no longer open, return error with error code no such window.

  2. Let element result be the result of getting a known element by UUID reference element id.

  3. Let element be element result’s data if it is a success. Otherwise return element result.

  4. If element is not displayed, return error with error code element not visible.

  5. Scroll into view the element.

  6. Issue 19

    Interact with the element.

  7. Return success with data null.

14. Executing Script

Issue 20

When required to JSON deserialize with argument value, and optional argument seen, a remote end must run the following steps:

  1. If seen was not provided, let seen be an empty set.

  2. Jump to the first appropriate step below:

    If value is null, or has type Boolean, Number or String:

    Return success with data value.

    If value is an Object that represents a web element:

    Return the result of running the deserialize the web element algorithm with object value.

    If value if value is an Array object or an Object object:

    Return the result of running the clone an object algorithm with arguments value and seen, and the JSON deserialize algorithm as the clone algorithm.

    Otherwise:

    Return error with error code javascript error.

When required to make a JSON clone with argument value, a remote end must run the following steps:

  1. Let seen be an empty set.

  2. Return the result of calling the internal JSON clone algorithm with arguments value and seen.

When required to run the internal JSON clone algorithm with arguments value and seen, a remote end must return the value of the first matching statement, matching on value:

undefined
null

Success with data null.

type Boolean
type Number
type String

Success with data value.

instance of element

Serialize the element with argument value.

instance of NodeList
instance of HTMLCollection
instance of Array
instance of Object
  1. If value is in seen, return error with error code javascript error.

  2. Add value to seen.

  3. Produce the value of running the clone an object algorithm with arguments value and seen, and the internal JSON clone algorithm as the clone algorithm.

Otherwise

Error with error code javascript error.

When required to clone an object with arguments value and seen and clone algorithm, run the following steps:

  1. Let result be the value of the first matching statement, switching on value:

    instance of NodeList
    instance of HTMLCollection
    instance of Array

    A new Array object, which length property has the result of getting a property named "length" from value.

    Otherwise

    A new Object object.

  2. For each enumerable own property in value, run the following substeps:

    1. Let name be the name of the property.

    2. Let source property value be the result of getting a property named name from value. If doing so causes script to be run, and that script throws an exception, return error with error code javascript error.

    3. Let cloned property result be the result of calling the clone algorithm with arguments source property value and seen.

    4. If cloned property result is a success, set a property of result with name name and value equal to cloned property result’s data.

    5. Otherwise, return cloned property result.

The steps for extracting the script arguments from a request are:

  1. If the current browsing context is no longer open, return error with error code no such window.

  2. Let script be the result of getting a property named script from the parameters argument.

  3. If script is not a String, return error with error code invalid argument.

  4. Let args be the result of getting a property named args from the parameters argument.

  5. If args is not an Object or its [[Class]] internal property is not Array or Object, return error with error code invalid argument.

  6. Let arguments be a List consisting of a json deserialization of each item in args with the order preserved.

  7. Return success with data script and arguments.

When required to execute a function body with arguments body and arguments, a remote end must run the following steps:

  1. Let window be the associated window of the current browsing context’s active document.

  2. Let environment settings be the environment settings object for window.

  3. Let script environment be the script execution environment for JavaScript obtained from environment settings.

  4. If body is not parsable as a FunctionBody or if parsing detects an early error, return error with error code javascript error.

  5. If body begins with a directive prologue that contains a use strict directive then let strict be true, otherwise let strict be false.

  6. Using the script execution environment script environment, let function be the result of calling create a function object with parameter list of an empty List, body body, scope of the global environment, and strict flag strict.

  7. Let script be a new script.

  8. Let script’s code entry-point be function.

  9. Let script’s settings object object be script settings.

  10. Invoke the [[Call]] internal method of function, providing window as the this value and parameters as the argument values. If doing so does not produce an exception, let result be success with data set to the return value from this function call. Otherwise let result be error with error code javascript error.

  11. If result is an error, return result.

  12. Otherwise let json data be a JSON clone of result’s data.

  13. Return success with data json data.

14.1 Execute Script

HTTP Method Path Template
POST /session/{session id}/execute/sync

The Execute Script command executes a JavaScript function in the context of the current browsing context and returns the return value of the function.

The remote end steps are:

  1. If the current top-level browsing context is no longer open, return error with error code no such window.

  2. Handle any user prompts, and return its value if it is an error.

  3. Let script arguments be the result of extracting the script arguments from a request with argument parameters.

  4. If script arguments is an error, return script arguments.

  5. Let body and arguments be script arguments’ data.

  6. Let result be the result of calling execute a function body, with arguments body and arguments.

  7. If result is an error, return result.

    Otherwise let value be result’s data.

  8. Let data be a new JSON Object.

  9. Set the property "value" of data to value.

  10. Return success with data data.

14.2 Execute Async Script

HTTP Method Path Template
POST /session/{session id}/execute/async

The Execute Async Script command causes JavaScript to execute as an anonymous function. Unlike the Execute Script command, the result of the function is ignored. Instead an additional argument is provided as the final argument to the function. This is a function that, when called, returns its first argument as the response.

The remote end steps are:

  1. If the current top-level browsing context is no longer open, return error with error code no such window.

  2. Handle any user prompts, and return its value if it is an error.

  3. Let script arguments be the result of extracting the script arguments from a request with argument parameters.

  4. If script arguments is an error, return script arguments.

  5. Let body and arguments be script arguments’ data.

  6. Issue 21

    This next step might not quite set up all the right machinery.

    Let webdriver callback result be a flag which can have three values: unset, expired, or set, with the set value having associated data. Initially it is in the unset state.

  7. Let callback be a function whose [[Call]] internal method runs the execute async script callback algorithm initialized with argument webdriver callback result.

  8. Append callback to arguments.

  9. Let result be the result of calling execute a function body with arguments body and arguments.

  10. If result is an error, return result.

  11. Wait for webdriver callback result to enter the set state, or for session script timeout milliseconds to expire, whichever happens sooner.

  12. If the previous step completed due the session script timeout being reached, set webdriver callback result to expired and return error with error code script timeout.

  13. Otherwise, let result be webdriver callback result’s data.

  14. If result is an error, return result.

  15. Let value be result’s data.

  16. Let data be a new JSON Object.

  17. Set the property value of data to value.

  18. Return success with data data.

The execute async script callback algorithm is initialized with a single argument webdriver callback state. It defines a function with a single optional argument result. When this function is called, the following steps are run:

  1. If webdriver callback state is not in the unset state, return undefined.

  2. If result is not present, let result be null.

  3. Let json result be a JSON clone of result.

  4. Set the webdriver callback state to set with data json result.

  5. Return undefined.

15. Cookies

This section describes the interaction with cookies as described in the [HTML].

To get all associated cookies to a document, the user agent must return the enumerated set of cookies that meet the requirements set out in the first step of the algorithm in [RFC6265] to compute cookie-string for the current browsing context’s document’s address for an ‘HTTP API’.

A serialized cookie is created by assigning the fields of a cookie to properties of a new JSON Object:

"name"

cookie name

"value"

cookie value

"expiry"

cookie expiry time

"domain"

cookie domain

"path"

cookie path

"secure"

cookie secure only

"http"

cookie http only

To delete cookies given an optional filter argument name that is a string:

  1. For each cookie among all associated cookies of the current top-level browsing context’s active document, if:

    name is undefined
    name is equal to cookie’s cookie-name

    Add an attribute to the attribute-list of cookie with attribute-name of Expires, and set its value to a time in the past.

15.4 Delete All Cookies

HTTP Method Path Template
DELETE /session/{session id}/cookie

The Delete All Cookies command allows deletion of all cookies associated with the active document’s address.

The remote end steps are:

  1. If the current top-level browsing context is no longer open, return error with error code no such window.

  2. Handle any user prompts, and return its value if it is an error.

  3. Delete cookies, giving no filtering argument.

  4. Return success with data null.

16. Interactions

Issue 22

Warning: This section has not yet been redefined to match the routing requests model, and uses old concepts and definitions. Please do not rely on it yet.

The WebDriver API offers two ways of interacting with elements, either with a set of low-level "do as I say" actions, or a high-level "do as I mean" set of actions. The former are offered to allow precise emulation of user input. The latter are offered as a convenience to cover the common case, and can conceivably be implemented on top of the lower level primitive operations.

Interactions can be used to emulate single input actions as well as multiple, simultaneous actions.

Terms:


(NOTE: these are by no means the final terms, I needed them to make the prose easier to follow)

low-level action: The smallest operation an input source can do. These are used to build chains of actions. Example: keyDown
action chain: A chain of low-level actions
input source: The source from which the inputs will originate. MUST support 'keyboard', 'mouse' and 'touch'
source: The object currently acting on the source. For example, in a 'touch' environment, if two fingers are acting on a touchscreen, you will have two sources of input.

16.1 Low-Level Actions


The low level actions provide a mechanism for precisely stating how a user can interact with the browser. This is achieved by sending a chain of low-level commands to a single endpoint. For example, if you wish to automate a drag and drop action in a browser, you would chain the pointerDown, pointerMove, pointerUp and release commands together.

The remote end will receive the action chain, execute them, and will return a response to the local end once the entire action sequence has been dispatched.

The set of actions available to you is depending on the input source. For example, on a keyboard you want to have a keyDown action to simulate pressing a specific key on the keyboard, but this is not a valid action on a touchscreen, where we care about pointer actions relative to coordinates or webelements.
Note

Activation triggers generated by the WebDriver API User SHOULD be indistinguishable from those generated by a real user interacting with the browser. In particular, the dispatched events will have the isTrusted attribute set to true. The most robust way to dispatch these events is by creating them in the browser implementation itself. Sending OS-specific input messages to the browser's window has the disadvantage that the browser being automated may not be properly isolated from a user accidentally modifying input source state; use of an OS-level accessibility API has the disadvantage that the browser's window must be focused, and as a result, multiple tests cannot run in parallel.


16.1.1 Actions Endpoint

16.1.1.1 Sending an Action
HTTP Method Path Template
POST /session/{session id}/actions

The 'actions' endpoint expects a list of objects as input. Each object in this list MUST contain the fellowing members:

Source

Issue 23

Use symbols?

The "source" member will hold a string value to represent the input source. Implementations MUST support "keyboard", "mouse", and "touch", and can be extended for any other input source.

id

This is a locally-assigned unique identifier. It will be used by the remote end to differentiate dispatched actions. For example, if you have a "touch" action with id "1" to represent one finger actively pressed on a screen, then you can dispatch another "touch" action with id "2" to represent a second finger on a screen, acting simultaneously.

actions

This holds a list of objects, where each object represents a low-level command. The list order dictates the order in which each command will be dispatched. Each command MUST have a 'name' member, whose value will hold the name of the command. More information on each command is in the action commands section.

So the structure will look as follows:

            [
              {
                "source": "string",
                "id": "string",
                "actions": [
                          { "name": "string: name of action primitive",
                            ... parameters to action commands...
                          },
                ]
              }
            ]
          

A list of dictionary objects are used so that we may use this same endpoint for parallel actions.
There is one endpoint for all input source's action chains.
16.1.1.2 Releasing all actions
HTTP Method Path Template
DELETE /session/{session id}/actions


Use this command to clear all actions that are currently being performed. ALL actions currently being performed MUST be cancelled via pointerCancel if it is a "mouse" or "touch" source or via keyUp if it is a "keyboard" source.

NOTE: 'release' as a single command was removed since 'keyUp' and 'pointerUp'/'pointerCancel' exist and 'release' conflates them
16.1.1.3 Actions
This section describes the objects that are part of the "actions" member of the JSON structure sent to the "actions" endpoint.
16.1.1.3.1 General Actions
All input sources MUST implement the following action:

pause

Issue 24

Or MAY, since we can default to 0 on remote end?

The "pause" action MUST take in a parameter named "duration" which will be the time to wait either in milliseconds or using a symbol. This action is used to indicate a period of time to wait between actions, and will also be used to indicate a period of inaction in parallel action chains.

If you wish to use a system specific wait period, please use the following symbols:

  • "CONTEXT" - wait for contextmenu
  • "CHAINED_EVENT" - wait period to join related events. For example, this should be used to join events for doubleclicking.

The remote end is responsible for translating these symbols to the platform specific periods.
16.1.1.3.2 Keyboard Actions
The following are actions that must be implemented for the "keyboard" input source. Their names will be used as the value to the "name" member of the data sent to the 'actions' endpoint. Each actions parameters are additional members to the object that "name" is a member of.

keyDown

The "keyDown" requires a parameter named "code" whose value will be one of the codes from the character types table. This action will send a "keyDown" event, with the specified key as a target.

keyUp

The "keyUp" requires a parameter named "code" whose value will be one of the codes from the character types table. This action will send a "keyUp" event, with the specified key as a target.
16.1.1.3.3 Pointer Actions

The following are actions that must be implemented for both "mouse" and "touch" input sources. Any future pointer-based source must implement these actions.

NOTE: conflating mouse and touch causes the pointerMove/pointerDown to events to be confusing and lacks verisimilitude: If you want to tap at element1, then that would mean 'put finger down on element1, remove finger from element1', for a tap, we have to decide if we want to send 'pointerMove, pointerDown, pointerUp' or 'pointerDown, pointerUp'. The latter matches the touch events sent (touchStart,touchEnd), and makes sense for touchscreens because there is no active button state (http://www.w3.org/TR/pointerevents/#glossary) until you dispatch a touchstart. sending a JSON structure with pointerMove, pointerDown, pointerUp for something that gets mapped to touchstart/touchend feels inelegant. We can enforce the following instead:

  • if the "source" is mouse, then pointerMove,pointerDown,pointerUp is sent over the wire
  • if the "source" is touch, then pointerDown,pointerUp is sent over the wire.
  • if the "source" is anything else (stylus, or other), it will be defined later.

The ramifications of this proposal would be that pointerDown must accept the parameters that pointerMove does (ie: ELEMENT, etc.).

pointerMove

The "pointerMove" action is used to move the pointer to a specific location on a page. In "mouse" sources, this would dispatch a "mouseMove" event. In "touch" sources, then if there is an active pointerDown action, this will generate a "touchmove" or "pointermove" event. For "touch" sources, pointerMove must not be called before pointerDown, since pointer sources only have move events once they are active on the screen.

When sending a "pointerMove", one of the following parameter sets MUST be used:

  • "ELEMENT" - "ELEMENT" will hold a WebElement's id, and this will dispatch the event to the center of that element, unless the following set of parameters is also included:
    • "x" - Integer, the x-coordinate relative to the top-left corner of the target WebElement. If this is not specifed, the midpoint of the width is used
    • "y" - Integer, the y-coordinate relative to the top-left corner of the target WebElement. If this is not specifed, the midpoint of the height is used
    • "x" and "y" - Integers, the coordinates relative to the top-left corner of the ???.
    Issue 25

    Viewport, or top-left of root element?

pointerDown

The "pointerDown" action is used to start an interaction on the page. In "mouse" sources, this would mean "mouseDown", in "touch" sources, this would mean "touchstart" or "pointerdown".

For "touch" sources, the following parameters must be passed:

  • "ELEMENT" - "ELEMENT" will hold a WebElement's id, and this will dispatch the event to the center of that element, unless the following optional set of parameters is also included:
    • "x" - Integer, the x-coordinate relative to the top-left corner of the target WebElement. If this is not specifed, the midpoint of the width is used
    • "y" - Integer, the y-coordinate relative to the top-left corner of the target WebElement. If this is not specifed, the midpoint of the height is used

For "mouse" sources, the following parameter must be passed:

  • "BUTTON" - "BUTTON" will hold a value describing which mouse button should be depressed.

    Link to button chart

pointerUp

The "pointerUp" action is used to start an interaction on the page. In "mouse" sources, this would mean "mouseUp", in "touch" sources, this would mean dispatching an event like "touchend" or "pointerup".

Takes no parameters

pointerCancel

The "pointerMove" action is used to cancel an active pointer on the page. In "mouse" sources, this would mean "mouseUp", in "touch" sources, it implies cancelling the current action if possible by dispatching an event like "touchcancel" or "pointercancel".

16.1.1.3.4 Parallel Actions

Parallel actions are those that have more than one action acting simultaneously on the browser. An example of this is using multiple fingers to operate on a tablet screen at the same time.

Dispatching a parallel action also uses the actions endpoint. In order to send a parallel action, append multiple dictionaries to the list of dictionary objects. Each dictionary will hold all the actions from one input source. The list of actions each dictionary contains will be executed together in ticks, by stepping through each input source's action list in order and executing each step simultaneously.

The best way to understand this is through an example. Imagine we have two fingers acting on a touchscreen. One finger will press down on element1 at the same moment that another finger presses down on element2. Once these actions are done, the first finger will wait 5 seconds while the other finger moves to element3. Then both fingers release from the touchscreen.

To execute these actions, we must send the "actions" endpoint two dictionary objects in the JSON list of dictionaries, one for each finger. We must use the "id" key of each object to uniquely identify each finger. The "actions" key will hold all the actions the input source will take.

The JSON for this set of actions is as follows:

[
  {
    "source": "touch",
    "id": "1",
    "actions": [
              { "name": "pointerDown",
                "ELEMENT": "element1"
              },
              { "name": "pause",
                "duration": 0
              },
              { "name": "pointerUp"
              }
    ]
  },
  {
    "source": "touch",
    "id": "2",
    "actions": [
              { "name": "pointerDown",
                "ELEMENT": "element2"
              },
              { "name": "pointerMove",
                "ELEMENT": "element3"
              },
              { "name": "pointerUp"
              }
    ]
  }
]

When the remote end receives this, it will look at each input source's action lists. It will dispatch the first action of each source together, then the second actions together, and lastly, the final actions together.

The diagram below displays when each action gets executed. "Source 1" is the first finger, and "source 2" is the second.

There is no limit to the number of input sources, and there is no restriction regarding the length of each input's action list. Meaning, there is no requirement that all action lists have to be the same length. It is possible for one input source's action list may have more actions than another. As an example, imagine having two fingers on a touchscreen. The first finger will press on element1 while the second presses on element2, then the first will release the touchscreen while the second finger moves to element3, and finally the second finger releases from the touchscreen. In this case, the action list for the first finger contains 2 actions (pointerDown, pointerUp), and the action list for the second finger contains 3 (pointerDown, pointerMove, pointerUp). In this case, the JSON will look like this:

[
  {
    "source": "touch",
    "id": "1",
    "actions": [
              { "name": "pointerDown",
                "ELEMENT": "element1"
              },
              { "name": "pointerUp"
              }
    ]
  },
  {
    "source": "touch",
    "id": "2",
    "actions": [
              { "name": "pointerDown",
                "ELEMENT": "element2"
              },
              { "name": "pointerMove",
                "ELEMENT": "element3"
              },
              { "name": "pointerUp"
              }
    ]
  }
]

And the execution of each action will be done as follows:

Specific timing for the actions can also be expressed. The "pause" action can be used to either a) indicate a specific amount of time an input source must wait, or b) can be used to signify that the current input source must wait until all other actions in the tick are completed. For the former case, the current tick being executed must wait for the longest pause to complete. For example, in this diagram:

The remote end will dispatch the pointerDown actions in the first tick. In the second tick, since source 1 declares a pause of 5 seconds, the remote end will dispatch the pointerUp event for source 2, and will wait 5 seconds before moving on to executing the third tick.

In the event that one tick contains multiple pause durations, the remote end will wait the maximum duration before moving on to executing the next tick.

As noted before, "pause" can be used to signify inaction during a tick. If "pause" is declared without a time period, then the input source will not have any actions executed in the containing tick. As an example:

During tick 2, source 1 will have its pointerMove action dispatched, while source 2 will do nothing.

16.2 High Level Commands

These higher level commands SHOULD be built on top of the low level commands, and implement a user friendly way of interacting with a page in a way that models common user expectations.

16.2.1 Typing keys

A requirement for key-based interaction with an element is that it is interactable. Typing into an element is permitted if one of the following conditions is met:

  • The element is focusable as defined in the editing section of the [HTML] spec.
  • The element is allowed to be the activeElement. In addition to focusable elements, this allows typing to the BODY element.
  • In an HTML document, the element is editable as a result of having its contentEditable attribute set or the containing document is in designMode.
  • The underlying browser implementation would allow keyboard input to directed to the element (eg. an HTML document with a DIV marked as being contentEditable)

Prior to any keyboard interaction, an attempt to shift focus to the element MUST be attempted if the element does not currently have the focus. This is the case if one of the following holds:

  • The element is not already the document's activeElement.
  • The owner document of the element to be interacted with is not the focused document.

In case focusing is needed, the implementation MUST follow the focusing steps as described in the focus management section of the [HTML] spec. The focus MUST NOT leave the element at the end of the interaction, other than as a result of the interaction itself (i.e. when the tab key is sent).

16.2.1.1 sendKeys()

HTTP Method Path Template
POST /session/{session id}/element/{element id}/value

Let value be an array of characters that will be typed into a WebElement.

Sends a sequence of keyboard events representing the keys in the value parameter.

Caret positioning: If focusing was needed, after following the focusing steps, the caret MUST be positioned at the end of the text currently in the element. At the end of the interaction, the caret MUST be positioned at the end of the typed text sequence, unless the keys sent position it otherwise (e.g. using the LEFT key).

There are four different types of keys that are emulated:

  • Character literals - lower-case symbols.
  • Uppercase letters and symbols requiring the SHIFT key for typing.
  • Modifier keys
  • Special keys
The rest of this section details the values used to represent the different keys, as well as the expected behaviour for each key type.

When emulating user input, the implementation MUST generate the same sequence of events that would have been produced if a real user was sitting in front of the keyboard and typing the sequence of characters. In cases where there is more than one way to type this sequence, the implementation MUST choose one of the valid ways. For example, typing AB may be achieved by:

  • Holding down the Shift key
  • Pressing the letter 'a'
  • Pressing the letter 'b'
  • Releasing the Shift key
Alternatively, it can be achieved by:
  • Holding down the Shift key
  • Pressing the letter 'a'
  • Releasing the Shift key
  • Holding down the Shift key
  • Pressing the letter 'b'
  • Releasing the Shift key

Or by simply turning on the CAPS LOCK first.

The implementation MAY use the following algorithm to generate the events. If the implementation is using a different algorithm, it MUST adhere to the requirements listed below.

For each key, key in value, do

  1. If key is a lower-case symbol:
    1. If the Shift key is not pressed:
      1. Generate a sequence of keydown, keypress and keyup events with key as the character to emulate
    2. else (The Shift key is pressed)
      1. let uppercaseKey be the upper-case character matching key
      2. Generate a sequence of keydown, keypress and keyup events with uppercaseKey as the character to emulate
  2. Else if key is an upper-case symbol:
    1. If the Shift key is not pressed:
      1. Generate a keydown event of the Shift key.
      2. Generate a sequence of keydown, keypress and keyup events with key as the character to emulate
      3. Generate a keyup event of the Shift key.
    2. else (The Shift key is pressed)
      1. Generate a sequence of keydown, keypress and keyup events with key as the character to emulate
  3. Else if key represents a modifier key:
    1. let modifier be the modifier key represented by key
    2. If modifier is currently held down:
      1. Generate a keyup event of modifier
    3. Else:
      1. Generate a keydown event of modifier
    4. Maintain this key state and use it to modify the input until it is pressed again.
  4. Else if key represents the NULL key:
    1. Generate keyup events of all modifier keys currently held down.
    2. All modifier keys are now assumed to be released.
  5. Else if key represents a special key:
    1. Translate key to the special key it represents
    2. Generate a sequence of keydown, keypress and keyup events for the special key.

Once keyboard input is complete, an implicit NULL key is sent unless the final character is the NULL key.

Any implementation MUST comply with these requirements:

  • For uppercase letters and symbols that require the Shift key to be pressed, there are two options:
    • A single Shift keydown event is generated before the entire sequence of uppercase letters.
    • Before each such letter or symbol, a Shift keydown event is generated. After each letter or symbol, a Shift keyup event is generated.
  • A user-specified Shift press implies capitalization of all following characters.
  • If a user-specified Shift press precedes uppercase letters and symbols, a second Shift keydown event MUST NOT be generated. In that case, a Shift keyup event MUST NOT be generated implicitly by the implementation.
  • The NULL key releases all currently held down modifier keys.
  • The state of all modifier keys must be reset at the end of each sendKeys call and the appropriate keyup events generated

Character types

The value parameter contains a mix of printable characters and pressable keys that aren't text. Pressable keys that aren't text are stored in the Unicode PUA (Private Use Area) code points, 0xE000-0xF8FF. The following table describes the mapping between PUA and key:

Key Code Type
NULL\uE000NULL
CANCEL\uE001Special key
HELP\uE002Special key
BACK_SPACE\uE003Special key
TAB\uE004Special key
CLEAR\uE005Special key
RETURN\uE006Special key
ENTER\uE007Special key
SHIFT\uE008Modifier
CONTROL\uE009Modifier
ALT\uE00AModifier
PAUSE\uE00BSpecial key
ESCAPE\uE00CSpecial key
SPACE\uE00DSpecial key
PAGE_UP\uE00ESpecial key
PAGE_DOWN\uE00FSpecial key
END\uE010Special key
HOME\uE011Special key
ARROW_LEFT\uE012Special key
ARROW_UP\uE013Special key
ARROW_RIGHT\uE014Special key
ARROW_DOWN\uE015Special key
INSERT\uE016Special key
DELETE\uE017Special key
SEMICOLON\uE018Special key
EQUALS\uE019Special key
NUMPAD0\uE01ASpecial key
NUMPAD1\uE01BSpecial key
NUMPAD2\uE01CSpecial key
NUMPAD3\uE01DSpecial key
NUMPAD4\uE01ESpecial key
NUMPAD5\uE01FSpecial key
NUMPAD6\uE020Special key
NUMPAD7\uE021Special key
NUMPAD8\uE022Special key
NUMPAD9\uE023Special key
MULTIPLY\uE024Special key
ADD\uE025Special key
SEPARATOR\uE026Special key
SUBTRACT\uE027Special key
DECIMAL\uE028Special key
DIVIDE\uE029Special key
F1\uE031Special key
F2\uE032Special key
F3\uE033Special key
F4\uE034Special key
F5\uE035Special key
F6\uE036Special key
F7\uE037Special key
F8\uE038Special key
F9\uE039Special key
F10\uE03ASpecial key
F11\uE03BSpecial key
F12\uE03CSpecial key
META\uE03DSpecial key
COMMAND\uE03DSpecial key
ZENKAKU_HANKAKU\uE040Special key

The keys considered upper-case symbols are either defined by the current keyboard locale or are derived from the US 104 keys Microsoft Windows keyboard layout, which are:

  • A - Z
  • !$^*()+{}:?|~@#%_\" & < >

When the user input is emulated natively (see note below), the implementation SHOULD use the current keyboard locale to determine which symbols are upper case. In all other cases, the implementation MUST use the US 104 key Microsoft Windows keyboard layout to determine those symbols.

The state of the physical keyboard MUST NOT affect emulated user input.

Internationalized input

Non-latin symbols: TBD

Complex scripts using Input Method Editor (IME): TBD

17. User Prompts

Non-normative summary:

This chapter describes interaction with various types of user prompts. The common denominator for user prompts is that they are modal windows requiring users to interact with them before the event loop is unpaused and control is returned to the current top-level browsing context.

By default user prompts are not handled automatically unless a user prompt handler has been defined. When a user prompt appears, it is the task of the subsequent command to handle it. If the subsequent requested command is not one listed in this chapter, an unexpected alert open error will be returned.

User prompts that are spawned from beforeunload event handlers, are dismissed implicitly upon navigation, regardless of the defined user prompt handler.

The following table of simple dialogues enumerates all supported simple dialogues, along with the commands that are allowed to interact with it as a non-normative reference:

Definition Dialogue Interactions
Alert window.alert Accept Alert
Dismiss Alert
Get Alert Text
Confirm window.confirm Dismiss Alert
Accept Alert
Get Alert Text
Prompt window.prompt Dismiss Alert
Accept Alert
Get Alert Text
Send Alert Text

The current user prompt is said to be the active user prompt, which can be one of the entries on the table of simple dialogues, the window.print dialogue, or a dialogue spawned by showModalDialog() should this be supported by the user agent.

To dismiss the current user prompt, do so as if the user would click the Cancel or OK button, whichever is present, in that order.

To accept the current user prompt, do so as if the user would click the OK button.

A user prompt handler is an enumerated attribute defining what action the remote end must take when a user prompt is encountered. The following table lists the keywords and states for the attribute:

Keyword State Description
"dismiss" Dismiss state All simple dialogues encountered should be dismissed.
"accept" Accept state All simple dialogues encountered should be accepted.

In order to handle any user prompts a remote end must take the following steps:

  1. If there is no current user prompt, abort these steps and return success.

  2. Match on the user prompt handler:

    dismiss state

    Dismiss the current user prompt.

    accept state

    Accept the current user prompt.

    missing value default state
    not in the table of simple dialogues

    Return error with error code unexpected alert open.

  3. Return success.

17.1 Dismiss Alert

HTTP Method Path Template
POST /session/{session id}/alert/dismiss

The Dismiss Alert command dismisses a simple dialogue if present. A request to dismiss an alert user prompt, which may not necessarily have a dismiss button, has the same effect as accepting it.

The remote end steps are:

  1. If the current top-level browsing context is no longer open, return error with error code no such window.

  2. If there is no current user prompt, return error with error code no such alert.

  3. Dismiss the current user prompt.

  4. Return success with data null.

17.2 Accept Alert

HTTP Method Path Template
POST /session/{session id}/alert/accept

The Accept Alert command accepts a simple dialogue if present.

The remote end steps are:

  1. If the current top-level browsing context is no longer open, return error with error code no such window.

  2. If there is no current user prompt, return error with error code no such alert.

  3. Accept the current user prompt.

  4. Return success with data null.

17.3 Get Alert Text

HTTP Method Path Template
GET /session/{session id}/alert/text

The Get Alert Text command returns the message of the current user prompt. If there is no current user prompt, it returns with null.

The remote end steps are:

  1. If the current top-level browsing context is no longer open, return error with error code no such window.

  2. If there is no current user prompt, return error with error code no such alert.

  3. Let message be the text message associated with the current user prompt, or otherwise be null.

  4. Let body be a JSON Object with the "value" property set to message.

  5. Return success with data body.

17.4 Send Alert Text

HTTP Method Path Template
POST /session/{session id}/alert/text

The Send Alert Text command sets the text field prompt to a given value, and only makes sense on window.prompt.

The remote end steps are:

  1. If the current top-level browsing context is no longer open, return error with error code no such window.

  2. If there is no current user prompt, return error with error code no such alert.

  3. Match on current user prompt:

    alert
    confirm

    Return error with error code element not visible.

    prompt

    Do nothing.

    Otherwise

    Return error with error code unsupported operation.

  4. Let character array be the result of getting a property message from the parameters argument.

  5. Let message be the result of joining together each element in character array to a string.

  6. Set the current user prompt’s text field value to the value of message.

  7. Return success with data null.

18. Screen Capture

Screenshots are a mechanism for providing additional visual diagnostic information. They work by dumping a snapshot of the initial viewport’s framebuffer as a lossless PNG image. It is returned to the local end as a Base64 encoded string.

WebDriver provides the Take Screenshot command to capture the top-level browsing context’s initial viewport, and a command Take Element Screenshot for doing the same with the visible region of an element’s bounding rectangle after it has been scrolled into view.

In order to draw a bounding box from the framebuffer, given a rectangle:

  1. If either the initial viewport’s width or height is 0 CSS reference pixels, return error with error code unable to capture screen.

  2. Let paint width be the initial viewport’s width – min(rectangle x coordinate, rectangle x coordinate + rectangle width dimension).

  3. Let paint height be the initial viewport’s height – min(rectangle y coordinate, rectangle y coordinate + rectangle height dimension).

  4. Let canvas be a new canvas element, and set its width and height to paint width and paint height, respectively.

  5. Let context, a canvas context mode, be the result of invoking the 2D context creation algorithm given canvas as the target.

  6. Complete implementation specific steps equivalent to drawing the region of the framebuffer specified by the following coordinates onto context:

    X coordinate
    rectangle x coordinate
    Y coordinate
    rectangle y coordinate
    Width
    paint width
    Height
    paint height
  7. Return success with canvas.

To encode as Base64 a canvas element:

  1. If the canvas element’s bitmap’s origin-clean flag is set to false, return error with error code unable to capture screen.

  2. If the canvas element’s bitmap has no pixels (i.e. either its horizontal dimension or vertical dimension is zero) then return error with error code unable to capture screen.

  3. Let file be a serialisation of the canvas element’s bitmap as a file, using "image/png" as an argument.

  4. Let data url be a data: URL representing file. [RFC2397]

  5. Let index be the index of "," in data url.

  6. Let encoded string be a substring of data url using (index + 1) as the start argument.

  7. Return success with data encoded string.

18.1 Take Screenshot

HTTP Method Path Template
GET /session/{session id}/screenshot

The Take Screenshot command takes a screenshot of the top-level browsing context’s viewport.

The remote end steps are:

  1. If the current top-level browsing context is no longer open, return error with error code no such window.

  2. Let root rect be the current top-level browsing context’s document element’s rectangle.
  3. Let screenshot result be the result of calling draw a bounding box from the framebuffer, given root rect as an argument.

  4. If screenshot result is an error, return screenshot result.

  5. Let canvas be screenshot result’s data.

  6. Let encoding result be the result of encoding as Base64 the canvas element.

  7. If encoding result is an error, return encoding result.

  8. Let encoded string be encoding result’s data.

  9. Let body be a JSON Object with the "value" property set to encoded string.

  10. Return success with data null.

18.2 Take Element Screenshot

HTTP Method Path Template
GET /session/{session id}/element/{element id}/screenshot

The Take Element Screenshot command takes a screenshot of the visible region encompassed by the bounding rectangle of an element. If given a parameter argument scroll that evaluates to false, the element will not be scrolled into view.

  1. If the current top-level browsing context is no longer open, return error with error code no such window.

  2. Let scroll be true if it is undefined.

  3. Let element result be the result of getting a known element by UUID reference parameter element id.

  4. If element result is an error, return element result.

  5. Let element be element result’s data.

  6. Let element rect be element’s rectangle.

  7. If asked to scroll, scroll into view the element.

  8. Let screenshot result be the result of calling draw a bounding box from the framebuffer, given element rect as an argument.

  9. If screenshot result is an error, return screenshot result.

  10. Let canvas be screenshot result’s data.

  11. Let encoding result be the result of encoding as Base64 the canvas element.

  12. If encoding result is an error, return encoding result.

  13. Let encoded string be encoding result’s data.

  14. Let body be a JSON Object with the "value" property set to encoded string.

  15. Return success with data body.

A. Privacy

It is advisable that remote ends create a new profile when creating a new session. This prevents potentially sensitive session data from being accessible to new sessions, ensuring both privacy and preventing state from bleeding through to the next session.

B. Security

A user agent may rely on a command-line flag or a configuration option to test whether to enable WebDriver. Another option is to make the user agent initiate or confirm the connection through a privileged content document or control widget, in case the user agent does not directly implement the HTTP endpoints.

To prevent arbitrary machines from connecting and creating sessions, only connections from loopback devices are allowed by default. Remote ends do however support a scenario where the local end runs on a different machine from the remote end.

The remote end must include a configuration option to limit the accepted IP range allowed to connect and make requests. The default setting for this should be to limit connections to the IPv4 localhost CIDR range 127.0.0.0/8 and the IPv6 localhost address ::1. [RFC4632]

C. Element Displayedness

Although WebDriver does not define a primitive to ascertain the visibility of an element in the viewport, we acknowledge that it is an important feature for many users. Here we include a recommended approach which will give a simplified approximation of an element’s visibility, but please note that it relies only on tree-traversal, and only covers a subset of visibility checks.

The visibility of an element is guided by what is perceptually visible to the human eye. In this context, an element's displayedness does not relate to the visibility or display style properties.

The approach recommended to implementors to ascertain an element's visibility is based on crude approximations about its nature and relationship in the tree. An element is in general to be considered visible if any part of it is drawn on the canvas within the bounderies of the viewport.

When asked to normalize style pixel values to floating point for a value s of the type string:

  1. Let trimmed string be a substring of s where the suffix "px" is removed.

  2. Let pixels be the result of parsing trimmed string as a float.

  3. If pixels is not a valid float or the previous operation did not succeed, return 0.0.

  4. Round off pixels using a ceiling function so that it has no more than four decimals.

  5. Return pixels.

Note

To normalize style pixel values to floating point is almost equivalent to calling parseFloat from [ECMA-262] with the exception that non-valid float return values are returned as 0.0.

Issue 26

This algorithm is not the same as the one used by Selenium. To provide backwards compatibility, we should change it to be an accurate description of what Selenium does.

The element displayed algorithm is a boolean state where true signifies that the element is displayed and false signifies that the element is not displayed. To compute the state on element:

  1. If the attribute hidden is set, return false.

  2. If the computed value of the display style property is "none", return false.

  3. Issue 27

    Not really sure what this means, needs review:

    If it has a [CSS3-2D-TRANSFORMS] or [CSS3-3D-TRANSFORMS] style property that gives a negative X or Y coordinates to the canvas, return false.

  4. If element is the document's root element, that is document.documentElement:

    1. If the computed value of the background-color property is "transparent", run these substeps:

      1. If element is an HTML HTML element [HTML], and the computed value of the background-color style property of the first body element descendant of the element in tree order, relative to that element, is also "transparent", return false. Otherwise return true.

  5. If element is an option or optgroup element, and element's parent node is a select element:

    1. Apply the element displayed algorithm on element's parent node.

    2. If the return value is false, abort these steps and return that value.

  6. If element is a map element:

    1. Let any images visible be a boolean initially set to false.

    2. For each img element, image element, in the document with a name attribute matching the value of element's usemap attribute, run these substeps:

      1. Run the element displayed algorithm on image element and set any images visible to any images visible bitwise OR its return value.

    3. If any images visible is true, abort these steps and return its value.

  7. If element is an area element:

    1. For each ancestral element parent, in tree order:

      1. If parent is a map element, apply the element displayed algorithm on it.

      2. If the return value is false, abort these steps and return that value.

      3. Otherwise apply step 7.1 on parent.

  8. If element is a [DOM] text node, return true.

  9. If it has equal to or more than one direct descendant elements:

    1. Let visible children be a boolean initially set to false.

    2. For each direct descendant element child:

      1. Let rectangle be child’s bounding rectangle.

      2. If the value of the height property of rectangle is greater than zero CSS reference pixels, and the value of the width property of rectangle is greater than zero CSS reference pixels:

        1. Set visible children to visible children bitwise OR true.

  10. For each ancestral element parent, in tree order:

    1. Apply the element displayed algorithm to parent.

    2. If the return value is false, abort these steps and return that value.

    3. If parent is a block element box and the computed values of either overflow-x or overflow-y is "hidden":

      1. Issue 28

        DOMRectList has disappeared from [GEOMETRY-1] and been replaced by ArrayClass, but there is no reference to it.

        Let parent dimensions be the rectangle that is the first element of the DOMRectList array returned by calling getClientRects on parent.

      2. Let element dimensions be the rectangle that is the first element of the DOMRectList array returned by calling getClientRects on element.

      3. Let parent style be the computed style of parent.

      4. Return false if any the following conditions evaluate to false:

      5. Run step 10 on the parent elements of parent, if any.

  11. Return true.

D. Acknowledgements

Many thanks to Robin Berjon for making our lives so much easier with his cool tool. Thanks to Jason Leyba, Malcolm Rowe, Ross Patterson, Andrey Botalov, and Berge Schwebs Bjørlo for proof reading and suggesting areas for improvement. Thanks to Jason Leyba, Eran Messeri, Daniel Wagner-Hall, Malini Das, Luke Inman-Semerau, Andreas Tolfsen, James Graham, and John Jansen for contributing sections to this document. Also thanks to the following people for their contribution of patches and test cases:

Select text and or view bugs filed

E. References

E.1 Normative references

[CSS-CASCADE-4]
Elika Etemad; Tab Atkins Jr.. CSS Cascading and Inheritance Level 4. 8 September 2015. W3C Working Draft. URL: http://www.w3.org/TR/css-cascade-4/
[CSS-DEVICE-ADAPT]
Rune Lillesveen. CSS Device Adaptation. 15 September 2011. W3C Working Draft. URL: http://www.w3.org/TR/css-device-adapt/
[CSS21]
Bert Bos; Tantek Çelik; Ian Hickson; Håkon Wium Lie et al. Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification. 7 June 2011. W3C Recommendation. URL: http://www.w3.org/TR/CSS2
[CSS3-2D-TRANSFORMS]
Simon Fraser; Dean Jackson; David Hyatt; Chris Marrin; Edward O'Connor. CSS 2D Transforms. 15 December 2011. W3C Working Draft. URL: http://www.w3.org/TR/css3-2d-transforms/
[CSS3-3D-TRANSFORMS]
Dean Jackson; David Hyatt; Chris Marrin. CSS 3D Transforms Module Level 3. 20 March 2009. W3C Working Draft. URL: http://www.w3.org/TR/css3-3d-transforms
[CSS3-BOX]
Bert Bos. CSS basic box model. 9 August 2007. W3C Working Draft. URL: http://www.w3.org/TR/css3-box
[CSS3-DISPLAY]
Tab Atkins Jr.; Elika Etemad. CSS Display Module Level 3. 15 October 2015. W3C Working Draft. URL: http://www.w3.org/TR/css-display-3/
[CSS3-VALUES]
Tab Atkins Jr.; Elika Etemad. CSS Values and Units Module Level 3. 11 June 2015. W3C Candidate Recommendation. URL: http://www.w3.org/TR/css-values/
[CSSOM]
Simon Pieters; Glenn Adams. CSS Object Model (CSSOM). 5 December 2013. W3C Working Draft. URL: http://www.w3.org/TR/cssom/
[CSSOM-VIEW]
Simon Pieters; Glenn Adams. CSSOM View Module. 17 December 2013. W3C Working Draft. URL: http://www.w3.org/TR/cssom-view/
[DOM]
Anne van Kesteren; Aryeh Gregor; Ms2ger; Alex Russell; Robin Berjon. W3C DOM4. 6 October 2015. W3C Proposed Recommendation. URL: http://www.w3.org/TR/dom/
[DOM-LEVEL-3-XPATH]
Ray Whitmer. Document Object Model (DOM) Level 3 XPath Specification. 26 February 2004. W3C Note. URL: http://www.w3.org/TR/DOM-Level-3-XPath/
[DOM-PARSING]
Travis Leithead. DOM Parsing and Serialization. 17 June 2014. W3C Candidate Recommendation. URL: http://www.w3.org/TR/DOM-Parsing/
[ECMA-262]
ECMAScript Language Specification. URL: https://tc39.github.io/ecma262/
[EDITING]
HTML Editing APIs, A. Gregor. W3C Editing APIs CG.
[FETCH]
Anne van Kesteren. Fetch Standard. Living Standard. URL: https://fetch.spec.whatwg.org/
[GEOMETRY-1]
Simon Pieters; Dirk Schulze; Rik Cabanier. Geometry Interfaces Module Level 1. 25 November 2014. W3C Candidate Recommendation. URL: http://www.w3.org/TR/geometry-1/
[HTML]
Ian Hickson. HTML Standard. Living Standard. URL: https://html.spec.whatwg.org/multipage/
[RFC2119]
S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://tools.ietf.org/html/rfc2119
[RFC2397]
L. Masinter. The "data" URL scheme. August 1998. Proposed Standard. URL: https://tools.ietf.org/html/rfc2397
[RFC4122]
P. Leach; M. Mealling; R. Salz. A Universally Unique IDentifier (UUID) URN Namespace. July 2005. Proposed Standard. URL: https://tools.ietf.org/html/rfc4122
[RFC4632]
V. Fuller; T. Li. Classless Inter-domain Routing (CIDR): The Internet Address Assignment and Aggregation Plan. August 2006. Best Current Practice. URL: https://tools.ietf.org/html/rfc4632
[RFC6265]
A. Barth. HTTP State Management Mechanism. April 2011. Proposed Standard. URL: https://tools.ietf.org/html/rfc6265
[RFC7230]
R. Fielding, Ed.; J. Reschke, Ed.. Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing. June 2014. Proposed Standard. URL: https://tools.ietf.org/html/rfc7230
[SELECTORS-API]
Anne van Kesteren; Lachlan Hunt. Selectors API Level 1. 21 February 2013. W3C Recommendation. URL: http://www.w3.org/TR/selectors-api/
[URI-TEMPLATE]
J. Gregorio; R. Fielding; M. Hadley; M. Nottingham; D. Orchard. URI Template. March 2012. Proposed Standard. URL: https://tools.ietf.org/html/rfc6570
[URL]
Anne van Kesteren; Sam Ruby. URL. 9 December 2014. W3C Working Draft. URL: http://www.w3.org/TR/url-1/
[WEBIDL]
Cameron McCormack; Boris Zbarsky. WebIDL Level 1. 4 August 2015. W3C Working Draft. URL: http://www.w3.org/TR/WebIDL-1/
[XPATH]
James Clark; Steven DeRose. XML Path Language (XPath) Version 1.0. 16 November 1999. W3C Recommendation. URL: http://www.w3.org/TR/xpath
[html51]
Simon Pieters; Anne van Kesteren; Philip Jägenstedt; Domenic Denicola; Ian Hickson; Steve Faulkner; Travis Leithead; Erika Doyle Navara; Edward O'Connor; Robin Berjon. HTML 5.1. 8 October 2015. W3C Working Draft. URL: http://www.w3.org/TR/html51/