Movatterモバイル変換


[0]ホーム

URL:


W3C

WebDriver

W3C Editor's Draft

More details about this document
This version:
https://w3c.github.io/webdriver/
Latest published version:
https://www.w3.org/TR/webdriver2/
Latest editor's draft:
https://w3c.github.io/webdriver/
History:
https://www.w3.org/standards/history/webdriver2/
Commit history
Test suite:
https://wpt.live/webdriver/
Implementation report:
https://wpt.fyi/results/webdriver
Editors:
Simon Stewart (Apple)
David Burns (BrowserStack)
Feedback:
GitHub w3c/webdriver (pull requests,new issue,open issues)
Channel
#webdriver on irc.w3.org

Copyright © 2025World Wide Web Consortium.W3C®liability,trademark andpermissive document license rules apply.


Abstract

WebDriver is a remote control interfacethat enables introspection and control of user agents.It provides a platform- and language-neutral wire protocolas a way for out-of-process programsto remotely instruct the behavior of web browsers.

Provided is a set of interfacesto discover and manipulate DOM elements in web documentsand to control the behavior of a user agent.It is primarily intended to allow web authors to write teststhat automate a user agent from a separate controlling process,but may also be used in such a way as to allow in-browser scriptsto control a — possibly separate — browser.

Status of This Document

This section describes the status of this document at the time of its publication. A list of currentW3C publications and the latest revision of this technical report can be found in theW3C standards and drafts index.

This document was published by theBrowser Testing and Tools Working Group as an Editor's Draft.

Publication as an Editor's Draft does not imply endorsement byW3C and its Members.

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 a work in progress.

This document was produced by a group operating under theW3C Patent Policy.W3C maintains apublic 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 that the individual believes containsEssential Claim(s) must disclose the information in accordance withsection 6 of theW3C Patent Policy.

This document is governed by the18 August 2025W3C Process Document.

1.Design

This section is non-normative.

The WebDriver standard attempts to follow a number of design goals:

1.1Compatibility

This specification is derived from the popularSelenium WebDriver browser automation framework.Selenium is a long-lived project,and due to its age and breadth of useit has a wide range of expected functionality.This specification uses these expectations to inform its design.Where improvements or clarifications have been made,they have been made with care to allow existing users of Selenium WebDriverto avoid unexpected breakages.

1.2Simplicity

The largest intended group of users of this specificationare software developers and testerswriting automated tests and other tooling,such as monitoring or load testing, that relies on automating a browser.As such, care has been taken to provide commandsthat simplify common tasks such astyping intoandclicking elements.

1.3Extensions

WebDriver provides a mechanism for others to define extensions to the protocolfor the purposes of automating functionality that cannot be implemented entirelyinECMAScript. This allows otherweb standards to support the automation of new platform features. It alsoallows vendors to expose functionality that is specific to their browser.

2.Conformance

As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.

Conformance requirements phrased as algorithmsor specific steps may be implemented in any manner,so long as the end result is equivalent.Algorithms in this document are typically written with readability,rather than performance, in mind.

3.Terminology

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

The mathematical functionmin(value,value[,value])returns the smallest item of two or more values.Conversely, the functionmax(value,value[,value])returns the largest item of two or more values.

The mathematical functionfloor(value)produces the largest integer, closest to positive infinity,that is not larger thanvalue.

AUniversally Unique Identifier (UUID)is a 128 bits long URN that requires no central registration process.Generating a UUID meansCreating a UUID From Truly Random or Pseudo-Random Numbers,and converting it to the string representation.[RFC4122]

TheUnix Epochis a value that approximates the number of secondsthat have elapsed since the Epoch,as described by The Open Group Base Specifications Issue 7section 4.15 (IEEE Std 1003.1).

Aninteger is aNumber that is unchangedunder theToInteger operation.

Theinitial value of an ECMAScript propertyis the value defined by the platform for that property,i.e. the value it would have in the absence of any shadowing by content script.

Thebrowser chrome is a non-normative termto refer to the representation through which the userinteracts with the user agent itself,as distinct from the accessed web content.Examples ofbrowser chrome elementsinclude, but are not limited to,toolbars (such as the bookmark toolbar),menus (such as the file or context menu),buttons (such as the back and forward buttons),door hangers (such as security and certificate indicators),and decorations (such as operating system widget borders).

MDNNavigator/webdriver

This feature is in all major engines.

Chrome63+
Chrome Android?
Edge12+
Edge Mobile?
Firefox60+
Firefox Android?
Opera?
Opera Android?
Safari10.1+
Safari iOS?
Samsung Internet?
WebView Android?

4.Interface

Thewebdriver-active flagis set to true when the user agent is under remote control.It is initially false.

WebIDLinterface mixinNavigatorAutomationInformation {  readonly attributebooleanwebdriver;};Navigator includesNavigatorAutomationInformation;
Note

TheNavigatorAutomationInformation interfaceshould not be exposed onWorkerNavigator.

webdriver

Returns true ifwebdriver-active flag is set, false otherwise.

Example 1

For web authors (non-normative):

navigator.webdriver

Defines a standard way for co-operating user agentsto inform the document that it is controlled by WebDriver,for example so that alternate code paths can be triggered during automation.

It is acknowledged that this is complementary to the Evil Bit [RFC3514].

5.Nodes

The WebDriver protocol consists of communication between:

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 WebDriverprotocol. This specification does not place any restrictions on the details of those libraries above the level of the wire protocol.

Remote end
The remote end hosts the server side of theprotocol. Defining the behavior of aremote end in response to the WebDriver protocol forms the largest part of this specification.

Forremote ends the standard defines two broad conformance classes, known asnode types:

Intermediary node
Intermediary nodes are those that act as proxies, implementing both thelocal end andremote end of theprotocol. However they are not expected to implementremote end steps directly. Nodes between a specificintermediary node and anendpoint node are said to beupstream of theendpoint node.
Endpoint node
An endpoint node is the finalremote end in a chain of nodes that is not anintermediary node. The endpoint node is implemented by a user agent or a similar program.

All remote endnode types must be black-box indistinguishable from aremote end, from the point of view oflocal end, and so are bound by the requirements on aremote end in terms of the wire protocol.

Thereadiness state of aremote end indicateswhether it is free to accept new connections. It must be false if theimplementation is anendpoint node and the list ofactiveHTTP sessions is not empty, or otherwise if theremote end is known tobe in a state in which attempting to createnew sessions wouldfail. In all other cases it must be true.

If theintermediary node is a multiplexer that manages multipleendpoint nodes, this might indicate its ability to purvey moresessions, for example if it has hit its maximum capacity.

6.Protocol

WebDriverremote ends must provide anHTTP compliant wire protocol where theendpoints map to differentcommands.

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

6.1Algorithms

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 optimized for readability rather than performance.

Where algorithms that return values are fallible, they are written in terms of returning eithersuccess orerror. Asuccess value has an associateddata field which encapsulates the value returned, whereas anerror value has an associatederror code.

When calling a fallible algorithm, the construct “Letresult be the result oftrying to callalgorithm” is equivalent to

  1. Lettemp be the result of callingalgorithm.

  2. Iftemp is anerror returntemp, otherwise letresult betemp'sdata field.

The result ofgetting a property withname fromobject is defined as being the same as the result of callingObject.[[GetOwnProperty]](name) onobject.

The result ofgetting a property with default with argumentsname anddefault fromobject is defined as being the same as the result of callingObject.[[GetOwnProperty]](name) onobject if that results in a value other thanundefined anddefault otherwise.

Setting a property with argumentsname andvalue onobject is defined as being the same as callingObject.[[Put]](name,value) onobject.

The result ofJSON serialization withobject of type JSONObject is defined as the result of callingstringify(object).

The result ofJSON deserialization withtext is defined as the result of callingparse(text).

6.2Commands

The WebDriver protocol is organized intocommands.EachHTTP request with a method and template defined in this specificationrepresents a singlecommand,and therefore each command produces a singleHTTP response.

In response to acommand,aremote end will run a series of actionsknown asremote end steps.These provide the sequences of actions that aremote end takeswhen it receives a particularcommand.

6.3Processing model

Theremote end is an HTTP server reading requests from the client and writing responses, typically over a TCP socket. For the purposes of this specification we model the data transmission between a particularlocal end andremote end with aconnection to which theremote end maywrite bytes andread bytes. However the exact details of how thisconnection works and how it is established are out of scope.

After aconnection is established, theremote end must runthe following steps:

  1. While theconnection is not closed:

    1. Read bytes from theconnection until a completeHTTP request can be constructed from the data. Letrequest be arequest constructed from the received data, according to the requirements of [RFC7230]. If it is not possible to construct a completeHTTP request, theremote end must either close theconnection, return an HTTP response with status code 500, or return anerror witherror codeunknown error.

    2. Letrequest match be the result of the algorithm tomatch a request withrequest'smethod andURL as arguments.

    3. Ifrequest match is of typeerror,send an error withrequest match'serror code andcontinue.

      Otherwise, letcommand andURL variables berequest match's data.

    4. Letsession be null.

    5. IfURL variablescontains "session id":

      Note

      This condition is intended to exclude theNew Session andStatuscommands and anyextension commands which do not operate on a particularsession.

      1. Letsession id beURL variables["session id"].

      2. For eachactive session in the list ofactive sessions:

        1. Ifactive session'ssession ID is equal tosession id, then letsession beactive session, and break.

      3. If thesession isnullsend an error witherror codeinvalid session id, thencontinue.

    6. Enqueue a task onremote end'srequest queue to run the following steps:

      1. Ifsession is no longer in the list ofactive sessions, thensend an error witherror codeinvalid session id and return.
      2. Letparameters benull.

      3. Ifrequest'smethod is POST:

        1. Letparse result be the result ofparsing as JSON withrequest'sbody as the argument. If this process throws an exception, return anerror witherror codeinvalid argument and jump back to step 1 in this overall algorithm.

        2. Ifparse result is not anObject,send an error witherror codeinvalid argument and jump back to step 1 in this overall algorithm.

          Otherwise, letparameters beparse result.

      4. Letnavigate result be the result ofwait for navigation to complete withsession.

      5. Ifnavigate result is anerror,send an error witherror code equal tonavigate result'serror code and return.

      6. Letresponse result be the return value obtained by running theremote end steps forcommand withsession,URL variables, andparameters.

      7. Ifresponse result is anerror,send an error witherror code equal toresponse result'serror code and return.

      8. Assert:response result is asuccess.

      9. Letresponse data beresponse result's data.

      10. Send a response with status 200 andresponse data.

When required tosend an error, witherror code and an optionalerror data dictionary, aremote end must run the following steps:

  1. Letstatus andname be theerror response data forerror code.

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

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

    Letbody be a new JSONObject initialized with the following properties:

    "error"
    name
    "message"
    message
    "stacktrace"
    stacktrace
  4. If theerror data dictionary contains any entries, set the "data" field onbody to a new JSONObject populated with the dictionary.

  5. Send a response withstatus andbody as arguments.

When required tosend a response, with argumentsstatus anddata, aremote end must run the following steps:

  1. Letresponse be a newresponse.

  2. Setresponse'sHTTP status tostatus, andstatus message to the string corresponding to the description ofstatus in thestatus code registry.

  3. Set theresponse'sheader withname andvalue with the following values:

    Content-Type
    "application/json; charset=utf-8"
    Cache-Control
    "no-cache"
  4. Letresponse'sbody be theUTF-8 encodedJSON serialization of a JSONObject with a key "value" set todata.

  5. Letresponse bytes be the byte sequence resulting from serializingresponse according to the rules in [RFC7230].

  6. Writeresponse bytes to theconnection.

6.4Routing requests

Request routing is the process of going from anHTTP request to theseries of steps needed to implement thecommand represented by that request.

Aremote end has an associatedURL prefix, which is used as a prefix on all WebDriver-defined URLs on thatremote end. This must either beundefined or apath-absolute URL.

Example 2

For example aremote end wishing to run alongside other services onexample.com might set itsURL prefix to/wd so that anew sessioncommand would be invoked by sending a POST request to/wd/session, rather than/session.

In order tomatch a request given amethod andURL, the following steps must be taken:

  1. Letendpoints be a list containing each row in thetable of endpoints.

  2. Remove each entry fromendpoints for which the concatenation of theURL prefix and the entry'sURI template does not have a valid expansion equal toURL'spath.

  3. If there are no entries inendpoints, returnerror witherror codeunknown command.

  4. Remove each entry inendpoints for which themethod column is not equal tomethod.

  5. If there are no entries inendpoints, returnerror witherror codeunknown method.

  6. There is now exactly one entry inendpoints; letentry be this entry.

  7. LetURI template be the concatenation ofURL prefix withentry'sURI template.

  8. Letcommand beentry'scommand.

  9. LetURL variables be amap with oneentry for each variable defined inURI template, with the entry name equal to the template variable name, and the entry value being the variable value required to expand theURI template to matchURL'spath.

  10. Returnsuccess with datacommand andURL variables.

6.5Endpoints

The followingtable of endpoints lists themethod andURI template for eachendpoint nodecommand.Extension commands are implicitly appended to this table.

MethodURI TemplateCommand
POST/sessionNew Session
DELETE/session/{session id}Delete Session
GET/statusStatus
GET/session/{session id}/timeoutsGet Timeouts
POST/session/{session id}/timeoutsSet Timeouts
POST/session/{session id}/urlNavigate To
GET/session/{session id}/urlGet Current URL
POST/session/{session id}/backBack
POST/session/{session id}/forwardForward
POST/session/{session id}/refreshRefresh
GET/session/{session id}/titleGet Title
GET/session/{session id}/windowGet Window Handle
DELETE/session/{session id}/windowClose Window
POST/session/{session id}/windowSwitch To Window
GET/session/{session id}/window/handlesGet Window Handles
POST/session/{session id}/window/newNew Window
POST/session/{session id}/frameSwitch To Frame
POST/session/{session id}/frame/parentSwitch To Parent Frame
GET/session/{session id}/window/rectGet Window Rect
POST/session/{session id}/window/rectSet Window Rect
POST/session/{session id}/window/maximizeMaximize Window
POST/session/{session id}/window/minimizeMinimize Window
POST/session/{session id}/window/fullscreenFullscreen Window
GET/session/{session id}/element/activeGet Active Element
GET/session/{session id}/element/{element id}/shadowGet Element Shadow Root
POST/session/{session id}/elementFind Element
POST/session/{session id}/elementsFind Elements
POST/session/{session id}/element/{element id}/elementFind Element From Element
POST/session/{session id}/element/{element id}/elementsFind Elements From Element
POST/session/{session id}/shadow/{shadow id}/elementFind Element From Shadow Root
POST/session/{session id}/shadow/{shadow id}/elementsFind Elements From Shadow Root
GET/session/{session id}/element/{element id}/selectedIs 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}/textGet Element Text
GET/session/{session id}/element/{element id}/nameGet Element Tag Name
GET/session/{session id}/element/{element id}/rectGet Element Rect
GET/session/{session id}/element/{element id}/enabledIs Element Enabled
GET/session/{session id}/element/{element id}/computedroleGet Computed Role
GET/session/{session id}/element/{element id}/computedlabelGet Computed Label
POST/session/{session id}/element/{element id}/clickElement Click
POST/session/{session id}/element/{element id}/clearElement Clear
POST/session/{session id}/element/{element id}/valueElement Send Keys
GET/session/{session id}/sourceGet Page Source
POST/session/{session id}/execute/syncExecute Script
POST/session/{session id}/execute/asyncExecute Async Script
GET/session/{session id}/cookieGet All Cookies
GET/session/{session id}/cookie/{name}Get Named Cookie
POST/session/{session id}/cookieAdd Cookie
DELETE/session/{session id}/cookie/{name}Delete Cookie
DELETE/session/{session id}/cookieDelete All Cookies
POST/session/{session id}/actionsPerform Actions
DELETE/session/{session id}/actionsRelease Actions
POST/session/{session id}/alert/dismissDismiss Alert
POST/session/{session id}/alert/acceptAccept Alert
GET/session/{session id}/alert/textGet Alert Text
POST/session/{session id}/alert/textSend Alert Text
GET/session/{session id}/screenshotTake Screenshot
GET/session/{session id}/element/{element id}/screenshotTake Element Screenshot
POST/session/{session id}/printPrint Page

6.6Errors

Errors are represented in the WebDriver protocol by anHTTP response with anHTTP status in the 4xx or 5xx range, and a JSON body containing details of theerror. The body is a JSONObject and has a field named "value" whose value is an object bearing three, and sometimes four, fields:

Example 3

AGET request to/session/1234/url, where1234 is not thesession id of asession would return anHTTP response with the status 404 and a body of the form:

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

Certain commands may also annotateerrors with additionalerror data. Notably, this is the case for commands which invoke theuser prompt handler, where theuser prompt message may be included in a "text" field:

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

The following table lists eacherror code, its associatedHTTP status, JSONerror code, and a non-normative description of the error. Theerror response data for a particularerror code is the values of theHTTP Status andJSON Error Code columns for the row corresponding to thaterror code.

Error CodeHTTP StatusJSON Error CodeDescription
element click intercepted400element click interceptedTheElement Clickcommand could not be completed because theelement receiving the events isobscuring the element that was requested clicked.
element not interactable400element not interactableAcommand could not be completed because the element is notpointer- orkeyboardinteractable.
insecure certificate400insecure certificateNavigation caused the user agent to hit a certificate warning, which is usually the result of an expired or invalid TLS certificate.
invalid argument400invalid argumentThe arguments passed to acommand are either invalid or malformed.
invalid cookie domain400invalid cookie domainAn illegal attempt was made to set a cookie under a different domain than the current page.
invalid element state400invalid element stateAcommand could not be completed because the element is in an invalid state, e.g. attempting toclear an element that isn't botheditable andresettable.
invalid selector400invalid selectorArgument was an invalid selector.
invalid session id404invalid session idOccurs if the givensession id is not in the list ofactive sessions, meaning thesession either does not exist or that it's not active.
javascript error500javascript errorAn error occurred while executing JavaScript supplied by the user.
move target out of bounds500move target out of boundsThe target for mouse interaction is not in the browser's viewport and cannot be brought into that viewport.
no such alert404no such alertAn attempt was made to operate on a modal dialog when one was not open.
no such cookie404no such cookieNo cookie matching the given path name was found amongst theassociated cookies ofsession'scurrent browsing context'sactive document.
no such element404no such elementAn element could not be located on the page using the given search parameters.
no such frame404no such frameAcommand to switch to a frame could not be satisfied because the frame could not be found.
no such window404no such windowAcommand to switch to a window could not be satisfied because the window could not be found.
no such shadow root404no such shadow rootThe element does not have a shadow root.
script timeout error500script timeoutA script did not complete before its timeout expired.
session not created500session not createdA newsession could not be created.
stale element reference404stale element referenceAcommand failed because the referencedelement is no longer attached to the DOM.
detached shadow root404detached shadow rootAcommand failed because the referencedshadow root is no longer attached to the DOM.
timeout500timeoutAn operation did not complete before its timeout expired.
unable to set cookie500unable to set cookieAcommand to set a cookie's value could not be satisfied.
unable to capture screen500unable to capture screenA screen capture was made impossible.
unexpected alert open500unexpected alert openA modal dialog was open, blocking this operation.
unknown command404unknown commandAcommand could not be executed because theremote end is not aware of it.
unknown error500unknown errorAn unknown error occurred in theremote end while processing thecommand.
unknown method405unknown methodThe requestedcommand matched a known URL but did not match any method for that URL.
unsupported operation500unsupported operationIndicates that acommand that should have executed properly cannot be supported for some reason.

Anerror data dictionary is a mapping of string keys to JSON serializable values that can optionally be included witherror objects.

6.7Extensions

Using the terminology defined in this section, others may define additional commands that seamlessly integrate with the standard protocol. This allows vendors to expose functionality that is specific to their user agent, and it also allows other web standards to define commands for automating new platform features.

Commands defined in this way are calledextension commands and behave no differently than othercommands; each has a dedicated HTTP endpoint and a set ofremote end steps.

Eachextension command has an associatedextension command URI Template that is aURI Template string, and which should bear some resemblance to what the command performs. This value, along with the HTTP method andextension command, is added to thetable of endpoints and thus follows the same rules forrequest routing as that of other built-incommands.

In order to avoid potential resource conflicts with other implementations, vendor-specificextension command URI Templates must begin with one or more path segments which uniquely identifies the vendor and UA. It is suggested that vendors use their vendor prefixes without additional characters as outlined in [CSS21], notably insection 4.1.2.2 onvendor keywords, as the name for this path element, and include a vendor-chosen UA identifier.

Note
If theextension command URI Template includes a variable namedsession id, the value of this variable will be used to define thesession during command processing.
Example 4

This might lead to a URL of the form/session/5d376174-36f0-11e5-9b9a-6bdf200a3f7f/ms/edge/context, wheresession/{session id} associates the request with the specified session,ms/edge identifies the command as specific to the Edge browser distributed by Microsoft, andcontext describes the functionality that, in the context of Edge, allows alocal end to switch between browser-specific contexts. Requesting this URL will call theextension command'sremote end steps.

Other specifications may defineadditional WebDriver capabilities. Each definedcapability must have acapability name whichis a string not containing a ":" (colon) character,anadditional capability deserializationalgorithm which is a set of steps taking a singleargumentvalue which has a JSON type, returningeithersuccess wrapping the deserialized capability valueorerror.

Anadditional WebDriver capability may also defineamatched capability serialization algorithm,which is a set of steps used to determine if a capability is matchedby the current implementation and provide any computed value to returnto the user. This set of steps takes a singleargumentvalue, which is the output of thecorrespondingadditional capability deserialization algorithm,and returns eithernull to indicate the capabilityis not matched, or a non-null JSON-serializable value if thecapability is matched.

Other specifications may also defineWebDrivernew session algorithms, which are called just after a newsession is created, and before thenew session response is sentto theremote end. These algorithms are calledwithsession representing the WebDriver session that willbe established, andcapabilities, the capabilities object that will be returnedto theremote end. It is permitted for such an algorithm tomodify any entry in the capabilities object with a name that's anadditional WebDriver capability defined by the samespecification.

Remote ends may also introduceextension capabilities that are extracapabilities used to provide configuration or fulfill other vendor-specific needs. Extension capabilities' key must contain a ":" (colon) character, denoting an implementation specific namespace. The value can be arbitrary JSON types.

As withextension commands, it is suggested that the key used to denote theextension capability namespace is based on thevendor keywords listed in [CSS21] and precedes the first ":" character in the string.

Example 5

Extension capabilities are typically used to provide UA orintermediary node specific configuration that is not handled by thetable of standard capabilities.

An examplenew session request body might look like this:

{"capabilities":{"alwaysMatch":{// browser specific configuration"<prefix>:browserOptions":{"binary":"/usr/bin/browser-binary","args":["--start-page=https://example.com"],}}}}

7.Capabilities

WebDrivercapabilities are used to communicate the features supported by a given implementation. Thelocal end may use capabilities to define which features it requires theremote end to satisfy when creating anew session. Likewise, theremote end uses capabilities to describe the full feature set for asession.

The followingtable of standard capabilities enumerates the capabilities each implementation must support. An implementation may define additionalextension capabilities.

Example 6

As an example, Mozilla could elect to hide new features behind capabilitieswith a "moz:" prefix:

{"browserName":"firefox","browserVersion":"1234","moz:experimental-webdriver":true}
CapabilityKeyValue TypeDescription
Browser name"browserName"stringIdentifies the user agent.
Browser version"browserVersion"stringIdentifies the version of the user agent.
Platform name"platformName"stringIdentifies the operating system of theendpoint node.
Accept insecure TLS certificates"acceptInsecureCerts"booleanIndicates whether untrusted and self-signed TLS certificates are implicitly trusted onnavigation for the duration of thesession.
Page load strategy"pageLoadStrategy"stringDefines thesession'spage load strategy.
Proxy configuration"proxy"JSONObjectDefines thesession'sproxy configuration.
Window dimensioning/positioning"setWindowRect"booleanIndicates whether the remote end supports all of theresizing and repositioningcommands.
Session timeouts"timeouts"JSONObjectDescribes thetimeouts imposed on certain session operations.
Strict file interactability"strictFileInteractability"booleanDefines thesession'sstrict file interactability.
Unhandled prompt behavior"unhandledPromptBehavior"stringDescribes thesession'suser prompt handler. Defaults to "dismiss and notify".
User Agent"userAgent"stringIdentifies thedefault User-Agent value of theendpoint node.

7.1Proxy

Theproxy configuration capability is a JSONObject nested within the primarycapabilities. Implementations may define additional proxy configuration options, but they must not alter the semantics of those listed below.

KeyValue TypeDescriptionValid values
proxyTypestringIndicates the type of proxy configuration."pac", "direct", "autodetect", "system", or "manual".
proxyAutoconfigUrlstringDefines the URL for aproxy autoconfiguration file ifproxyType is equal to "pac".AnyURL.
httpProxystringDefines the proxyhost for HTTP traffic when theproxyType is "manual".Ahost and optional port for scheme "http".
noProxyarrayLists the address for which the proxy should be bypassed when theproxyType is "manual".AList containing any number ofStrings.
sslProxystringDefines the proxyhost for encrypted TLS traffic when theproxyType is "manual".Ahost and optional port for scheme "https".
socksProxystringDefines the proxyhost for aSOCKS proxy when theproxyType is "manual".Ahost and optional port with anundefined scheme.
socksVersionnumberDefines theSOCKS proxy version when theproxyType is "manual".Anyinteger between 0 and 255 inclusive.

Ahost and optional port for ascheme is defined as being a validhost, optionally followed by a colon and a validport. Thehost mayinclude credentials. If the port is omitted andscheme has adefault port, this is the implied port. Otherwise, the port is left undefined.

AproxyType of "direct" indicates that the browser should not use a proxy at all.

AproxyType of "system" indicates that the browser should use the various proxies configured for the underlying Operating System.

AproxyType of "autodetect" indicates that the proxy to use should be detected in an implementation-specific way.

Theremote end steps todeserialize as a proxy argumentparameter are:

  1. Ifparameter is not a JSONObject return anerror witherror codeinvalid argument.

  2. Letproxy be a new, emptyproxy configuration object.

  3. For each enumerableown property inparameter run the following substeps:

    1. Letkey be the name of the property.

    2. Letvalue be the result ofgetting a property namedname fromparameter.

    3. If there is no matchingkey forkey in theproxy configuration table return anerror witherror codeinvalid argument.

    4. Ifvalue is not one of thevalid values for thatkey, return anerror witherror codeinvalid argument.

    5. Set a propertykey tovalue onproxy.

  4. Ifproxy does not have anown property for "proxyType" return anerror witherror codeinvalid argument.

  5. If the result ofgetting a property named "proxyType" fromproxy equals "pac", andproxy does not have anown property for "proxyAutoconfigUrl" return anerror witherror codeinvalid argument.

  6. Ifproxy has anown property for "socksProxy" and does not have anown property for "socksVersion" return anerror witherror codeinvalid argument.

  7. Returnsuccess with dataproxy.

Aproxy configuration object is a JSONObject where each of itsown properties matching keys in theproxy configuration meets the validity criteria for that key.

7.2Processing capabilities

Toprocess capabilities givenparameters, andsession configuration flagsflags, theendpoint node must take the following steps:

  1. Letcapabilities request be the result ofgetting the property "capabilities" fromparameters.

    1. Ifcapabilities request is not a JSONObject, returnerror witherror codeinvalid argument.

  2. Letrequired capabilities be the result ofgetting the property "alwaysMatch" fromcapabilities request.

    1. Ifrequired capabilities isundefined, set the value to an empty JSONObject.

    2. Letrequired capabilities be the result oftrying tovalidate capabilities with argumentsrequired capabilities andflag.

  3. Letall first match capabilities be the result ofgetting the property "firstMatch" fromcapabilities request.

    1. Ifall first match capabilities isundefined, set the value to aList with a single entry of an empty JSONObject.

    2. Ifall first match capabilities is not aList with one or more entries, returnerror witherror codeinvalid argument.

  4. Letvalidated first match capabilities be an emptyList.

  5. For eachfirst match capabilities corresponding to an indexed property inall first match capabilities:

    1. Letvalidated capabilities be the result oftrying tovalidate capabilities with argumentsfirst match capabilities andflags.

    2. Appendvalidated capabilities tovalidated first match capabilities.

  6. Letmerged capabilities be an emptyList.

  7. For eachfirst match capabilities corresponding to an indexed property invalidated first match capabilities:

    1. Letmerged be the result oftrying tomerge capabilities withrequired capabilities andfirst match capabilities as arguments.

    2. Appendmerged tomerged capabilities.

  8. For eachcapabilities corresponding to an indexed property inmerged capabilities:

    1. Letmatched capabilities be the result oftrying tomatch capabilities withcapabilities as an argument.

    2. Ifmatched capabilities is notnull, returnsuccess with datamatched capabilities.

  9. Returnsuccess with datanull.

When required tovalidate capabilities with argumentcapabilities:

  1. Ifcapabilities is not a JSONObject return anerror witherror codeinvalid argument.

  2. Letresult be an empty JSONObject.

  3. For each enumerableown property incapabilities, run the following substeps:

    1. Letname be the name of the property.

    2. Letvalue be the result ofgetting a property namedname fromcapabilities.

    3. Run the substeps of the first matching condition:

      value isnull

      Letdeserialized be set tonull.

      name equals "acceptInsecureCerts"

      Ifvalue is not aboolean return anerror witherror codeinvalid argument. Otherwise, letdeserialized be set tovalue.

      name equals "browserName"
      name equals "browserVersion"
      name equals "platformName"

      Ifvalue is not astring return anerror witherror codeinvalid argument. Otherwise, letdeserialized be set tovalue.

      name equals "pageLoadStrategy"

      Letdeserialized be the result oftrying todeserialize as a page load strategy with argumentvalue.

      name equals "proxy"

      Letdeserialized be the result oftrying todeserialize as a proxy with argumentvalue.

      name equals "strictFileInteractability"

      Ifvalue is not aboolean return anerror witherror codeinvalid argument. Otherwise, letdeserialized be set tovalue

      name equals "timeouts"

      Letdeserialized be the result oftrying todeserialize as timeouts configuration withvalue.

      name equals "unhandledPromptBehavior"

      Letdeserialized be the result oftrying todeserialize as an unhandled prompt behavior with argumentvalue.

      name is the name of anadditional WebDriver capability

      Letdeserialized be the result oftrying to run theadditional capability deserialization algorithm for the extension capability corresponding toname, with argumentvalue.

      name is the key of anextension capability

      Ifname is known to the implementation, letdeserialized be the result oftrying to deserializevalue in an implementation-specific way. Otherwise, letdeserialized be set tovalue.

      Theremote end is anendpoint node

      Return anerror witherror codeinvalid argument.

    4. Ifdeserialized is notnull,set a property onresult with namename and valuedeserialized.

  4. Returnsuccess with dataresult.

Whenmerging capabilities with JSONObject argumentsprimary andsecondary, anendpoint node must take the following steps:

  1. Letresult be a new JSONObject.

  2. For each enumerableown property inprimary, run the following substeps:

    1. Letname be the name of the property.

    2. Letvalue be the result ofgetting a property namedname fromprimary.

    3. Set a property onresult with namename and valuevalue.
  3. Ifsecondary isundefined, returnresult.

  4. For each enumerableown property insecondary, run the following substeps:

    1. Letname be the name of the property.

    2. Letvalue be the result ofgetting a property namedname fromsecondary.

    3. Letprimary value be the result ofgetting the propertyname fromprimary.

    4. Ifprimary value is notundefined, return anerror witherror codeinvalid argument.

    5. Set a property onresult with namename and valuevalue.
  5. Returnresult.

Note

The algorithm outlined inmatching capabilities blithely ignores real-world problems that make implementation less than perfectly straightforward, particularly since capabilities can interact in unforeseen ways.

As an example, an implementation could have a capability that gives the path to the browser binary to use. This could cause bothbrowserName andbrowserVersion to be impossible to match against until the browser process is started.

Whenmatching capabilities given JSONObjectcapabilities, and asession configuration flagsflags, anendpoint node must take the following steps:

  1. Letmatched capabilities be a JSONObject with the following entries:

    "browserName"
    ASCII Lowercase name of the user agent as astring.
    "browserVersion"
    The user agent version, as astring.
    "platformName"
    ASCII Lowercase name of the current platform as astring.
    "acceptInsecureCerts"
    Boolean initially set to false, indicating the session will not implicitly trust untrusted or self-signed TLS certificates onnavigation.
    "strictFileInteractability"
    Boolean initially set to false, indicating that interactability checks will be applied to <input type=file>.
    "setWindowRect"
    Boolean indicating whether theremote end supports all of theresizing and positioningcommands.
    "userAgent"
    String containing thedefault User-Agent value.
  2. Ifflags contains "http", add the following entries tomatched capabilities:

    "strictFileInteractability"
    Boolean initially set to false, indicating that interactabilty checks will be applied to <input type=file>.
  3. Optionally addextension capabilities as entries tomatched capabilities. The values of these may be elided, and there is no requirement that allextension capabilities be added.

    Note

    This allows aremote end to add information that might be useful to alocal end without unnecessarily bloating the response sent back to the user with (e.g.) an entire browser profile.

    For example, an implementation could choose to indicate that a screenshot will be taken when returning an error by setting the capabilityse:screenshot-on-error totrue.

  4. For eachname andvalue corresponding tocapabilities'sown properties:

    1. Letmatch value equalvalue.

    2. Run the substeps of the first matchingname:

      "browserName"

      Ifvalue is not a string equal to the "browserName" entry inmatched capabilities, returnsuccess with datanull.

      Note

      There is a chance theremote end will need to start a browser process to correctly determine thebrowserName. Lightweight checks are preferred before this is done.

      "browserVersion"

      Comparevalue to the "browserVersion" entry inmatched capabilities using an implementation-defined comparison algorithm. The comparison is to accept avalue that places constraints on the version using the "<", "<=", ">", and ">=" operators.

      If the two values do not match, returnsuccess with datanull.

      Note

      Version comparison is left as an implementation detail since each user agent will likely have conflicting methods of encoding the user agent version, and standardizing these schemes is beyond the scope of this standard.

      Note

      There is a chance theremote end will need to start a browser process to correctly determine thebrowserVersion. Lightweight checks are preferred before this is done.

      "platformName"

      Ifvalue is not a string equal to the "platformName" entry inmatched capabilities, returnsuccess with datanull.

      Note

      The following platform names are in common usage with well-understood semantics and, whenmatching capabilities forplatform name, greatest interoperability can be achieved by honoring them as valid synonyms for well-known Operating Systems:

      KeySystem
      "linux"Any server or desktop system based upon the Linux kernel.
      "mac"Any version of Apple's macOS.
      "windows"Any version of Microsoft Windows, including desktop and mobile versions.

      This list is not exhaustive.

      When returningcapabilities fromNew Session, it is valid to return a more specificplatformName, allowing users to correctly identify the Operating System the WebDriver implementation is running on.

      "acceptInsecureCerts"

      Ifaccept insecure TLS flag is set and not equal tovalue, returnsuccess with datanull.

      Note

      If theendpoint node does not supportinsecure TLS certificates and this is the reason no match is ultimately made, it is useful to provide this information to thelocal end.

      "proxy"

      If thehas proxy configuration flag is set, or if the proxy configuration defined invalue is not one that passes theendpoint node's implementation-specific validity checks, returnsuccess with datanull.

      Note

      Alocal end would only send this capability if it expected it to be honored and the configured proxy used. The intent is that if this is not possible a new session will not be established.

      "unhandledPromptBehavior"

      Ifcheck user prompt handler matches withvalue is false, returnsuccess with datanull.

      Otherwise
    3. Ifmatch value is not null,set a property onmatched capabilities with namename and valuematch value.

  5. Returnsuccess with datamatched capabilities.

8.Sessions

A WebDriversession represents the logical connection between alocal end and a specificremote end. Thesession object holds state specific to that connection.

Anintermediary node will maintain anassociated session for each activesession. This is thesession on theupstream neighbor that is created when theintermediary node executes theNew Sessioncommand. Closing asession on anintermediary node will alsoclose the session of theassociated session.

Asession has asession ID, which is the string representation of aUUID used to uniquely identify the session. This is set when creating the session.

Asession has a booleanHTTP flag which is setwhen the session is created. A session with this flag set isanHTTP session.

Aremote end has an associated list ofactive sessions, which is a list of allsessions that are currently started.

Aremote end has an associated list ofactive HTTP sessions, which is a list of allHTTP sessions that are currently started.

Note

The limitation of a single HTTP session forendpointnodes means that the first entry in the list ofactive HTTPsessions will be the only entry.

AHTTP session has an associatedcurrent browsing context, which is thebrowsing context against whichcommands will run, an associatedcurrent parent browsing context, which is set to the parent of thecurrent browsing context when changing browsing contexts, and an associatedcurrent top-level browsing context, which is set to the top-browsing context ancestor of thecurrent browsing context, when changing browsing contexts.

AnHTTP session has an associatedsessiontimeouts which is atimeouts configuration. This isinitially set to a newtimeouts configuration.

AnHTTP session has an associatedpage loadingstrategy, which is one of the keywords from thetable of pageload strategies. This is initially set tonormal.

AnHTTP session has an associatedstrict fileinteractability state which is a boolean. This is initially setto false.

Asession has an associatedbrowsing context inputstate map, which is aweak map withtop-level browsingcontexts as keys, andinput state objects as values. Thisis initially set to an empty map.

AnHTTP session has an associatedrequest queue which is aqueue ofrequests that are currently awaitingprocessing.

When a session is created, aset ofsession configurationflags are provided that define the features of the session. Thisspecification always creates sessions with "http"insession configuration flags, which corresponds totheHTTP flag. External specifications may define additionalflags, or create sessions without theHTTP flag.

8.1Global State

In addition to per-session state, aremote end that isanendpoint node also has additional state that is globalacross all sessions.

Anendpoint node has an associatedaccept insecure TLS flag that indicates whether untrusted or self-signed TLS certificates are treated as trusted. The default value of the flag is false if the endpoint doesn't support accepting insecure TLS connections, or unset otherwise.

Anendpoint node has an associatedhas proxy configuration flag that indicates whether the proxy is already configured. The default value of the flag is true if the endpoint doesn't support proxy configuration, or false otherwise.

Tocreate a session, given a JSONObjectcapabilites, andsession configurationflagsflags:

  1. Letsession id be the result ofgenerating a UUID.

  2. Letsession be a newsession withsession IDsession id, andHTTP flagflags contains "http".

  3. Letproxy be the result of getting property "proxy" fromcapabilities and run the substeps of the first matching statement:

    proxy is aproxy configuration object

    Take implementation-defined steps to set the user agent proxy using the extractedproxy configuration. If the defined proxy cannot be configured returnerror witherror codesession not created. Otherwise set thehas proxy configuration flag to true.

    Otherwise
    Set a property ofcapabilities with name "proxy" and a value that is a new JSONObject.
  4. Ifcapabilites has a property named "acceptInsecureCerts", set theendpoint node'saccept insecure TLS flag to the result ofgetting a property named "acceptInsecureCerts" fromcapabilities.

  5. Letuser prompt handler capability be the result of getting property "unhandledPromptBehavior" fromcapabilities.

  6. Ifuser prompt handler capability is not undefined,update the user prompt handler withuser prompt handler capability.

  7. Letserialized user prompt handler beserialize the user prompt handler.

  8. Set a property oncapabilities with the name "unhandledPromptBehavior", and the valueserialized user prompt handler.

  9. Ifflagscontains "http":

    1. Letstrategy be the result of getting property "pageLoadStrategy" fromcapabilities.

      Ifstrategy is a string, set thesession'spage loading strategy tostrategy. Otherwise, set thepage loading strategy tonormal andset a property ofcapabilities with name "pageLoadStrategy" and value "normal".

    2. LetstrictFileInteractability be the result of getting property "strictFileInteractability" fromcapabilities. IfstrictFileInteractability is a boolean, setsession'sstrict file interactability tostrictFileInteractability.

    3. Lettimeouts be the result of getting a property "timeouts" fromcapabilities. Iftimeouts is not undefined, setsession'ssession timeouts totimeouts.

    4. Set a property oncapabilities with name "timeouts" and valueserialize the timeouts configuration withsession'ssession timeouts.

  10. Process anyextension capabilities incapabilities in an implementation-defined manner.

  11. Run anyWebDriver new session algorithm defined in external specifications, with argumentssession,capabilities, andflags.

  12. Appendsession toactive sessions.

  13. Ifflags contains "http", appendsession toactive HTTP sessions.

  14. Set thewebdriver-active flag to true.

Toclose the session, givensession aremote end must take the following steps:

  1. Ifsession'sHTTP flag is set, removesession fromactive HTTP sessions.

  2. Removesession fromactive sessions.

  3. Perform the following substeps based on theremote end's type:

    Remote end is anendpoint node
    1. If the list ofactive sessions is empty:

      1. Set thewebdriver-active flag to false

      2. Set theuser prompt handler to null.

      3. Unset theaccept insecure TLS flag.

      4. Reset thehas proxy configuration flag to its default value.

      5. Optionally,close alltop-level browsing contexts, withoutprompting to unload.

    Remote end is anintermediary node
    1. Close theassociated session. If this causes anerror to occur, complete the remainder of this algorithm before returning theerror.

  4. Perform any implementation-specific cleanup steps.

  5. If anerror has occurred in any of the steps above, return theerror, otherwise returnsuccess with datanull.

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

8.2New Session

HTTP MethodURI Template
POST/session

TheNew Sessioncommandcreates a new WebDriversession with theendpoint node.If the creation fails, asession not createderror is returned.

If theremote end is anintermediary node, it may use the result of thecapabilities processing algorithm to route thenew session request to the appropriateendpoint node. Anintermediary node is free to defineextension capabilities to assist in this process, however, these specific capabilities must not be forwarded to theendpoint node.

If theintermediary node requires additional information unrelated to user agent features, it is recommended that this information be passed as top-level parameters, and not as part of the requestedcapabilities. Anintermediary node must forward custom, top-level parameters (i.e. non-capabilities) to subsequentremote end nodes.

Example 7

Anintermediary node might require authentication oncreating a new session. This authentication is an argument to theNew Session command itself and not the user agent'scapabilities. Therefore, the authentication should be passed as a top-level parameter and not embedded incapabilities:

{"user":"alice","password":"hunter2","capabilities": {…}}

However, because anintermediary node cannot forwardextension capabilities specific to that implementation to anendpoint node, the following is also permitted by this specification:

{"capabilities":{"alwaysMatch":{"cloud:user":"alice","cloud:password":"hunter2","platformName":"linux"},"firstMatch":[{"browserName":"chrome"},{"browserName":"edge"}]}}

Once allcapabilities are merged from this example, anendpoint node would receiveNew Session capabilities identical to:

[{"browserName":"chrome","platformName":"linux"},{"browserName":"edge","platformName":"linux"}]

Theremote end steps, givensession,URLvariables andparameters are:

  1. If the implementation is anendpoint node, and the list ofactive HTTP sessions is not empty, or otherwise if the implementation is unable to start an additional session, returnerror witherror codesession not created.

  2. If theremote end is anintermediary node, take implementation-defined steps that either result in returning anerror witherror codesession not created, or in returning asuccess with data that is isomorphic to that returned byremote ends according to the rest of this algorithm. If anerror is not returned, theintermediary node must retain a reference to thesession created on theupstream node as theassociated session such that commands may be forwarded to thisassociated session on subsequent commands.

    Note

    How this is done is entirely up to the implementation, but typically thesessionId, andURL andURL prefix of theupstreamremote end will need to be tracked.

  3. Letflags be a set containing "http".

  4. Letcapabilities be the result oftrying toprocess capabilities withparameters andflags.

  5. Ifcapabilities's isnull, returnerror witherror codesession not created.

  6. Letsession be the result ofcreate a session, withcapabilities, andflags.

  7. Letbody be a JSONObject initialized with:

    "sessionId"
    session'ssession ID.
    "capabilities"
    capabilities
  8. Setsession'current top-level browsing context to one of theendpoint node'stop-level browsing contexts, preferring thetop-level browsing context that hassystem focus, or otherwise preferring anytop-level browsing context whosevisibility state isvisible.

    Note

    WebDriver implementations typically start a completely new browser instance, but there is no requirement in this specification (or for WebDriver only to be used to automate only web browsers). Implementations might choose to use an existing browser instance, eg. by selecting the window that currently has focus.

  9. Set therequest queue to a newqueue.

  10. Returnsuccess with databody.

8.3Delete Session

HTTP MethodURI Template
DELETE/session/{session id}

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession is anactive HTTP session,try toclose the session withsession.

  2. Returnsuccess with datanull.

8.4Status

HTTP MethodURI Template
GET/status
Note

Status returns information about whether aremote end is in a state in which it can createnew sessions, but may additionally include arbitrary meta information that is specific to the implementation.

Theremote end'sreadiness state is represented by theready property of the body, which is false if an attempt tocreate a session at the current time would fail. However, the value true does not guarantee that aNew Session command will succeed.

Implementations may optionally include additional meta information as part of the body, but the top-level propertiesready andmessage are reserved and must not be overwritten.

Theremote end steps, givensession,URLvariables andparameters are:

  1. Letbody be a new JSONObject with the following properties:

    "ready"

    Theremote end'sreadiness state.

    "message"

    An implementation-defined string explaining theremote end'sreadiness state.

  2. Returnsuccess with databody.

9.Timeouts

Atimer is astruct. It hasatimeout fired flag, which is aboolean, initially false.

Tostart the timer giventimer andtimeout

  1. Assert:timeout is not null.

  2. Run the following stepsin parallel:

    1. Wait for at leasttimeout milliseconds to pass.

    2. Settimer'stimeout fired flag to true.

Atimeouts configuration is astruct representingthe timeouts forscript evaluation,navigation, andelementretrieval. It has ascripttimeoutitem which is an integer or null and isinitially set to 30,000, apage loadtimeoutitem which is an integer or null and isinitially set to 300,000, and animplicitwait timeoutitem which is an integer or null and isinitially set to 0.Todeserialize as timeouts configuration giventimeouts:

  1. Settimeouts to the result ofconverting a JSON-derived JavaScript value to an Infra value withtimeouts.

  2. Letconfiguration be a newtimeouts configuration.

  3. For eachkeyvalue intimeouts:

    1. If «"script", "pageLoad", "implicit"» does notcontainkey, then continue.

    2. Ifvalue is neither null nor a number greater than or equal to 0 and less than or equal to themaximum safe integer returnerror witherror codeinvalid argument.

    3. Run the substeps matchingkey:

      "script"

      Setconfiguration'sscript timeout tovalue.

      "pageLoad"

      Setconfiguration'spage load timeout tovalue.

      "implicit"

      Setconfiguration'simplicit wait timeout tovalue.

  4. Returnsuccess with dataconfiguration.

Toserialize the timeouts configurationgiventimeouts:
  1. Letserialized be an emptymap.

  2. Setserialized["script"] totimeouts'script timeout.

  3. Setserialized["pageLoad"] totimeouts'page load timeout.

  4. Setserialized["implicit"] totimeouts'implicit wait timeout.

  5. Returnconvert an Infra value to a JSON-compatible JavaScript value withserialized.

MDNCommands/GetTimeouts
Chrome65+
Chrome AndroidNo
Edge?
Edge Mobile?
Firefox55+
Firefox AndroidNo
OperaNo
Opera Android?
SafariNo
Safari iOS?
Samsung InternetNo
WebView Android?

9.1Get Timeouts

HTTP MethodURI Template
GET/session/{session id}/timeouts

Theremote end steps, givensession,URLvariables andparameters are:

  1. Lettimeouts beserialize the timeouts configuration withsession'stimeouts configuration

  2. Returnsuccess with datatimeouts.

MDNCommands/SetTimeouts
Chrome65+
Chrome AndroidNo
Edge?
Edge Mobile?
Firefox55+
Firefox AndroidNo
OperaNo
Opera Android?
SafariNo
Safari iOS?
Samsung InternetNo
WebView Android?

9.2Set Timeouts

HTTP MethodURI Template
POST/session/{session id}/timeouts

Theremote end steps, givensession,URLvariables andparameters are:

  1. Lettimeouts be the result oftrying todeserialize as timeouts configuration withparameters.

  2. Setsession'stimeouts configuration totimeouts.

  3. Returnsuccess with datanull.

10.Navigation

Thecommands in this section allow navigation of thesession'scurrent top-level browsing context to new URLs and introspection of the document currently loaded in thisbrowsing context.

Forcommands that cause a new document to load, the point at which the command returns is determined by the session'spage loading strategy. Thenormal state causes it to return after theloadevent fires on the new page,eager causes it to return after theDOMContentLoadedevent fires, andnone causes it to return immediately.

Navigation actions are also affected by the value of thepage load timeout, which determines the maximum time that commands will block before returning with atimeouterror.

The following is thetable of page load strategies that links thepageLoadStrategycapability keyword to apage loading strategy state, and shows whichdocument readiness state that corresponds to it:

KeywordPage load strategy stateDocument readiness state
"none"none
"eager"eager"interactive"
"normal"normal"complete"

When asked todeserialize as a page load strategy with argumentvalue:

  1. Ifvalue is not astring return anerror witherror codeinvalid argument.

  2. If there is no entry in thetable of page load strategies withkeywordvalue return anerror witherror codeinvalid argument.

  3. Returnsuccess with datavalue.

Towait for navigation to complete, givensession and optionaltimer (default null):

  1. Ifsession'spage loading strategy isnone, returnsuccess with datanull.

  2. Ifsession'scurrent browsing context isno longer open, returnsuccess with datanull.

  3. Lettimeout besession timeouts'page load timeout.

  4. Iftimer is null:

    1. Settimer to a newtimer.

    2. Iftimeout is not null:

      1. Start the timer withtimer andtimeout.

  5. Run these steps, butabort whentimer'stimeout fired flag is set:

    1. If there is an ongoing attempt tonavigatesession'scurrent browsing context that has not yetmatured, wait for navigation tomature.

    2. Letreadiness target be thedocument readiness state associated with thesession'spage loading strategy, which can be found in thetable of page load strategies.

    3. Wait forsession'scurrent browsing context'sdocument readiness state to reachreadiness target.

  6. If aborted return anerror witherror codetimeout.

  7. Returnsuccess with datanull.

When asked to run thepost-navigation checks, run the substeps of the first matching statement:

response is a network error

Returnerror witherror codeunknown error.

Note

A "network error" in this case is not an HTTP response with a status code indicating an unsuccessful result, but could be a problem occurring lower in the OSI model, or a failed DNS lookup.

response isblocked by content security policy

If theremote end'saccept insecure TLS state is true, take implementation specific steps to ensure the navigation is not aborted and that the untrusted or invalid TLS certificate error that would normally occur under these circumstances, are suppressed.

Otherwise returnerror witherror codeinsecure certificate.

response'sHTTP status is 401
Otherwise

Irrespective of how a possible authentication challenge is handled, returnsuccess with datanull.

10.1Navigate To

HTTP MethodURI Template
POST/session/{session id}/url
Note

The command causes the user agent tonavigate thesession'scurrent top-level browsing context to a new location.

If theremote end'saccept insecure TLS flag is true, no certificate errors that would normally cause the user agent to abort and show a security warning are to hinder navigation to the requested address.

Example 8

To navigate thecurrent top-level browsing context of thesession with ID1 tohttps://example.com, thelocal end would POST to/session/1/url with the body:

{"url":"https://example.com"}

Theremote end steps, givensession,URLvariables andparameters are:

  1. LetURL be the result ofgetting a property named "url" fromparameters.

  2. Ifsession'scurrent top-level browsing context isno longer open, returnerror witherror codeno such window.

  3. IfURL is not anabsolute URL or is not anabsolute URL with fragment or not alocal scheme, returnerror witherror codeinvalid argument.

  4. Try tohandle any user prompts withsession.

  5. Lettimeout besession'ssession timeoutspage load timeout.

  6. Letcurrent URL besession'scurrent top-level browsing context'sactive document'sURL.

  7. Ifcurrent URL andURL do not have the sameabsolute URL andtimeout is not null:

    1. Settimer to a newtimer.

    2. Start the timer withtimer andtimeout.

  8. Run these steps, butabort whentimer'stimeout fired flag is set:

    1. Navigatesession'scurrent top-level browsing context toURL.

    2. IfURLis special except forfile andcurrent URL andURL do not have the sameabsolute URL :

      1. Try towait for navigation to complete withsession andtimer.

      2. Try to run thepost-navigation checks.

    3. Set the current browsing context withsession andcurrent top-level browsing context.

    4. Whilesession'scurrent top-level browsing context contains arefresh state pragma directive oftime 1 second or less, run the following steps:

      1. Setcurrent URL tosession'scurrent top-level browsing context'sactive document'sURL.

      2. Wait until the refresh timeout has elapsed and newnavigate ofsession'scurrent top-level browsing context has begun.

      3. SetURL to the destination URL ofsession'scurrent top-level browsing context'sactive document's ongoing navigation.

      4. IfURLis special except forfile andcurrent URL andURL do not have the sameabsolute URL :

        1. Try towait for navigation to complete withsession andtimer.

        2. Try to run thepost-navigation checks.

  9. If aborted return anerror witherror codetimeout.

  10. Returnsuccess with datanull.

10.2Get Current URL

HTTP MethodURI Template
GET/session/{session id}/url

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent top-level browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. LetURL be theserialization ofsession'scurrent top-level browsing context'sactive document'sURL.

  4. Returnsuccess with dataURL.

10.3Back

HTTP MethodURI Template
POST/session/{session id}/back
Note

This command causes the browser to traverse one step backward in thejoint session history ofsession'scurrent top-level browsing context. This is equivalent to pressing the back button in thebrowser chrome or invokingwindow.history.back.

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent top-level browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. Lettimeout besession'session timeoutspage load timeout.

  4. Lettimer be a newtimer.

  5. Iftimeout is not null:

    1. Start the timer withtimer andtimeout.

  6. Traverse the history by a delta –1 forsession'scurrent browsing context.

  7. If the previous step completed results in apageHideevent firing, wait untilpageShowevent fires ortimer'timeout fired flag to be set, whichever occurs first.

  8. Iftimer'timeout fired flag is set:

    1. Handle any user prompts.

    2. Returnerror witherror codetimeout.

  9. Returnsuccess with datanull.

10.4Forward

HTTP MethodURI Template
POST/session/{session id}/forward
Note

This command causes the browser to traverse one step forwards in thejoint session history ofsession'scurrent top-level browsing context. This is equivalent to pressing the forward button in thebrowser chrome or invokingwindow.history.forward.

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent top-level browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. Lettimeout besession'session timeoutspage load timeout.

  4. Lettimer be a newtimer.

  5. Iftimeout is not null:

    1. Start the timer withtimer andtimeout.

  6. Traverse the history by a delta 1 forsession'scurrent browsing context.

  7. If the previous step completed results in apageHideevent firing, wait untilpageShowevent fires ortimer'timeout fired flag to be set, whichever occurs first.

  8. Iftimer'timeout fired flag is set:

    1. Handle any user prompts.

    2. Returnerror witherror codetimeout.

  9. Returnsuccess with datanull.

10.5Refresh

HTTP MethodURI Template
POST/session/{session id}/refresh
Note

This command causes the browser to reload the page insession'scurrent top-level browsing context.

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent top-level browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. Initiatean overridden reload ofsession'scurrent top-level browsing context'sactive document.

  4. IfURLis special except forfile:

    1. Try towait for navigation to complete withsession.

    2. Try to run thepost-navigation checks.

  5. Set the current browsing context withsession andsession'scurrent top-level browsing context.

  6. Returnsuccess with datanull.

10.6Get Title

HTTP MethodURI Template
GET/session/{session id}/title
Note

This command returns the document title ofsession'scurrent top-level browsing context, equivalent to callingdocument.title.

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent top-level browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. Lettitle be thesession'scurrent top-level browsing context'sactive document'stitle.

  4. Returnsuccess with datatitle.

11.Contexts

Many WebDrivercommands happen in the context of eithersession'scurrent browsing context orcurrent top-level browsing context.session'scurrent top-level browsing context is represented in the protocol by its associatedwindow handle. When atop-level browsing context is selected using theSwitch To Window command, a specificbrowsing context can be selected using theSwitch to Frame command.

Note

The use of the term “window” to refer to atop-level browsing context is legacy and doesn't correspond with either the operating system notion of a “window” or the DOMWindow object.

Abrowsing context is said to beno longer open if itsnavigable has been destroyed.

Eachbrowsing context has an associatedwindow handle which uniquely identifies it. This must be aString and must not be "current".

Aweb frame is an abstraction used to identify aframe oriframe when it is transported via theprotocol, betweenremote andlocal ends.

Theweb frame identifier is the string constant "frame-075b-4da1-b6ba-e579c2d3230a".

An ECMAScriptObjectrepresents a web frame if it has aweb frame identifierown property.

Aweb window is an abstraction used to identify awindow when it is transported via theprotocol, betweenremote andlocal ends.

Theweb window identifier is the string constant "window-fcc6-11e5-b4f8-330a88ab9d7f".

An ECMAScriptObjectrepresents a web window if it has aweb window identifierown property.

TheWindowProxy reference object withWindowProxy objectwindow is given by:

  1. Letidentifier be theweb window identifier if the associatedbrowsing context ofwindow is atop-level browsing context.

    Otherwise let it be theweb frame identifier.

  2. Return a JSONObject initialized with the following properties:

    identifier

    Associatedwindow handle of thewindow'sbrowsing context.

Todeserialize a web frame by a JSONObjectobject thatrepresents a web frame:

  1. Ifobject has noown propertyweb frame identifier, returnerror witherror codeinvalid argument.

  2. Letreference be the result ofgetting theweb frame identifier property fromobject.

  3. Ifreference is not aString, return anerror witherror codeinvalid argument.

  4. Letbrowsing context be thebrowsing context whosewindow handle isreference, or null if no suchbrowsing context exists.

  5. Ifbrowsing context is null or atop-level browsing context, returnerror witherror codeno such frame.

  6. Returnsuccess with databrowsing context's associated window.

Todeserialize a web window by a JSONObjectobject thatrepresents a web window:

  1. Ifobject has noown propertyweb window identifier, returnerror witherror codeinvalid argument.

  2. Letreference be the result ofgetting theweb window identifier property fromobject.

  3. Ifreference is not aString, return anerror witherror codeinvalid argument.

  4. Letbrowsing context be thebrowsing context whosewindow handle isreference, or null if no suchbrowsing context exists.

  5. Ifbrowsing context is null or not atop-level browsing context, returnerror witherror codeno such window.

  6. Returnsuccess with databrowsing context's associated window.

When required toset the current browsing context givensession andcontext, an implementation must follow the following steps:

  1. Setsession'scurrent browsing context tocontext.

  2. Set thesession'scurrent parent browsing context to theparent browsing context ofcontext, if that context exists, ornull otherwise.

When required toset the current top-level browsing context givensession andcontext, an implementation must:

  1. Assert:context is atop-level browsing context.

  2. Setsession'scurrent top-level browsing context tocontext.

  3. Set the current browsing context withsession andcontext.

Note

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

11.1Get Window Handle

HTTP MethodURI Template
GET/session/{session id}/window

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent top-level browsing context isno longer open, returnerror witherror codeno such window.

  2. Returnsuccess with data being thewindow handle associated withsession'scurrent top-level browsing context.

MDNCommands/CloseWindow
Chrome65+
Chrome AndroidNo
Edge?
Edge Mobile?
Firefox55+
Firefox AndroidNo
OperaNo
Opera Android?
SafariNo
Safari iOS?
Samsung InternetNo
WebView Android?

11.2Close Window

HTTP MethodURI Template
DELETE/session/{session id}/window

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent top-level browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. Closesession'scurrent top-level browsing context.

  4. If there are no more opentop-level browsing contexts, thentry toclose the session.

  5. Return the result of running theremote end steps for theGet Window Handlescommand, withsession,URL variables andparameters.

11.3Switch To Window

HTTP MethodURI Template
POST/session/{session id}/window
Note

Switching window will selectsession'scurrent top-levelbrowsing context used as the target for allsubsequentcommands. In a tabbed browser, this will typicallymake the tab containing thebrowsing context the selected tab.

Theremote end steps, givensession,URLvariables andparameters are:

  1. Lethandle be the result ofgetting the property "handle" fromparameters.

  2. Ifhandle isundefined, returnerror witherror codeinvalid argument.

  3. If there is an activeuser prompt, that prevents the focusing of anothertop-level browsing context, returnerror witherror codeunexpected alert open.

  4. Ifhandle is equal to the associatedwindow handle for sometop-level browsing context, letcontext be the that browsing context, andset the current top-level browsing context withsession andcontext.

    Otherwise, returnerror witherror codeno such window.

  5. Update any implementation-specific state that would result from the user selectingsession'scurrent browsing context for interaction, without altering OS-level focus.

  6. Returnsuccess with datanull.

MDNCommands/GetWindowHandles
Chrome65+
Chrome AndroidNo
Edge?
Edge Mobile?
Firefox55+
Firefox AndroidNo
OperaNo
Opera Android?
SafariNo
Safari iOS?
Samsung InternetNo
WebView Android?

11.4Get Window Handles

HTTP MethodURI Template
GET/session/{session id}/window/handles

The order in which the window handles are returned is arbitrary.

Theremote end steps, givensession,URLvariables andparameters are:

  1. Lethandles be aList.

  2. For eachtop-level browsing context in theremote end, push the associatedwindow handle ontohandles.

  3. Returnsuccess with datahandles.
Example 9

In order to determine whether or not a particular interaction with the browser opens a new window, one can obtain the set of window handles before the interaction is performed and compare it with the set after the action is performed.

MDN🚫Commands/New_Window

This feature has limited support.

ChromeNo
Chrome Android?
Edge?
Edge Mobile?
Firefox66+
Firefox Android?
Opera?
Opera Android?
SafariNo
Safari iOS?
Samsung InternetNo
WebView Android?

11.5New Window

HTTP MethodURI Template
POST/session/{session id}/window/new

Create a newtop-level browsing context.

Theremote end steps, givensession,URLvariables andparameters are:

  1. If the implementation does not support creating new top-level browsing contexts, returnerror witherror codeunsupported operation.

  2. Ifsession'scurrent top-level browsing context isno longer open, returnerror witherror codeno such window.

  3. Try tohandle any user prompts withsession.

  4. Lettype hint be the result ofgetting the property "type" fromparameters.

  5. Create a newtop-level browsing context by running thewindow open steps withURL set to "about:blank",target set to the empty string, andfeatures set to "noopener" and the user agent configured to create a new browsing context. This must be done without invoking thefocusing steps for the created browsing context. Iftype hint has the value "tab", and the implementation supports multiple browsing context in the same OS window, the new browsing context should share an OS window withsession'scurrent browsing context. Iftype hint is "window", and the implementation supports multiple browsing contexts in separate OS windows, the created browsing context should be in a new OS window. In all other cases the details of how the browsing context is presented to the user are implementation defined.

  6. Lethandle be the associatedwindow handle of the newly created window.

  7. Lettype be "tab" if the newly created window shares an OS-level window withsession'scurrent browsing context, or "window" otherwise.

  8. Letresult be a new JSONObject initialized with:

    "handle"
    The value ofhandle.
    "type"
    The value oftype.
  9. Returnsuccess with dataresult.

11.6Switch To Frame

HTTP MethodURI Template
POST/session/{session id}/frame
Note

TheSwitch To Frame command is used to selectsession'scurrent top-level browsing context or achild browsing context ofsession'scurrent browsing context to use assession'scurrent browsing context for subsequentcommands.Theremote end steps, givensession,URLvariables andparameters are:

  1. Letid be the result ofgetting the property "id" fromparameters.

  2. Ifid is notnull, aNumber object, or anObject thatrepresents a web element, returnerror witherror codeinvalid argument.

  3. Run the substeps of the first matching condition:

    id isnull
    1. Ifsession'scurrent top-level browsing context isno longer open, returnerror witherror codeno such window.

    2. Try tohandle any user prompts withsession.

    3. Set the current browsing context withsession andsession'scurrent top-level browsing context.

    id is aNumber object
    1. Ifid is less than 0 or greater than 216 – 1, returnerror witherror codeinvalid argument.

    2. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

    3. Try tohandle any user prompts withsession.

    4. Letwindow be theassociated window ofsession'scurrent browsing context'sactive document.

    5. Ifid is not asupported property index ofwindow, returnerror witherror codeno such frame.

    6. Letchild window be theWindowProxy object obtained by callingwindow.[[GetOwnProperty]] (id).

    7. Set the current browsing context withsession andchild window'sbrowsing context.

    idrepresents a web element
    1. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

    2. Try tohandle any user prompts withsession.

    3. Letelement be the result oftrying toget a known element withsession andid.

    4. Ifelement is not aframe oriframe element, returnerror witherror codeno such frame.

    5. Set the current browsing context withsession andelement'scontent navigable'sactive browsing context.

  4. Update any implementation-specific state that would result from the user selectingsession'scurrent browsing context for interaction, without altering OS-level focus.

  5. Returnsuccess with datanull.

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.

11.7Switch To Parent Frame

HTTP MethodURI Template
POST/session/{session id}/frame/parent
Note

TheSwitch to Parent Framecommand setssession'scurrent browsing context for futurecommands to the parent ofsession'scurrent browsing context.

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent browsing context is already thetop-level browsing context:

    1. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

    2. Returnsuccess with datanull.

  2. Ifsession'scurrent parent browsing context isno longer open, returnerror witherror codeno such window.

  3. Try tohandle any user prompts withsession.

  4. Ifsession'scurrent parent browsing context is notnull,set the current browsing context withsession andcurrent parent browsing context.

  5. Update any implementation-specific state that would result from the user selectingsession'scurrent browsing context for interaction, without altering OS-level focus.

  6. Returnsuccess with datanull.

11.8Resizing and positioning windows

WebDriver providescommands for interacting with the operating system window containingsession'scurrent top-level browsing context. Because different operating systems' window managers provide different abilities, not all of the commands in this section can be supported by allremote ends. Support for thesecommands is determined by thewindow dimensioning/positioningcapability. Where acommand is not supported, anunsupported operationerror is returned.

Thetop-level browsing context has an associatedwindow state which describes what visibility state its OS widget window is in. It can be in one of the following states:

StateKeywordDefaultDescription
Maximized window state"maximized"The window is maximized.
Minimized window state"minimized"The window is iconified.
Normal window state"normal"The window is shown normally.
Fullscreen window state"fullscreen"The window is in full screen mode.

If for whatever reason thetop-level browsing context'sOS window cannot enter either of thewindow states, or if thisconcept is not applicable on the current system, the default statemust benormal.

TheWindowRect object foraWindowProxy,window is anObject initializedwith the following properties:

"x"

window'sscreenX attribute.

"y"

window'sscreenY attribute.

"width"

windows'souterWidth attribute.

"height"

window'souterHeight attribute.

Tomaximize the window, given an operating system level window with an associatedtop-level browsing context, run the implementation-specific steps to transition the operating system level window into themaximized window state. If the window manager supports window resizing but does not have a concept of window maximization, the window dimensions must be increased to the maximum available size permitted by the window manager for the current screen. Return when the window has completed the transition, or within an implementation-defined timeout.

Toiconify the window, given an operating system level window with an associatedtop-level browsing context, run implementation-specific steps to transition the operating system level window into theminimized window state. Do not return from this operation until thevisibility state of thetop-level browsing context'sactive document has reached thehidden state, or until the operation times out.

Torestore the window, given an operating system level window with an associatedtop-level browsing context, run implementation-specific steps to restore or unhide the window to the visible screen. Do not return from this operation until thevisibility state of thetop-level browsing context'sactive document has reached thevisible state, or until the operation times out.

MDNCommands/GetWindowRect
Chrome65+
Chrome AndroidNo
Edge?
Edge Mobile?
Firefox55+
Firefox AndroidNo
OperaNo
Opera Android?
SafariNo
Safari iOS?
Samsung InternetNo
WebView Android?

11.8.1Get Window Rect

HTTP MethodURI Template
GET/session/{session id}/window/rect
Note

TheGet Window Rectcommand returns the size and position on the screen of the operating system window corresponding tosession'scurrent top-level browsing context.

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent top-level browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. Returnsuccess with data set to theWindowRect object for thesession'scurrent top-level browsing context.

MDNCommands/SetWindowRect
Chrome65+
Chrome AndroidNo
Edge?
Edge Mobile?
Firefox55+
Firefox AndroidNo
OperaNo
Opera Android?
SafariNo
Safari iOS?
Samsung InternetNo
WebView Android?

11.8.2Set Window Rect

HTTP MethodURI Template
POST/session/{session id}/window/rect
Note

TheSet Window Rectcommandalters the size and the position of the operating system windowcorresponding tosession'scurrent top-level browsing context.

Theremote end steps, givensession,URLvariables andparameters are:

  1. Letwidth be the result ofgetting a property named "width" fromparameters.

  2. Ifwidth isundefined, letwidth be null.

  3. Letheight be the result ofgetting a property named "height" fromparameters.

  4. Ifheight isundefined, letheight be null.

  5. Letx be the result ofgetting a property named "x" fromparameters.

  6. Ifx isundefined, letx be null.

  7. Lety be the result ofgetting a property named "y" fromparameters.

  8. Ify isundefined, lety be null.

  9. Ifwidth orheight is neither null, nor aNumber from 0 to 231 − 1, returnerror witherror codeinvalid argument.

  10. Ifx ory is neither null, nor aNumber from −(231) to 231 − 1, returnerror witherror codeinvalid argument.

  11. If theremote end does not support theSet Window Rectcommand forsession'scurrent top-level browsing context for any reason, returnerror witherror codeunsupported operation.

    Note

    In case theSet Window Rect command is partially supported (i.e. some combinations of arguments are supported but not others), the implmentation is expected to continue with the remaining steps.

  12. Ifsession'scurrent top-level browsing context isno longer open, returnerror witherror codeno such window.

  13. Try tohandle any user prompts withsession.

  14. Fully exit fullscreen.

  15. Restore the window.

  16. Letwindow be the operating system window containingsession'scurrent top-level browsing context

  17. If the implementation is able to set the dimensions ofwindow:

    1. Ifwidth is not null, set the width, inCSS pixels, ofwindow, including anybrowser chrome and externally drawn window decorations, to a value that is as close as possible towidth.

    2. Ifheight is not null, set the height, inCSS pixels, ofwindow, including anybrowser chrome and externally drawn window decorations, to a value that is as close as possible toheight.

  18. If the implementation is able to set the position ofwindow:

    1. Ifx is not null, set the x-coordinate of the left edge ofwindow to a value that is as close as possible tox.

    2. Ify is not null, set the y-coordinate of the top edge ofwindow to a value that is as close as possible toy.

    Note

    The specification does not guarantee that the resulting window position will match that which was requested.

    This step is similar to calling themoveTo(x, y) method on theWindowProxy object associated withsession'scurrent top-level browsing context, but without thesecurity restrictions that you

    1. cannot move a window or tab that was not created bywindow.open.
    2. cannot move a window or tab when it is in a window with more than one tab.
  19. Returnsuccess with data set to theWindowRect object for thesession'scurrent top-level browsing context.

11.8.3Maximize Window

HTTP MethodURI Template
POST/session/{session id}/window/maximize
Note

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

Theremote end steps, givensession,URLvariables andparameters are:

  1. If theremote end does not support theMaximize Window command forsession'scurrent top-level browsing context for any reason, returnerror witherror codeunsupported operation.

  2. Ifsession'scurrent top-level browsing context isno longer open, returnerror witherror codeno such window.

  3. Try tohandle any user prompts withsession.

  4. Fully exit fullscreen.

  5. Restore the window.

  6. Maximize the window ofsession'scurrent top-level browsing context.

  7. Returnsuccess with data set to theWindowRect object for thesession'scurrent top-level browsing context.

11.8.4Minimize Window

HTTP MethodURI Template
POST/session/{session id}/window/minimize
Note

TheMinimize Window command invokes the window manager-specific “minimize” operation, if any, on the window containingsession'scurrent top-level browsing context. This typically hides the window in the system tray.

Theremote end steps, givensession,URLvariables andparameters are:

  1. If theremote end does not support theMinimize Window command forsession'scurrent top-level browsing context for any reason, returnerror witherror codeunsupported operation.

  2. Ifsession'scurrent top-level browsing context isno longer open, returnerror witherror codeno such window.

  3. Try tohandle any user prompts withsession.

  4. Fully exit fullscreen.

  5. Iconify the window.

  6. Returnsuccess with data set to theWindowRect object for thesession'scurrent top-level browsing context.

11.8.5Fullscreen Window

HTTP MethodURI Template
POST/session/{session id}/window/fullscreen

Theremote end steps, givensession,URLvariables andparameters are:

  1. If theremote end does notsupport fullscreen returnerror witherror codeunsupported operation.

  2. Ifsession'scurrent top-level browsing context isno longer open, returnerror witherror codeno such window.

  3. Try tohandle any user prompts withsession.

  4. Restore the window.

  5. Callfullscreen an element withsession'scurrent top-level browsing context'sactive document'sdocument element.

    Note

    The window is now in theFullscreen window state.

  6. Returnsuccess with data set to theWindowRect object for thesession'scurrent top-level browsing context.

12.Elements

Aweb element is an abstraction used to identify anelement when it is transported via theprotocol, betweenremote andlocal ends.

Theweb element identifier is the string constant "element-6066-11e4-a52e-4f735466cecf".

An ECMAScriptObjectrepresents a web element if it has aweb element identifierown property.

TheWebDriver node id is a globally unique stringrepresenting a handle to a DOM node in a specificWebDriversession.

Aweak map is amap in which keys are heldweakly i.e. items are removed if the key object is garbaged collected, andpresence in the map does not prevent garbage collection. This acts as analternative to defining properties directly on the key objects.

Note

Unlike the ECMAScriptWeakMap,aweak map can participate in the full set of operations available fora Map.

A WebDriversession has abrowsing context group nodemap, which is aweak map between abrowsing context groupand anode id map.

Anode id map isweak map between nodes and theircorrespondingWebDriver node id.

A WebDriversession has anavigable seen nodes mapwhich is aweak map between anavigable and a set.

Toget a node givensession,browsing context, andreference:

  1. Letbrowsing context group node map besession'sbrowsing context group node map.
  2. Letbrowsing context group bebrowsing context'sbrowsing context group.
  3. Ifbrowsing context group node map does not containbrowsing context group, return null.
  4. Letnode id map bebrowsing context group node map[browsing context group].
  5. Letnode be the entry innode id map whose value isreference, if such an entry exists, or null otherwise.
  6. Returnnode.

Toget or create a node referencegivensession,browsing context, andnode:

  1. Letbrowsing context group node map besession'sbrowsing context group node map.
  2. Letbrowsing context group bebrowsing context'sbrowsing context group.
  3. Ifbrowsing context group node map does not containbrowsing context group, setbrowsing context group node map[browsing context group] to a newweak map.
  4. Letnode id map bebrowsing context group node map[browsing context group].
  5. Ifnode id map does not containnode:
    1. Letnode id be a new globally unique string.
    2. Setnode id map[node] tonode id.
    3. Letnavigable bebrowsing context'sactive document'snode navigable.
    4. Letnavigable seen nodes map besession'snavigable seen nodes map.
    5. Ifnavigable seen nodes map does not containnavigable, setnavigable seen nodes map[navigable] to an empty set.
    6. Appendnode id tonavigable seen nodes map[navigable].
  6. Returnnode id map[node].

Anode reference is known givensession,browsingcontext, andreference if the following steps return true:

  1. Letnavigable bebrowsing context'sactive document'snode navigable.
  2. Letnavigable seen nodes map besession'snavigable seen nodes map.
  3. Ifnavigable seen nodes mapcontainsnavigable andnavigable seen nodes map[navigable]containsreference, return true, otherwise return false.

Toget a known element givensession andreference:

  1. If notnode reference is known withsession,session'scurrent browsing context, andreference returnerror witherror codeno such element.
  2. Letnode be the result ofget a node withsession,session'scurrent browsing context, andreference.
  3. Ifnode is not null andnode does not implementElement returnerror witherror codeno such element.
  4. Ifnode is null ornodeis stale returnerror witherror codestale element reference.
  5. Returnsuccess with datanode.

Toget or create a web element reference givensession andelement:

  1. Assert:element implementsElement.
  2. Return the result oftrying toget or create a node reference givensession,session'scurrent browsing context, andelement.

Theweb element reference object forsessionandelement is:

  1. Letidentifier be theweb element identifier.

  2. Letreference be the result ofget or create a web element reference withsession andelement.

  3. Return a JSONObject initialized with a property with nameidentifier and valuereference.

Todeserialize a web element by a JSONObjectobject thatrepresents a web element:

  1. Ifobject has noown propertyweb element identifier, returnerror witherror codeinvalid argument.

  2. Letreference be the result ofgetting theweb element identifier property fromobject.

  3. Ifreference is not aString, return anerror witherror codeinvalid argument.

  4. Letelement be the result oftrying toget a known element withsession andreference.

  5. Returnsuccess with dataelement.

Anelementis stale if itsnode document is not theactive document or if it is notconnected.

Toscroll into view anelement perform the following steps only if the element is not alreadyin view:

  1. Letoptions be the followingScrollIntoViewOptions:

    "behavior"
    "instant"
    Logical scroll position "block"
    "end"
    Logical scroll position "inline"
    "nearest"
  2. RunFunction.[[Call]](scrollIntoView,options) withelement as the this value.

Editableelements are those that can be used fortyping andclearing, and they fall into two subcategories:

Mutable form control elements

Denotesinput elements that aremutable (e.g. that are notread only ordisabled) and whosetype attribute is in one of the following states:

And thetextarea element.

Mutable elements

Denotes elements that areediting hosts orcontent editable.

Anelement is said to havepointer events disabled if theresolved value of its "pointer-events" style property is "none".

Anelement is to be consideredread only if it is aninput element whosereadonly attribute is set.

12.1Interactability

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

Aninteractable element is anelement which is eitherpointer-interactable orkeyboard-interactable.

Apointer-interactable element is defined to be the firstelement, defined by thepaint order found at thecenter point of its rectangle that is inside theviewport, excluding the size of any rendered scrollbars.

Akeyboard-interactable element is anyelement that has afocusable area, is abody element, or is thedocument element.

Anelement'sin-view center point is the origin position of the rectangle that is the intersection between the element's firstDOMRect ofgetClientRects() and theinitial viewport. It can be calculated this way:

  1. Letrectangle be the first object of theDOMRect collection returned by callinggetClientRects() onelement.

  2. Letleft bemax(0,min(x coordinate,x coordinate +width dimension)).

  3. Letright bemin(innerWidth,max(x coordinate,x coordinate +width dimension)).

  4. Lettop bemax(0,min(y coordinate,y coordinate +height dimension)).

  5. Letbottom bemin(innerHeight,max(y coordinate,y coordinate +height dimension)).

  6. Letx befloor((left +right) ÷ 2.0).

  7. Lety befloor((top +bottom) ÷ 2.0).

  8. Return the pair of (x,y).

Anelementelement isdisabled if the following steps return true:

  1. Ifelement is anoption element orelement is anoptgroup element:

    1. For eachinclusive ancestorancestor ofelement:

      1. Ifancestor is anoptgroup element orancestor is aselect element, andancestor isactually disabled, return true.

    2. Return false.

  2. Returnelement isactually disabled.

Anelement isin view if it is a member of its ownpointer-interactable paint tree, given the pretense that itspointer events are not disabled.

Anelement isobscured if thepointer-interactable paint tree at itscenter point is empty, or the first element in this tree is not aninclusive descendant of itself.

Example 10

This ascertains if theelement'sin-view center point would be possible tointeract with.

For example, thepaint tree at this button'scenter point, the red square, is not itself the button or adescendant of the button. In other words, it is not aninclusive descendant. This makes the buttonobscured:

On the other hand, thecenter point of the following select list is the thirdoption element, because unlike a drop-down list,<select multiple>'s options are individually visible and painted. Because the option is adescendant of theselect element, it isnotobscured:

Anelement'spointer-interactable paint tree is produced this way:

  1. Ifelement isnot in the same tree assession'scurrent browsing context'sactive document, return an empty sequence.

  2. Letrectangles be theDOMRect sequence returned by callinggetClientRects().

  3. Ifrectangles has the length of 0, return an empty sequence.

  4. Letcenter point be thein-view center point of the first indexed element inrectangles.

  5. Return theelements from point given the coordinatescenter point.

12.2Shadow Roots

Ashadow root is an abstraction used to identify ashadow root when it is transported via theprotocol, betweenremote andlocal ends.

Theshadow root identifier is the string constant "shadow-6066-11e4-a52e-4f735466cecf".

An ECMAScriptObjectrepresents a shadow root if it has ashadow root identifierown property.

Toget a known shadow root givensession andreference:

  1. If notnode reference is known withsession,session'scurrent browsing context, andreference returnerror witherror codeno such shadow root.
  2. Letnode be the result ofget a node withsession,session'scurrent browsing context, andreference.
  3. Ifnode is not null andnode does not implementShadowRoot returnerror witherror codeno such shadow root.
  4. Ifnode is null ornodeis detached returnerror witherror codedetached shadow root.
  5. Returnsuccess with datanode.

Toget or create a shadow root reference givensession andshadow root:

  1. Assert:element implementsShadowRoot.
  2. Return the result oftrying toget or create a node reference withsession,session'scurrent browsing context, andelement.

Theshadow root reference object forsession andshadow root is given by:

  1. Letidentifier be theshadow root identifier.

  2. Letreference be the result ofget or create a shadow root reference withsession andshadow root.

  3. Return a JSONObject initialized with a property with nameidentifier and valuereference.

When required todeserialize a shadow root by a JSONObjectobject thatrepresents a shadow root:

  1. Ifobject has noown propertyshadow root identifier, returnerror witherror codeinvalid argument.

  2. Letreference be the result ofgetting theshadow root identifier property fromobject.

  3. Ifreference is not aString, return anerror witherror codeinvalid argument.

  4. Letshadow be the result oftrying toget a known shadow root withsession andreference.

  5. Returnsuccess with datashadow.

Ashadow rootis detached if itsnode document is not theactive document or if the element node referred to as itshostis stale.

12.3Retrieval

TheFind Element,Find Elements,Find Element From Element,Find Elements From Element,Find Element From Shadow Root, andFind Elements From Shadow Rootcommands allow lookup of individual elements and collections of elements. Element retrieval searches are performed using pre-order traversal of the document's nodes that match the provided selector's expression.

When required tofind givensession,start node,using andvalue, aremote end must run the following steps:

  1. Letlocation strategy be equal tousing.

  2. Letselector be equal tovalue.

  3. Lettimeout besession'ssession timeouts'implicit wait timeout.

  4. Lettimer be a newtimer.

  5. Iftimeout is not null:

    1. Start the timer withtimer andtimeout.

  6. Letelements returned be an emptyList.

  7. Whileelements returned is empty andtimer'stimeout fired flag is not set:

    1. Setelements returned to the result oftrying to call the relevantelement location strategy with argumentsstart node, andselector.

    2. If aDOMException,SyntaxError,XPathException, or other error occurs during the execution of theelement location strategy, returnerrorinvalid selector.
  8. Letresult be an emptyList.

  9. For eachelement inelements returned, append theweb element reference object forsession andelement, toresult.

  10. Returnsuccess with dataresult.

12.3.1Locator strategies

Anelement location strategy is anenumerated attribute deciding what technique should be used to search forelements insession'scurrent browsing context. The followingtable of location strategies lists the keywords and states defined for this attribute:

StateKeyword
CSS selector"css selector"
Link text selector"link text"
Partial link text selector"partial link text"
Tag name"tag name"
XPath selector"xpath"
12.3.1.1CSS selectors

To find aweb element with theCSS Selectorstrategy the following steps need to be completed:

  1. Letelements be the result of callingquerySelectorAll() withstart node asthis andselector as the argument. If this causes an exception to be thrown, returnerror witherror codeinvalid selector.

  2. Returnsuccess with dataelements.

12.3.1.2Link text

To find aweb element with theLink Textstrategy the following steps need to be completed:

  1. Letelements be the result of callingquerySelectorAll() withstart node asthis and "a" as the argument. If this throws an exception, returnerror witherror codeunknown error.

  2. Letresult be an emptyNodeList.

  3. For eachelement inelements:

    1. Letrendered text be the value that would be returned via a call toGet Element Text forelement.

    2. Lettrimmed text be the result of removing allwhitespace from the start and end of the stringrendered text.

    3. Iftrimmed text equalsselector, appendelement toresult.

  4. Returnsuccess with dataresult.

12.3.1.3Partial link text

ThePartial link textstrategy is very similar to theLink Textstrategy, but rather than matching the entire string, only a substring needs to match. That is, return alla elements with rendered text that contains the selector expression.

To find aweb element with thePartial Link Textstrategy the following steps need to be completed:

  1. Letelements be the result of callingquerySelectorAll() withstart node asthis and "a" as the argument. If this throws an exception, returnerror witherror codeunknown error.

  2. Letresult be an emptyNodeList.

  3. For eachelement inelements:

    1. Letrendered text be the value that would be returned via a call toGet Element Text forelement.

    2. Ifrendered text containsselector, appendelement toresult.

  4. Returnsuccess with dataresult.

12.3.1.4Tag name

To find aweb element with theTag Namestrategy returnsuccess with data set to the result of callinggetElementsByTagName() withstart node asthis andselector as the argument.

12.3.1.5XPath

To find aweb element with theXPath Selectorstrategy the following steps need to be completed:

  1. LetevaluateResult be the result of callingevaluate, with argumentsselector,start node,null,ORDERED_NODE_SNAPSHOT_TYPE, andnull.

    Note

    A snapshot is used to promote operation atomicity.

  2. Letindex be 0.

  3. Letlength be the result ofgetting the property "snapshotLength" fromevaluateResult. If this throws anXPathException returnerror witherror codeinvalid selector, otherwise if this throws any other exception returnerror witherror codeunknown error.

  4. Letresult be an emptyNodeList.

  5. Repeat, whileindex is less thanlength:

    1. Letnode be the result of callingsnapshotItem withevaluateResult asthis andindex as the argument.
    2. Ifnode is not anelement return anerror witherror codeinvalid selector.

    3. Appendnode toresult.
    4. Incrementindex by 1.
  6. Returnsuccess with dataresult.

12.3.2Find Element

HTTP MethodURI Template
POST/session/{session id}/element
Note

TheFind Elementcommand is used to findanelement insession'scurrent browsingcontext that can be used as theweb element context forfuture element-centriccommands.

For example, consider this pseudo codewhich retrieves an element with the#toremove IDand uses this as the argument for a script it injectsto remove it from the HTML document:

let body = session.find.css("#toremove");session.execute("arguments[0].remove()", [body]);

Theremote end steps, givensession,URLvariables andparameters are:

  1. Letlocation strategy be the result ofgetting a property named "using" fromparameters.

  2. Iflocation strategy is not present as a keyword in thetable of location strategies, returnerror witherror codeinvalid argument.

  3. Letselector be the result ofgetting a property named "value" fromparameters.

  4. Ifselector isundefined, returnerror witherror codeinvalid argument.

  5. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  6. Try tohandle any user prompts withsession.

  7. Letstart node besession'scurrent browsing context'sdocument element.

  8. Ifstart node isnull, returnerror witherror codeno such element.

  9. Letresult be the result oftrying toFind withsession,start node,location strategy, andselector.

  10. Ifresult is empty, returnerror witherror codeno such element. Otherwise, return the first element ofresult.

12.3.3Find Elements

HTTP MethodURI Template
POST/session/{session id}/elements

Theremote end steps, givensession,URLvariables andparameters are:

  1. Letlocation strategy be the result ofgetting a property named "using" fromparameters.

  2. Iflocation strategy is not present as a keyword in thetable of location strategies, returnerror witherror codeinvalid argument.

  3. Letselector be the result ofgetting a property named "value" fromparameters.

  4. Ifselector isundefined, returnerror witherror codeinvalid argument.

  5. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  6. Try tohandle any user prompts withsession.

  7. Letstart node besession'scurrent browsing context'sdocument element.

  8. Ifstart node isnull, returnerror witherror codeno such element.

  9. Return the result oftrying toFind withsession,start node,location strategy, andselector.

12.3.4Find Element From Element

HTTP MethodURI Template
POST/session/{session id}/element/{element id}/element

Theremote end steps, givensession,URLvariables andparameters are:

  1. Letlocation strategy be the result ofgetting a property named "using" fromparameters.

  2. Iflocation strategy is not present as a keyword in thetable of location strategies, returnerror witherror codeinvalid argument.

  3. Letselector be the result ofgetting a property named "value" fromparameters.

  4. Ifselector isundefined, returnerror witherror codeinvalid argument.

  5. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  6. Try tohandle any user prompts withsession.

  7. Letstart node be the result oftrying toget a known element withsession andURL variables["element id"].

  8. Letresult be the value oftrying toFind withsession,start node,location strategy, andselector.
  9. Ifresult is empty, returnerror witherror codeno such element. Otherwise, return the first element ofresult.

12.3.5Find Elements From Element

HTTP MethodURI Template
POST/session/{session id}/element/{element id}/elements

Theremote end steps, givensession,URLvariables andparameters are:

  1. Letlocation strategy be the result ofgetting a property named "using" fromparameters.

  2. Iflocation strategy is not present as a keyword in thetable of location strategies, returnerror witherror codeinvalid argument.

  3. Letselector be the result ofgetting a property named "value" fromparameters.

  4. Ifselector isundefined, returnerror witherror codeinvalid argument.

  5. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  6. Try tohandle any user prompts withsession.

  7. Letstart node be the result oftrying toget a known element withsession andURL variables["element id"].

  8. Return the result oftrying toFind withsession,start node,location strategy, andselector.

12.3.6Find Element From Shadow Root

HTTP MethodURI Template
POST/session/{session id}/shadow/{shadow id}/element

Theremote end steps, givensession,URLvariables andparameters are:

  1. Letlocation strategy be the result ofgetting a property called "using".

  2. Iflocation strategy is not present as a keyword in thetable of location strategies, returnerror witherror codeinvalid argument.

  3. Letselector be the result ofgetting a property called "value".

  4. Ifselector isundefined, returnerror witherror codeinvalid argument.

  5. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  6. Handle any user prompts and return its value if it is anerror.

  7. Letstart node be the result oftrying toget a known shadow root withsession andURL variables["shadow id"].

  8. Letresult be the value oftrying toFind withsession,start node,location strategy, andselector.
  9. Ifresult is empty, returnerror witherror codeno such element. Otherwise, return the first element ofresult.

12.3.7Find Elements From Shadow Root

HTTP MethodURI Template
POST/session/{session id}/shadow/{shadow id}/elements

Theremote end steps, givensession,URLvariables andparameters are:

  1. Letlocation strategy be the result ofgetting a property called "using".

  2. Iflocation strategy is not present as a keyword in thetable of location strategies, returnerror witherror codeinvalid argument.

  3. Letselector be the result ofgetting a property called "value".

  4. Ifselector isundefined, returnerror witherror codeinvalid argument.

  5. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  6. Handle any user prompts and return its value if it is anerror.

  7. Letstart node be the result oftrying toget a known shadow root withsession andURL variables["shadow id"].

  8. Return the result oftrying toFind withsession,start node,location strategy, andselector.

12.3.8Get Active Element

HTTP MethodURI Template
GET/session/{session id}/element/active

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. Letactive element be theactive element ofsession'scurrent browsing context'sdocument element.

  4. Ifactive element is a non-nullelement, returnsuccess with data set toweb element reference object forsession andactive element.

    Otherwise, returnerror witherror codeno such element.

12.3.9Get Element Shadow Root

HTTP MethodURI Template
GET/session/{session id}/element/{element id}/shadow

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

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

  3. Letelement be the result oftrying toget a known element withsession andURL variables[element id].

  4. Letshadow root beelement'sshadow root.

  5. Ifshadow root is null, returnerror witherror codeno such shadow root.

  6. Letserialized be theshadow root reference object forsession andshadow root.

  7. Returnsuccess with dataserialized.

12.4State

Tocalculate the absolute positiongivensession andelement:

  1. Letrect be the value returned by callinggetBoundingClientRect().

  2. Letwindow be theassociated window ofsession'scurrent top-level browsing context.

  3. Letx be (scrollX ofwindow +rect'sx coordinate).

  4. Lety be (scrollY ofwindow +rect'sy coordinate).

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

To determine ifnode isnot in the same tree as anothernode,other, run the following substeps:

  1. If thenode'snode document is notother'snode document, return true.

  2. Return true if the result of calling thenode'scompareDocumentPosition() withother as argument isDOCUMENT_POSITION_DISCONNECTED (1), otherwise return false.

Anelement'scontainer is:

option element in a validelement context
optgroup element in a validelement context

Theelement'selement context, which is determined by:

  1. Letdatalist parent be the firstdatalist element reached by traversing the tree in reverse order fromelement, orundefined if the root of the tree is reached.

  2. Letselect parent be the firstselect element reached by traversing the tree in reverse order fromelement, orundefined if the root of the tree is reached.

  3. Ifdatalist parent isundefined, theelement context isselect parent. Otherwise, theelement context isdatalist parent.

option element in an invalidelement context

The element does not have a container.

Otherwise

The container is theelement itself.

12.4.1Is Element Selected

HTTP MethodURI Template
GET/session/{session id}/element/{element id}/selected
Note

TheIs Element Selectedcommanddetermines if the referencedelement is selected or not.This operation only makes sense oninput elementsof theCheckbox- andRadio Button states,or onoption elements.

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. Letelement be the result oftrying toget a known element withsession andURL variables[element id].

  4. Letselected be the value corresponding to the first matching statement:

    element is aninput element with atype attribute in theCheckbox- orRadio Button state

    The result ofelement'scheckedness.

    element is anoption element

    The result ofelement'sselectedness.

    Otherwise
    False.
  5. Returnsuccess with dataselected.

MDNCommands/GetElementAttribute
Chrome65+
Chrome AndroidNo
Edge?
Edge Mobile?
Firefox55+
Firefox AndroidNo
OperaNo
Opera Android?
SafariNo
Safari iOS?
Samsung InternetNo
WebView Android?

12.4.2Get Element Attribute

HTTP MethodURI Template
GET/session/{session id}/element/{element id}/attribute/{name}

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. Letelement be the result oftrying toget a known element withsession andURL variables' element id.

  4. Letname beURL variables["name"].

  5. Letresult be the result of the first matching condition:
    Ifname is aboolean attribute

    "true" (string) if theelementhasAttribute() withname, otherwisenull.

    Otherwise

    The result ofgetting an attribute by namename.

  6. Returnsuccess with dataresult.

Note

Please note that the behavior of this command deviates from the behavior ofgetAttribute() in [DOM], which in the case of a setboolean attribute would return an empty string. The reason this command returns true as a string is because this evaluates to true in most dynamically typed programming languages, but still preserves the expected type information.

MDNCommands/GetElementProperty
Chrome65+
Chrome AndroidNo
Edge?
Edge Mobile?
Firefox55+
Firefox AndroidNo
OperaNo
Opera Android?
SafariNo
Safari iOS?
Samsung InternetNo
WebView Android?

12.4.3Get Element Property

HTTP MethodURI Template
GET/session/{session id}/element/{element id}/property/{name}

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. Letelement be the result oftrying toget a known element withsession andURL variables' element id.

  4. LetnameURL variables["name"].

  5. Letproperty be the result of calling theObject.[[GetProperty]](name) onelement.

  6. Letresult be the value ofproperty if notundefined, ornull.

  7. Returnsuccess with dataresult.

12.4.4Get Element CSS Value

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

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. Letelement be the result oftrying toget a known element withURL variables["element id"].

  4. Letcomputed value be the result of the first matching condition:

    session'scurrent browsing context'sactive document'stype is not "xml"
    computed value of parameterURL variables["property name"] fromelement's style declarations.
    Otherwise
    "" (empty string)
  5. Returnsuccess with datacomputed value.

12.4.5Get Element Text

HTTP MethodURI Template
GET/session/{session id}/element/{element id}/text
Note

TheGet Element Textcommandintends to return anelement's text “as rendered”.Anelement's rendered text is also usedfor locatinga elementsby theirlink text andpartial link text.

One of the major inputs to this specificationwas the open sourceSelenium project.This was in wide-spread use before this specification written,and so had set user expectationsof how theGet Element Text command should work.As such, the approach presented here is known to be flawed,but provides the best compatibility with existing users.

When processing text,whitespace is defined as characters from the Unicode Character Databasewith theUnicode character property "WSpace=Y" or "WS".[UAX44]

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. Letelement be the result oftrying toget a known element withsession andURL variables[element id].

  4. Letrendered text be the result of performing implementation-specific steps whose result is exactly the same as the result of aFunction.[[Call]](null,element) withbot.dom.getVisibleText as the this value.

  5. Returnsuccess with datarendered text.

MDNCommands/GetElementTagName
Chrome65+
Chrome AndroidNo
Edge?
Edge Mobile?
Firefox55+
Firefox AndroidNo
OperaNo
Opera Android?
SafariNo
Safari iOS?
Samsung InternetNo
WebView Android?

12.4.6Get Element Tag Name

HTTP MethodURI Template
GET/session/{session id}/element/{element id}/name

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. Letelement be the result oftrying toget a known element withURL variables["element id"].

  4. Letqualified name be the result of gettingelement'stagName IDL attribute.

  5. Returnsuccess with dataqualified name.

12.4.7Get Element Rect

HTTP MethodURI Template
GET/session/{session id}/element/{element id}/rect
Note

TheGet Element Rectcommandreturns the dimensions and coordinates of the givenweb element.The returned value is an object with the following properties:

"x"
X axis position of the top-left corner of theweb elementrelative tosession'scurrent browsing context'sdocument element inCSS pixels.
"y"
Y axis position of the top-left corner of theweb elementrelative tosession'scurrent browsing context'sdocument element inCSS pixels.
"height"
Height of theweb element'sbounding rectangle inCSS pixels.
"width"
Width of theweb element'sbounding rectangle inCSS pixels.

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. Letelement be the result oftrying toget a known element withsession andURL variables["element id"].

  4. Letcoordinates becalculate the absolute position withsession andelement.

  5. Letrect beelement'sbounding rectangle.

  6. Letbody be a new JSONObject initialized with:

    "x"
    The first value ofcoordinates.
    "y"
    The second value ofcoordinates.
    "width"
    Value ofrect'swidth dimension.
    "height"
    Value ofrect'sheight dimension.
  7. Returnsuccess with databody.

12.4.8Is Element Enabled

HTTP MethodURI Template
GET/session/{session id}/element/{element id}/enabled

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. Letelement be the result oftrying toget a known element withsession andURL variables[element id].

  4. Letenabled be a boolean initially set to true ifsession'scurrent browsing context'sactive document'stype is not "xml".

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

  5. Setenabled to false if a form control isdisabled.

  6. Returnsuccess with dataenabled.

12.4.9Get Computed Role

HTTP MethodURI Template
GET/session/{session id}/element/{element id}/computedrole

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. Letelement be the result oftrying toget a known element withURL variables["element id"].

  4. Letrole be the result of computing theWAI-ARIA role ofelement.

  5. Returnsuccess with datarole.

12.4.10Get Computed Label

HTTP MethodURI Template
GET/session/{session id}/element/{element id}/computedlabel

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. Letelement be the result oftrying toget a known element withsession andURL variables["element id"].

  4. Letlabel be the result of aAccessible Name and Description Computation for theAccessible Name of theelement.

  5. Returnsuccess with datalabel.

12.5Interaction

Theelement interactioncommands provide a high-level instruction set for manipulating form controls. UnlikeActions, they will implicitlyscroll elements into view and check that it is aninteractable element.

Someresettable elements define their ownclear algorithm. Unlike their associatedreset algorithms, changes made to form controls as part of these algorithmsdo count as changes caused by the user (and thus, e.g. do causeinput events to fire). When theclear algorithm is invoked for an element that does not define its ownclear algorithm, itsreset algorithm must be invoked instead.

Theclear algorithm forinput elements is to set thedirty value flag anddirty checkedness flag back to false, set thevalue of the element to an empty string, set thecheckedness of the element to true if the element has achecked content attribute and false if it does not, empty the list ofselected files, and then invoke thevalue sanitization algorithm iff thetype attribute's current state defines one.

Theclear algorithm fortextarea elements is to set thedirty value flag back to false, and set theraw value of element to an empty string.

Theclear algorithm foroutput elements is set the element'svalue mode flag to default and then to set the element'stextContent IDL attribute to an empty string (thus clearing the element's child nodes).

12.5.1Element Click

HTTP MethodURI Template
POST/session/{session id}/element/{element id}/click
Note

TheElement Clickcommandscrolls into view theelementif it is not alreadypointer-interactable,and clicks itsin-view center point.

If the element'scenter pointisobscured by another element,anelement click interceptederror is returned.If the element is outside theviewport,anelement not interactableerror is returned.

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. Letelement be the result oftrying toget a known element withsession andelement id.

  4. If theelement is aninput element in thefile upload state returnerror witherror codeinvalid argument.

  5. Scroll into view theelement'scontainer.

  6. Ifelement'scontainer is still notin view, returnerror witherror codeelement not interactable.

  7. Ifelement'scontainer isobscured by anotherelement, returnerror witherror codeelement click intercepted.

  8. Matching onelement:

    option element
    1. Letparent node be theelement'scontainer.

    2. Fire amouseOver event atparent node.

    3. Fire amouseMove event atparent node.

    4. Fire amouseDown event atparent node.

    5. Run thefocusing steps onparent node.

    6. Ifelement is notdisabled:

      1. Fire aninput event atparent node.

      2. Letprevious selectedness be equal toelementselectedness.

      3. Ifelement'scontainer has themultiple attribute, toggle theelement'sselectedness state by setting it to the opposite value of its currentselectedness.

        Otherwise, set theelement'sselectedness state to true.

      4. Ifprevious selectedness is false,fire achange event atparent node.

    7. Fire amouseUp event atparent node.

    8. Fire aclick event atparent node.

    Otherwise
    1. Letinput state be the result ofget the input state givensession andsession'scurrent top-level browsing context.

    2. Letactions options be a newactions options with theis element origin steps set torepresents a web element, and theget element origin steps set toget a WebElement origin.

    3. Letinput id be a the result ofgenerating a UUID.

    4. Letsource be the result ofcreate an input source withinput state, and "pointer".

    5. Add an input source withinput state,input id andsource.

    6. Letclick point be theelement'sin-view center point.

    7. Letpointer move action be anaction object constructed with argumentsinput id, "pointer", and "pointerMove".

    8. Set a propertyx to0 onpointer move action.

    9. Set a propertyy to0 onpointer move action.

    10. Set a propertyorigin toelement onpointer move action.

    11. Letpointer down action be anaction object constructed with argumentsinput id, "pointer", and "pointerDown".

    12. Set a propertybutton to0 onpointer down action.

    13. Letpointer up action be anaction object constructed with argumentsinput id, "pointer", and "pointerUp" as arguments.

    14. Set a propertybutton to0 onpointer up action.

    15. Letactions be the list «pointer move action,pointer down action,pointer up action».

    16. Dispatch a list of actions withinput state,actions,session'scurrent browsing context, andactions options.

    17. Remove an input source withinput state andinput id.

  9. Wait until the user agent event loop has spun enough times to process the DOM events generated by the previous step.

  10. Perform implementation-defined steps to allow anynavigations triggered by the click to start.

    Note

    It is not always clear how long this will cause the algorithm to wait, and it is acknowledged that some implementations may have unavoidable race conditions. The intention is to allow a new attempt tonavigate to begin so that the next step in the algorithm is meaningful. It is possible the click does not cause an attempt tonavigate, in which case the implementation-defined steps can return immediately, and the next step will also return immediately.

  11. Try towait for navigation to complete withsession.

  12. Try to run thepost-navigation checks.

  13. Returnsuccess with datanull.

12.5.2Element Clear

HTTP MethodURI Template
POST/session/{session id}/element/{element id}/clear

Toclear a content editable element:

  1. Ifelement'sinnerHTML IDL attribute is an empty string do nothing and return.

  2. Run thefocusing steps forelement.

  3. Setelement'sinnerHTML IDL attribute to an empty string.

  4. Run theunfocusing steps for theelement.

Toclear a resettable element:

  1. Letempty be the result of the first matching condition:

    element is aninput element whosetype attribute is in theFile Upload state
    True if the list ofselected files has a length of 0, and false otherwise.
    Otherwise
    True if itsvalue IDL attribute is an empty string, and false otherwise.
  2. Ifelement is acandidate for constraint validation itsatisfies its constraints, andempty is true, abort these substeps.

  3. Invoke thefocusing steps forelement.

  4. Invoke theclear algorithm forelement.

  5. Invoke theunfocusing steps for theelement.

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. Letelement be the result oftrying toget a known element withsession andelement id.

  4. Ifelement is noteditable, return anerror witherror codeinvalid element state.

  5. Scroll into view theelement.

  6. Lettimeout besession'ssession timeouts'implicit wait timeout.

  7. Lettimer be a newtimer.

  8. Iftimeout is not null:

    1. Start the timer withtimer andtimeout.

  9. Wait forelement to becomeinteractable, ortimer'stimeout fired flag to be set, whichever occurs first.

  10. Ifelement is notinteractable, returnerror witherror codeelement not interactable.

  11. Run the substeps of the first matching statement:

    element is amutable form control element

    Invoke the steps toclear a resettable element.

    element is amutable element

    Invoke the steps toclear a content editable element.

    Otherwise

    Returnerror witherror codeinvalid element state.

  12. Returnsuccess with datanull.

12.5.3Element Send Keys

HTTP MethodURI Template
POST/session/{session id}/element/{element id}/value
Note

TheElement Send Keyscommandscrolls into view the form controlelementand then sends the provided keys to theelement.In case theelement is notkeyboard-interactable,anelement not interactableerror is returned.

Anon-typeable form controlis aninput elementwhosetype attribute statecauses the primary input mechanismnot to be through means of a keyboard, whether virtual or physical.

Non-typeable form controls means to refer toform control elements rendered by the user agentas something other than as a text input control.When targetting aninput elementin thecolor statebeing presented as a color wheel,interaction with it will be simulated,rather than typed using key emulation withactions.

Other examples ofnon-typeable form controls includeform controls interacted with via system-native widgets,such as a scrolled option list forselect elementsand a number keypad forinput elementsin thenumber state on non-desktop devices.

Thekey input source used for input may be cleared mid-way through “typing” by sending thenull key, which is U+E000 (NULL).

Toclear the modifier key state giveninput state,input id,source,undo actions, andbrowsing context:

  1. Ifsource is not akey input source returnerror witherror codeinvalid argument.

  2. Letactions options be a newactions options with theis element origin steps set torepresents a web element, and theget element origin steps set toget a WebElement origin.

  3. For eachentry key in the lexically sorted keys ofundo actions:

    1. Letaction be the value ofundo actions equal to the keyentry key.

    2. Ifaction is not anaction object with type "key" and subtype "keyUp", returnerror witherror codeinvalid argument.

    3. Letactions be the list «action»

    4. Dispatch a list of actions withinput state,actions,browsing context, andactions options.

Anextended grapheme cluster istypeable if it consists of a singleunicode code point and thecode is notundefined.

Theshifted state forkeyboard is the value ofkeyboard'sshift property.

Todispatch the events for a typeable stringgiveninput state,input id,source,text, andbrowsing context:

  1. Letactions options be a newactions options with theis element origin steps set torepresents a web element, and theget element origin steps set toget a WebElement origin.

  2. For eachchar oftext:
    1. Letglobal key state be the result ofget the global key state withinput state.

    2. Ifchar is ashifted character, and theshifted state ofsource is false:

      1. Letaction be anaction object constructed withinput id, "key", and "keyDown", and set itsvalue property to U+E008 ("left shift").

      2. Letactions be the list «action».

      3. Dispatch a list of actions withinput state,actions, andbrowsing context.

    3. Ifchar is not ashifted character and theshifted state ofsource is true:

      1. Letaction be anaction object constructed withinput id, "key", and "keyUp", and set itsvalue property to U+E008 ("left shift").

      2. Lettick actions be the list «action».

      3. Dispatch a list of actions withinput state,actions,browsing context, andactions options.

    4. Letkeydown action be anaction object constructed with argumentsinput id, "key", and "keyDown".

    5. Set thevalue property ofkeydown action tochar.

    6. Letkeyup action be a copy ofkeydown action with the subtype property changed to "keyUp".

    7. Letactions be the list «keydown action,keyup action».

    8. Dispatch a list of actions withinput state,actions,browsing context, andactions options.

When required todispatch a composition eventgiventype andcluster, andbrowsingcontext, theremote end mustperformimplementation-specific action dispatch steps onbrowsingcontext equivalent to sending composition events in accordancewith the requirements of [UI-EVENTS], and producing the followingevent with the specified properties.

Todispatch actions for a string giveninputstate,input id,source,text,browsing context, andactions options:

  1. Letclusters be an array created bybreakingtext into extended grapheme clusters.

  2. Letundo actions be an empty map.

  3. Letcurrent typeable text be an empty list.

  4. For eachcluster corresponding to an indexed property inclusters run the substeps of the first matching statement:

    cluster is thenull key
    1. Dispatch the events for a typeable string withinput state,input id,source,current typeable text, andbrowsing context. Emptycurrent typeable text.

    2. Try toclear the modifier key state withinput state,input id,source,undo actions andbrowsing context.

    3. Clearundo actions.

    cluster is amodifier key
    1. Dispatch the events for a typeable string withinput state,input id,source,current typeable text, andbrowsing context.

    2. Emptycurrent typeable text.

    3. Letkeydown action be anaction object constructed with argumentsinput id, "key", and "keyDown".

    4. Set thevalue property ofkeydown action tocluster.

    5. Letactions be the list «keydown action»

    6. Dispatch a list of actions withinput state,actions,browsing context, andactions options.

    7. Add an entry toundo actions with keycluster and value being a copy ofkeydown action with the subtype property modified to "keyUp".

    cluster istypeable

    Appendcluster tocurrent typeable text.

    Otherwise
    1. Dispatch the events for a typeable string withinput state,input id,source,current typeable text, andbrowsing context.

    2. Emptycurrent typeable text.

    3. Dispatch acomposition event with arguments "compositionstart",undefined, andbrowsing context.

    4. Dispatch acomposition event with arguments "compositionupdate",cluster, andbrowsing context.

    5. Dispatch acomposition event with arguments "compositionend",cluster, andbrowsing context.

  5. Dispatch the events for a typeable string withinput state,input id andsource,current typeable text, andbrowsing context.

  6. Try toclear the modifier key state withinput state,input id,source,undo actions, andbrowsing context.

Theremote end steps, givensession,URLvariables andparameters are:

  1. Lettext be the result ofgetting a property named "text" fromparameters.

  2. Iftext is not aString, return anerror witherror codeinvalid argument.

  3. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  4. Try tohandle any user prompts withsession.

  5. Letelement be the result oftrying toget a known element withsession andURL variables[element id].

  6. Letfile be true ifelement isinput element in thefile upload state, or false otherwise.

  7. Iffile is false or thesession'sstrict file interactability, is true run the following substeps:

    1. Scroll into view theelement.

    2. Lettimeout besession'ssession timeouts'implicit wait timeout.

    3. Lettimer be a newtimer.

    4. Iftimeout is not null:

      1. Start the timer withtimer andtimeout.

    5. Wait forelement to becomekeyboard-interactable, ortimer'stimeout fired flag to be set, whichever occurs first.

    6. Ifelement is notkeyboard-interactable, returnerror witherror codeelement not interactable.

    7. Ifelement is not theactive element run thefocusing steps for theelement.

  8. Run the substeps of the first matching condition:

    file is true
    1. Letfiles be the result of splittingtext on the newline (\n) character.

    2. Iffiles is of 0 length, return anerror witherror codeinvalid argument.

    3. Letmultiple equal the result of callinghasAttribute() with "multiple" onelement.

    4. ifmultiple isfalse and the length offiles is not equal to 1, return anerror witherror codeinvalid argument.

    5. Verify that each file given by the user exists. If any do not, returnerror witherror codeinvalid argument.

    6. Complete implementation specific steps equivalent to setting theselected files on theinput element. Ifmultiple istruefiles are be appended toelement'sselected files.

    7. Fire these events in order onelement:

      1. input
      2. change
    8. Returnsuccess with datanull.

    element is anon-typeable form control
    1. Ifelement does not have anown property namedvalue return anerror witherror codeelement not interactable

    2. Ifelement is notmutable return anerror witherror codeelement not interactable.

    3. Set a propertyvalue totext onelement.

    4. Ifelement issuffering from bad input return anerror witherror codeinvalid argument.

    5. Returnsuccess with datanull.

    element iscontent editable
    Ifelement does not currently have focus, set the text insertion caret after any child content.
    Otherwise
    1. Ifelement does not currently have focus, letcurrent text length be thelength ofelement'sAPI value.

    2. Set the text insertion caret usingset selection range usingcurrent text length for both thestart andend parameters.

  9. Letinput state be the result ofget the input state withsession andsession'scurrent top-level browsing context.

  10. Letinput id be a the result ofgenerating a UUID.

  11. Letsource be the result ofcreate an input source withinput state, and "key".

  12. Add an input source withinput state,input id andsource.

  13. Dispatch actions for a string with argumentsinput state,input id, andsource,text, andsession'scurrent browsingcontext.

  14. Remove an input source withinput state andinput id.

  15. Returnsuccess with datanull.

13.Document

13.1Get Page Source

HTTP MethodURI Template
GET/session/{session id}/source
Note

TheGet Page Sourcecommand returns a stringserialization of the DOM ofsession'scurrent browsingcontextactive document.

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. Letsource be the result of invoking thefragment serializing algorithm on a fictional node whose only child is thedocument element providingtrue for therequire well-formed flag. If this causes an exception to be thrown, letsource benull.

  4. Letsource be the result ofserializing to stringsession'scurrent browsing context'sactive document, ifsource isnull.

  5. Returnsuccess with datasource.

13.2Executing Script

Acollection is anObjectthat implements theIterable interface,and whose:

ToJSON deserializegivensession,value and optionalargumentseen, aremote end must run the followingsteps:

  1. Ifseen is not provided, letseen be an emptyList.

  2. Jump to the first appropriate step below:

  3. Matching onvalue:

    undefined
    null
    typeBoolean
    typeNumber
    typeString

    Returnsuccess with datavalue.

    Object thatrepresents a web element

    Return thedeserializedweb element ofvalue.

    Object thatrepresents a shadow root

    Return thedeserializedshadow root ofvalue.

    Object thatrepresents a web frame

    Return thedeserializedweb frame ofvalue.

    Object thatrepresents a web window

    Return thedeserializedweb window ofvalue.

    instance ofArray
    instance ofObject

    Returnclone an object algorithm withsession,value andseen, and theJSON deserialize algorithm as the clone algorithm.

ToJSON clone givensession andvalue, return the result ofinternal JSON clone withsession,value and an emptyList.

Tointernal JSON clone givensession,value andseen, return the value of the first matching statement, matching onvalue:

undefined
null

Returnsuccess with datanull.

typeBoolean
typeNumber
typeString

Returnsuccess with datavalue.

instance ofElement

If theelementis stale, returnerror witherror codestale element reference.

Otherwise:

  1. Letreference be theweb element reference object forsession andvalue.

  2. Returnsuccess with datareference.

instance ofShadowRoot

If theshadow rootis detached, returnerror witherror codedetached shadow root.

Otherwise:

  1. Letreference be theshadow root reference object forsession andvalue.

  2. Returnsuccess with datareference.

aWindowProxy object

If the associatedbrowsing context of theWindowProxy object invalue has been destroyed, returnerror witherror codestale element reference.

Otherwise:

  1. Letreference be theWindowProxy reference object forvalue.

  2. Returnsuccess with datareference.

has anown property named "toJSON" that is aFunction
Returnsuccess with the value returned byFunction.[[Call]](toJSON) withvalue as the this value.
Otherwise
  1. Letresult beclone an object withsessionvalue andseen, andinternal JSON clone as theclone algorithm.

  2. Returnsuccess with dataresult.

Toclone an object, givensession,value,seen, andclone algorithm:

  1. Ifvalue is inseen, returnerror witherror codejavascript error.

  2. Appendvalue toseen.

  3. Letresult be the value of the first matching statement, matching onvalue:

    acollection

    A newArray whichlength property is equal to the result ofgetting the propertylength ofvalue.

    Otherwise

    A newObject.

  4. For each enumerable property invalue, run the following substeps:

    1. Letname be the name of the property.

    2. Letsource property value be the result ofgetting a property namedname fromvalue. If doing so causes script to be run and that script throws an error, returnerror witherror codejavascript error.

    3. Letcloned property result be the result of calling theclone algorithm withsession,source property value andseen.

    4. Ifcloned property result is asuccess,set a property ofresult with namename and value equal tocloned property result's data.

    5. Otherwise, returncloned property result.

  5. Remove the last element ofseen.

  6. Returnsuccess with dataresult.

When required toextract the script arguments from a request with argumentparameters the implementation must:

  1. Letscript be the result ofgetting a property named "script" fromparameters.

  2. Ifscript is not aString, returnerror witherror codeinvalid argument.

  3. Letargs be the result ofgetting a property named "args" fromparameters.

  4. Ifargs is not anArray returnerror witherror codeinvalid argument.

  5. Letarguments beJSON deserialize withsession andargs.

  6. Returnsuccess with datascript andarguments.

The rules toexecute a function body are as follows. The algorithm returnsan ECMAScript completion record.

If at any point during the algorithm auser prompt appears, immediately returnCompletion { [[Type]]:normal, [[Value]]:null, [[Target]]:empty }, but continue to run the other steps of this algorithmin parallel.

  1. Letwindow be theassociated window ofsession'scurrent browsing context'sactive document.

  2. Letenvironment settings bewindow'srelevant settings object.

  3. Letglobal scope beenvironment settingsrealm'sglobal environment.
  4. Ifbody is not parsable as aFunctionBody or if parsing detects anearly error, returnCompletion { [[Type]]:normal, [[Value]]:null, [[Target]]:empty }.

  5. Ifbody begins with adirective prologue that contains ause strict directive then letstrict be true, otherwise letstrict be false.

  6. Prepare to run script withenvironment settings.

  7. Prepare to run a callback withenvironment settings.

  8. Letfunction be the result of callingFunctionCreate, with arguments:

    kind
    Normal.
    list
    An emptyList.
    body
    The result of parsingbody above.
    global scope
    The result of parsingglobal scope above.
    strict
    The result of parsingstrict above.
  9. Letcompletion beFunction.[[Call]](window,parameters) withfunction as the this value.

  10. Clean up after running a callback withenvironment settings.

  11. Clean up after running script withenvironment settings.

  12. Returncompletion.

Note

The above algorithm is not associated with any particular element, and is therefore not subject to the document CSPdirectives.

13.2.1Execute Script

HTTP MethodURI Template
POST/session/{session id}/execute/sync

Theremote end steps, givensession,URLvariables andparameters are:

  1. Letbody andarguments be the result oftrying toextract the script arguments from a request with argumentparameters.

  2. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  3. Try tohandle any user prompts withsession.

  4. Lettimeout besession'ssession timeouts'script timeout.

  5. Lettimer be a newtimer.

  6. Iftimeout is not null:

    1. Start the timer withtimer andtimeout.

  7. Letpromise bea new Promise.

  8. Run the following substepsin parallel:

    1. LetscriptPromise be the result ofpromise-callingexecute a function body, with argumentsbody andarguments.

    2. Upon fulfillment ofscriptPromise with valuev,resolvepromise with valuev.

    3. Upon rejection ofscriptPromise with valuer,rejectpromise with valuer.

  9. Wait untilpromise is resolved, ortimer'stimeout fired flag is set, whichever occurs first.

  10. Ifpromise is still pending andtimer'stimeout fired flag is set, returnerror witherror codescript timeout.

  11. Ifpromise is fulfilled with valuev, letresult beJSON clone withsession andv, and returnsuccess with dataresult.

  12. Ifpromise is rejected with reasonr, letresult beJSON clone withsession andr, and returnerror witherror codejavascript error and dataresult.

13.2.2Execute Async Script

HTTP MethodURI Template
POST/session/{session id}/execute/async
Note

TheExecute Async Scriptcommandcauses JavaScript to execute as an anonymous function.An additional value is provided as the final argument to the function.This is a function that may be invoked to signal the completion of the asynchronous operation.The first argument provided to the function will be serialized to JSON and returned byExecute Async Script.

Theremote end steps, givensession,URLvariables andparameters are:

  1. Letbody andarguments by the result oftrying toextract the script arguments from a request with argumentparameters.

  2. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  3. Try tohandle any user prompts withsession.

  4. Lettimeout besession'ssession timeouts'script timeout.

  5. Lettimer be a newtimer.

  6. Iftimeout is not null:

    1. Start the timer withtimer andtimeout.

  7. Letpromise bea new Promise.

  8. Run the following substepsin parallel:

    1. LetresolvingFunctions beCreateResolvingFunctions(promise).

    2. AppendresolvingFunctions.[[Resolve]] toarguments.

    3. LetscriptResult be the result of callingexecute a function body, with argumentsbody andarguments.

    4. IfscriptResult.[[Type]] is notnormal, thenrejectpromise with valuescriptResult.[[Value]], and abort these steps.

      Note

      Prior revisions of this specification did not recognize the return value of the provided script. In order to preserve legacy behavior, the return value only influences the command if it is a "thenable" object or if determining this produces an exception.

    5. IfType(scriptResult.[[Value]]) is notObject, then abort these steps.

    6. Letthen beGet(scriptResult.[[Value]], "then").

    7. Ifthen.[[Type]] is notnormal, thenrejectpromise with valuethen.[[Value]], and abort these steps.

    8. IfIsCallable(then.[[Type]]) isfalse, then abort these steps.

    9. LetscriptPromise bePromiseResolve(Promise,scriptResult.[[Value]]).

    10. Upon fulfillment ofscriptPromise with valuev,resolvepromise with valuev.

    11. Upon rejection ofscriptPromise with valuer,rejectpromise with valuer.

  9. Wait untilpromise is resolved, ortimer'stimeout fired flag is set, whichever occurs first.

  10. Ifpromise is still pending andtimer'stimeout fired flag is set, returnerror witherror codescript timeout.

  11. Ifpromise is fulfilled with valuev, letresult beJSON clone withsession andv, and returnsuccess with dataresult.

  12. Ifpromise is rejected with reasonr, letresult beJSON clone withsession andr, and returnerror witherror codejavascript error and dataresult.

14.Cookies

This section describes the interaction withcookies as described in [RFC6265].

Acookie is described in [RFC6265] by a name-value pair holding the cookie's data, followed by zero or more attribute-value pairs describing its characteristics.

The followingtable for cookie conversion defines the cookie concepts relevant to WebDriver, how these are referred to in [RFC6265], what keys they map to in aserialized cookie, as well as the attribute-value keys needed when constructing a list of arguments forcreating a cookie.

For informational purposes, the table includes a legend of whether the field is optional in theserialized cookie provided toAdd Cookie, and a brief non-normative description of the field and the expected input type of its associated value.

ConceptRFC 6265 FieldJSON KeyAttribute KeyOptionalDescription
Cookie namename"name"The name of the cookie.
Cookie valuevalue"value"The cookie value.
Cookie pathpath"path""Path"The cookie path. Defaults to "/" if omitted whenadding a cookie.
Cookie domaindomain"domain""Domain"The domain the cookie is visible to. Defaults tosession'scurrent browsing context'sactive document'sURLdomain if omitted whenadding a cookie.
Cookie secure onlysecure-only-flag"secure""Secure"Whether the cookie is a secure cookie. Defaults to false if omitted whenadding a cookie.
Cookie HTTP onlyhttp-only-flag"httpOnly""HttpOnly"Whether the cookie is an HTTP only cookie. Defaults to false if omitted whenadding a cookie.
Cookie expiry timeexpiry-time"expiry""Max-Age"When the cookie expires, specified in seconds sinceUnix Epoch. Must not be set if omitted whenadding a cookie.
Cookie same sitesamesite"sameSite""SameSite"Whether the cookie applies to a SameSite policy. Defaults to None if omitted whenadding a cookie. Can be set to eitherLax orStrict.

Aserialized cookie is a JSONObject where acookie's [RFC6265] fields listed in thetable for cookie conversion are mapped using theJSON Key and the associated field's value from thecookie store. The optional fields may be omitted.

To getall associated cookies to adocument, the user agent must return the enumerated set ofcookies that meet the requirements set out in the first step of the algorithm in [RFC6265] tocomputecookie-string for an ‘HTTP API', from thecookie store of the givendocument'saddress. The returned cookies must includeHttpOnly cookies.

When theremote end is instructed tocreate a cookie, this is synonymous to carrying out the steps described in [RFC6265]section 5.3, underreceiving a cookie, except the user agent may not ignore the received cookie in its entirety (disregard step 1).

Todelete cookies given an optional filter argumentname that is a string:

  1. For eachcookie amongall associated cookies ofsession'scurrent browsing context'sactive document, run the substeps of the first matching condition:

    name isundefined
    name is equal tocookie name

    Set thecookie expiry time to aUnix timestamp in the past.

    Otherwise
    Do nothing.

14.1Get All Cookies

HTTP MethodURI Template
GET/session/{session id}/cookie

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. Letcookies be a newList.

  4. For eachcookie inall associated cookies ofsession'scurrent browsing context'sactive document:

    1. Letserialized cookie be the result ofserializingcookie.

    2. Appendserialized cookie tocookies

  5. Returnsuccess with datacookies.

14.2Get Named Cookie

HTTP MethodURI Template
GET/session/{session id}/cookie/{name}

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. If theURL variables["name" is equal to acookie'scookie name amongstall associated cookies ofsession'scurrent browsing context'sactive document, returnsuccess with theserialized cookie as data.

    Otherwise, returnerror witherror codeno such cookie.

14.3Add Cookie

HTTP MethodURI Template
POST/session/{session id}/cookie

Theremote end steps, givensession,URLvariables andparameters are:

  1. Letdata be the result ofgetting a property named "cookie" fromparameters.

  2. Ifdata is not a JSONObject with all the required (non-optional) JSON keys listed in thetable for cookie conversion, returnerror witherror codeinvalid argument.

  3. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  4. Try tohandle any user prompts withsession.

  5. Ifsession'scurrent browsing context'sdocument element is acookie-averseDocument object, returnerror witherror codeinvalid cookie domain.

  6. Ifcookie name orcookie value isnull,cookie domain is not equal tosession'scurrent browsing context'sactive document'sdomain,cookie secure only orcookie HTTP only are not boolean types, orcookie expiry time is not an integer type, or it less than 0 or greater than themaximum safe integer, returnerror witherror codeinvalid argument.

  7. Create a cookie in thecookie store associated with theactive document'saddress usingcookie namename,cookie valuevalue, and an attribute-value list of the following cookie concepts listed in thetable for cookie conversion fromdata:

    Cookie path

    The value if the entry exists, otherwise "/".

    Cookie domain

    The value if the entry exists, otherwisesession'scurrent browsing context'sactive document'sURLdomain.

    Cookie secure only

    The value if the entry exists, otherwise false.

    Cookie HTTP only

    The value if the entry exists, otherwise false.

    Cookie expiry time

    The value if the entry exists, otherwise leave unset to indicate that this is a session cookie.

    Cookie same site

    The value if the entry exists, otherwise leave unset to indicate that no same site policy is defined.

    If there is anerror during this step, returnerror witherror codeunable to set cookie.

  8. Returnsuccess with datanull.

14.4Delete Cookie

HTTP MethodURI Template
DELETE/session/{session id}/cookie/{name}

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. Delete cookies using theURL variables["name"] as the filter argument.

  4. Returnsuccess with datanull.

14.5Delete All Cookies

HTTP MethodURI Template
DELETE/session/{session id}/cookie

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. Delete cookies, giving no filtering argument.

  4. Returnsuccess with datanull.

15.Actions

The Actions API provides a low-level interface for providing virtualized device input to the web browser. Conceptually, the Actions commands divide time into a series ofticks. Thelocal end sends a series of actions which correspond to the change in state, if any, of each input device during eachtick. For example, pressing a key is represented by an action sequence consisting of a single key input device and twoticks, the first containing akeyDown action, and the second akeyUp action, whereas a pinch-zoom input is represented by an action sequence consisting of threeticks and two pointer input devices of type touch, each performing a sequence of actionspointerDown, followed bypointerMove, and thenpointerUp.

Example 11

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.

When theremote end receives this, it will look at eachinput 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 ofinput sources, and there is no restriction regarding the length of each input's action list. This means, there is no requirement that all action lists have to be the same length. It is possible for oneinput source's action list may have more actions than another.

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).

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

Specific timing for the actions can also be expressed. Thepause action can be used to either (a) indicate a specific amount of time aninput source must wait, or (b) can be used to signify that the currentinput source must wait until all other actions in thetick are completed. For the former case, the currenttick being executed must wait for the longest pause to complete. For example, in this diagram:

Theremote end will dispatch thepointerDown action in the firsttick. In the secondtick, since source 1 declares apause of 5 seconds, theremote end will dispatch thepointerUp event for source 2, and will wait 5 seconds before moving on to executing the thirdtick.

In the event that onetick contains multiplepause durations, theremote end will wait the maximum duration before moving on to executing the nexttick.

As noted before,pause can be used to signify inaction during atick. Ifpause is declared without a time period, then theinput source will not have any actions executed in the containingtick. As an example:

Duringtick 2, source 1 will have itspointerMove action dispatched, while source 2 will do nothing.

15.1Actions Options

Configuration of actions dispatch is controlled by aactions options object. This is astruct that has afields namedis element origin, which is a set of stepsthat validate if a protocol object represents an element origin,andget element origin, which is a set of stepsused to deserialize an element.

Toget a WebElement origingivensession,origin andbrowsingcontext:,

  1. Assert:browsing context is thecurrent browsing context.

  2. Letelement be equal to the result oftrying toget a known element withsession andorigin.

  3. Returnsuccess with dataelement.

15.2Input sources

Aninput source is a virtual device providing input events. Each input source is represented by anstruct specific to the type of the input source. Each input source has aninput id which is stored as a key in theinput state map.

Tocreate an input source giveninputstate,type and optionalsubtype:

  1. Run the substeps matching the first matching value oftype:

    "none"
    Letsource be the result ofcreate a null input source.
    "key"
    Letsource be the result ofcreate a key input source.
    "pointer"
    Letsource be the result ofcreate a pointer input source withinput state andsubtype.
    "wheel"
    Letsource be the result ofcreate a wheel input source.
    Otherwise:
    Returnerror witherror codeinvalid argument.
  2. Returnsuccess with datasource.

15.2.1Null input source

Anull input source is aninput source that is not associated with a specific physical device. anull input source has no type-specific items, and supports the following actions:

ActionNon-normative Description
pauseUsed with an integer argument to specify the duration of atick, or as a placeholder to indicate that aninput source does nothing during a particulartick.

Tocreate a null input source, return a newnull inputsource.

15.2.2Key input source

Akey input source is aninput source that is associated with a keyboard-type device.

Akey input source has the following items:

ItemNon-normative DescriptionDefault Value
pressedA set of strings representing currently pressed keys.Empty set
altA boolean indicating whether the alt modifier is depressed.False
ctrlA boolean indicating whether the ctrl modifier is depressed.False
metaA boolean indicating whether the meta modifier is depressed.False
shiftA boolean indicating whether the shift modifier is depressed.False

Akey input source supports the samepause actionas anull input source plus the following actions:

ActionNon-normative Description
keyDownUsed to indicate that a particular key should be held down.
keyUpUsed to indicate that a depressed key should be released.

Tocreate a key input source, return a newkeyinput source with the items initalized to their default values.

15.2.3Pointer input source

Apointer input source is aninput source that is associated with a pointer-type input device.

Apointer input source has the following items:

ItemNon-normative DescriptionDefault Value
subtypeThe type of pointing device. This can be "mouse", "pen", or "touch".
pointerIdThe numeric id of the pointing device. This is a positive integer, with the values 0 and 1 reserved for mouse-type pointers.
pressedA set of unsigned integers representing the pointer buttons that are currently depressed.Empty set
xAn unsigned integer representing the pointer x location in viewport coordinates.0
yAn unsigned integer representing the pointer y location in viewport coordinates.0

Apointer input source supports the samepause action as anull input source plus the following actions:

ActionNon-normative Description
pointerDownUsed to indicate that a pointer should be depressed in some way e.g. by holding a button down (for a mouse) or by coming into contact with the active surface (for a touch or pen device).
pointerUpUsed to indicate that a pointer should be released in some way e.g. by releasing a mouse button or moving a pen or touch device away from the active surface.
pointerMoveUsed to indicate a location on the screen that a pointer should move to, either in its active (pressed) or inactive state.
pointerCancelUsed to cancel a pointer action.

Tocreate a pointer input source object giveninput state, andsubtype, return a newpointer input source with subtype set tosubtype, pointerId set toget a pointer id withinput state andsubtype, and the other items set to their default values.

15.2.4Wheel input source

Awheel input source is aninput source that is associated with a wheel-type input device. Awheel input source has no type specific items, and supports the samepause action as anull input source plus the following actions:

ActionNon-normative Description
scrollUsed to indicate that the scroll wheel is rolled down, up, right or left to scroll the page down, up, right or left.

Tocreate a wheel input source return a newwheel input source.

15.3Input state

Aninput state represents the overall state of acollection ofinput sources.Aninput state has the following items:

Toget the input state givensessionandbrowsing context:

  1. Assert:browsing context is atop-level browsing context.

  2. Letinput state map besession'sbrowsing context input state map.

  3. Ifinput state map does notcontainbrowsing context, setinput state map[browsing context] tocreate an input state.

  4. Returninput state map[browsing context].

Toreset the input state givensessionandbrowsing context:

  1. Assert:browsing context is atop-level browsing context.

  2. Letinput state map besession'sbrowsing context input state map.

  3. Ifinput state map[browsing context]exists, thenremoveinput state map[browsing context].

Tocreate an input state:

  1. Letinput state be aninput state with theinput state map set to an empty map, and theinput cancel list set to an empty list.

  2. Returninput state.

Toadd an input source giveninput state,input id, andsource:

  1. Letinput state map beinput state'sinput state map.

  2. Setinput state map[input id] tosource.

Toremove an input source giveninput state,andinput id:

  1. Assert: None of the items ininput state'sinput cancel list has id equal toinput id.

  2. Letinput state map beinput state'sinput state map.

  3. Removeinput state map[input id].

Toget an input source giveninput stateandinput id:

  1. Letinput state map beinput state'sinput state map.

  2. Ifinput state map[input id] exists, returninput state map[input id].

  3. Return undefined.

Toget or create an input source giveninputstate,type,input id, andoptionalsubtype:

  1. Letsource beget an input source withinput state andinput id.

  2. Ifsource is not undefined andsource's type is not equal totype, orsource is apointer input source, returnerror witherror codeinvalid argument.

  3. Ifsource is undefined, setsource to the result oftrying tocreate an input source withinput state andtype.

  4. Return success with datasource.

Aglobal key state is astruct with items pressed,altKey, ctrlKey, metaKey, and shiftKey.

Toget the global key state giveninput state:

  1. Letinput state map beinput state'sinput state map.

  2. Letsources be the result ofgetting the values withinput state map.

  3. Letkey state be a newglobal key state withpressed set to an empty set,altKey,ctrlKey,metaKey, andshiftKey set to false.

  4. For eachsource insources:

    1. Ifsource is not akey input source, continue to the first step of this loop.

    2. Setkey state'spressed item to the union of its current value andsource's pressed item.

    3. Ifsource'salt item is true, setkey state'saltKey item to true.

    4. Ifsource'sctrl item is true, setkey state'sctrlKey item to true.

    5. Ifsource'smeta item is true, setkey state'smetaKey item to true.

    6. Ifsource'sshift item is true, setkey state'sshiftKey item to true.

  5. Returnkey state.

Toget a pointer id giveninput stateandsubtype:

  1. Letminimum id be 0 ifsubtype is "mouse", or 2 otherwise.
  2. Letpointer ids be an empty set.
  3. Letsources be the result ofgetting the values withinput state'sinput state map.

  4. For eachsource insources.:

    1. Ifsource is apointer input source, appendsource's pointerId topointer ids.

  5. Return the smallest integer that is greater than or equal tominimum id and that is not contained inpointer ids.

15.4Ticks

Atick is the basic unit of time over which actions can be performed. During atick, eachinput source has an assigned action — possibly a nooppause action — which may result in changes to the user agent internal state and eventually cause DOM events to befired at the page. The nexttick begins after the user agent has had a chance to process all DOM events generated in the currenttick.

Waiting asynchronously means waiting for something to occur whilst allowing the browser to continue processing theevent loop.

At the lowest level, the behavior of actions is intended to mimic theremote end's behavior with an actual input device as closely as possible, and the implementation strategy may involve e.g. injecting synthesized events into a browser event loop. Therefore the steps to dispatch an action will inevitably end up in implementation-specific territory. However there are certain content observable effects that must be consistent across implementations. To accommodate this, the specification requires thatremote endsperform implementation-specific action dispatch steps on abrowsing contextcontext, and alist of events and their properties. These steps must be equivalent to performing the given input device manipulations oncontext, such that trusted events corresponding to the entries inlist of eventsare dispatched.

Note

The list of events is not comprehensive; in particular the default action of theinput source may cause additional events to be generated depending on the implementation and the state of the browser (e.g. input events relating to key actions when the focus is on an editableelement, scroll events, etc.).

Note

Anactivation trigger generated by WebDriverneeds to be indistinguishable from those generated by a real user interacting with the browser.In particular, the dispatched eventswill have theisTrusted attribute set to true.

The most robust way to dispatch these events is by creating them inthe browser implementation itself. Sending operating system specificinput messages to the browser's window has the disadvantage that thebrowser being automated may not be properly isolated from a useraccidentally modifying aninput source. Use of an operatingsystem level accessibility API has the disadvantage that the browser'swindow must be focused, and as a result, multiple WebDriver instancescannot run in parallel.

The advantage of an operating system level accessibility APIis that it guarantees that inputs correctly mirror user input,and allows interaction with the host system if necessary.This might, however, have performance penaltiesfrom a machine utilisation perspective.

15.5Processing actions

The algorithm forextracting an action sequence from a request takes the JSONObject representing an action sequence, validates the input, and returns a data structure that is the transpose of the input JSON, such that the actions to be performed in a singletick are grouped together.

Toget coordinates relative to an origingivensource,x offset,y offset,origin,browsing context, andactionsoptions:

  1. Run the substeps of the first matching value oforigin

    "viewport"
    1. Letx equalx offset andy equaly offset.

    "pointer"
    1. Letstart x be equal to thex property ofsource.

    2. Letstart y be equal to they property ofsource.

    3. Letx equalstart x +x offset andy equalstart y +y offset.

    Otherwise
    1. Letelement be the result oftrying to runactions options'get element origin steps withorigin andbrowsing context.

    2. Ifelement is null, returnerror witherror codeno such element.

    3. Letx element andy element be the result of calculating thein-view center point ofelement.

    4. Letx equalx element +x offset, andy equaly element +y offset.

  2. Return (x,y)

Toextract an action sequence giveninput state,parameters, andactions options:

  1. Letactions be the result ofgetting a property named "actions" fromparameters.

  2. Ifactions isundefined or is not anArray, returnerror witherror codeinvalid argument.

  3. Letactions by tick be an emptyList.

  4. For each valueaction sequence corresponding to an indexed property inactions:

    1. Letsource actions be the result oftrying toprocess an input source action sequence giveninput state,action sequence, andactions options.

    2. For eachaction insource actions:

      1. Leti be the zero-based index ofaction insource actions.

      2. If the length ofactions by tick is less thani + 1, append a newList toactions by tick.

      3. Appendaction to theList at indexi inactions by tick.

  5. Returnsuccess with dataactions by tick.

When required toprocess an input source action sequence, giveninput state,action sequence, andactions options, aremote end must:

  1. Lettype be the result ofgetting a property named "type" fromaction sequence.

  2. Iftype is not "key", "pointer", "wheel", or "none", return anerror witherror codeinvalid argument.

  3. Letid be the result ofgetting the property "id" fromaction sequence.

  4. Ifid isundefined or is not aString, returnerror witherror codeinvalid argument.

  5. Iftype is equal to "pointer", letparameters data be the result ofgetting the property "parameters" fromaction sequence. Then letparameters be the result oftrying toprocess pointer parameters with argumentparameters data.

  6. Letsource be the result of trying toget or create an input source giveninput state,type andid.

  7. Ifparameters is notundefined, then if itspointerType property is not equal tosource's subtype property, return anerror witherror codeinvalid argument.

  8. Letaction items be the result ofgetting a property named "actions" fromaction sequence.

  9. Ifaction items is not anArray, returnerror witherror codeinvalid argument.

  10. Letactions be a new list.

  11. For eachaction item inaction items:

    1. Ifaction item is not anObject returnerror witherror codeinvalid argument.

    2. Iftype is "none" letaction be the result oftrying toprocess a null action with parametersid, andaction item.

    3. Otherwise, iftype is "key" letaction be the result oftrying toprocess a key action with parametersid, andaction item.

    4. Otherwise, iftype is "pointer" letaction be the result oftrying toprocess a pointer action with parametersid,parameters,action item, andactions options.

    5. Otherwise, iftype is "wheel" letaction be the result oftrying toprocess a wheel action with parametersid, andaction item, andactions options.

    6. Appendaction toactions.

  12. Returnsuccess with dataactions.

Thedefault pointer parameters consist of an object with propertypointerType set tomouse.

Toprocess pointer parameters givenparameters data:

  1. Letparameters be thedefault pointer parameters.

  2. Ifparameters data isundefined,returnsuccess with dataparameters.

  3. Ifparameters data is not anObject,returnerror witherror codeinvalid argument.

  4. Letpointer type be the resultofgetting a property named "pointerType"fromparameters data.

  5. Ifpointer type is notundefined:

    1. Ifpointer type does not have one of the values "mouse", "pen", or "touch", returnerror witherror codeinvalid argument.

    2. Set thepointerType property ofparameters topointer type.

  6. Returnsuccess with dataparameters.

Anaction object constructed with argumentsid,type, andsubtype is an object with property id set toid, type set totype and subtype set tosubtype. Specific action objects have further properties added by other algorithms in this specification.

Toprocess a null action givenid andaction item:

  1. Letsubtype be the result ofgetting a propertynamed "type" fromaction item.

  2. Ifsubtype is not "pause",returnerror witherror codeinvalid argument.

  3. Letaction be anaction object constructed with argumentsid,"none",andsubtype.

  4. Letresult be the resultoftrying toprocess a pause actionwith argumentsaction item andaction.

  5. Returnresult.

Toprocess a key action givenid andaction item:

  1. Letsubtype be the result ofgetting a propertynamed "type" fromaction item.

  2. Ifsubtype is not one of the values"keyUp","keyDown",or "pause",return anerror witherror codeinvalid argument.

  3. Letaction be anaction object constructed with argumentsid,"key",andsubtype.

  4. Ifsubtype is "pause",letresult be the resultoftrying toprocess a pause action with argumentsaction item andaction,and returnresult.

  5. Letkey be the result ofgetting a propertynamed "value" fromaction item.

  6. Ifkey is not aString containing a singleunicode code pointor grapheme cluster?returnerror witherror codeinvalid argument.

  7. Set thevalue property onaction tokey.

  8. Return success with dataaction.

Toprocess a pointer action givenid,parameters,action item, andactionoptions:

  1. Letsubtype be the resultofgetting a property named "type"fromaction item.

  2. Ifsubtype is not one of the values"pause","pointerUp","pointerDown","pointerMove",or "pointerCancel",return anerror witherror codeinvalid argument.

  3. Letaction be anaction object constructed with argumentsid,"pointer",andsubtype.

  4. Ifsubtype is "pause",letresult be the result oftrying toprocess a pause action with argumentsaction item,action, andactionsoptions, and returnresult.

  5. Set thepointerType property ofactionequal to thepointerType property ofparameters.

  6. Ifsubtype is "pointerUp" or "pointerDown",process a pointer up or pointer down action with argumentsaction item andaction.If doing so results in anerror, return thaterror.

  7. Ifsubtype is "pointerMove"process a pointer move action with argumentsaction item,action, andactionsoptions. If doing so results in anerror, returnthaterror.

  8. Ifsubtype is "pointerCancel"process a pointer cancel action.If doing so results in anerror, return thaterror.

  9. Returnsuccess with dataaction.

Toprocess a wheel action givenid,action item, andactionsoptions:

  1. Letsubtype be the resultofgetting a property named "type"fromaction item.

  2. Ifsubtype is not the value"pause", or"scroll",return anerror witherror codeinvalid argument.

  3. Letaction be anaction object constructed with argumentsid,"wheel",andsubtype.

  4. Ifsubtype is "pause",letresult be the result oftrying toprocess a pause action with argumentsaction item andaction,and returnresult.

  5. Letduration be the result ofgetting a propertynamed "duration" fromaction item.

  6. Ifduration is notundefined anddurationis not anInteger greater than or equal to 0, returnerrorwitherror codeinvalid argument.

  7. Set theduration property ofactiontoduration.

  8. Letorigin be the result ofgetting the propertyorigin fromaction item.

  9. Iforigin isundefined letorigin equal "viewport".

  10. Iforigin is not equal to "viewport",oractions options'is element origin steps givenorigin return false, returnerror witherror codeinvalid argument.

  11. Set theorigin property ofactiontoorigin.

  12. Letx be the result ofgetting the propertyx fromaction item.

  13. Ifx is not anInteger, returnerrorwitherror codeinvalid argument.

  14. Set thex property ofaction tox.

  15. Lety be the result ofgetting the propertyy fromaction item.

  16. Ify is not anInteger, returnerrorwitherror codeinvalid argument.

  17. Set they property ofaction toy.

  18. LetdeltaX be the result ofgetting the propertydeltaX fromaction item.

  19. IfdeltaX is not anInteger,returnerror witherror codeinvalid argument.

  20. Set thedeltaX property ofaction todeltaX.

  21. LetdeltaY be the result ofgetting the propertydeltaY fromaction item.

  22. IfdeltaY is not anInteger,returnerror witherror codeinvalid argument.

  23. Set thedeltaY property ofaction todeltaY.

  24. Returnsuccess with dataaction.

Toprocess a pause action givenaction item,andaction:

  1. Letduration be the result ofgetting the property "duration" fromaction item.

  2. Ifduration is notundefined andduration is not anInteger greater than or equal to 0, returnerror witherror codeinvalid argument.

  3. Set theduration property ofaction toduration.

  4. Return success with dataaction.

Toprocess a pointer up or pointer down action givenaction item, andaction:

  1. Letbutton be the result of getting the propertybutton fromaction item.

  2. Ifbutton is not anInteger greater than or equal to 0 returnerror witherror codeinvalid argument.

  3. Set thebutton property ofaction tobutton.

  4. Letwidth be the result of getting the propertywidth fromaction item.

  5. Ifwidth is notundefined andwidth is not aNumber greater than or equal to 0 returnerror witherror codeinvalid argument.

  6. Set thewidth property ofaction towidth.

  7. Letheight be the result of getting the propertyheight fromaction item.

  8. Ifheight is notundefined andheight is not aNumber greater than or equal to 0 returnerror witherror codeinvalid argument.

  9. Set theheight property ofaction toheight.

  10. Letpressure be the result of getting the propertypressure fromaction item.

  11. Ifpressure is notundefined andpressure is not aNumber greater than or equal to 0 and less than or equal to 1 returnerror witherror codeinvalid argument.

  12. Set thepressure property ofaction topressure.

  13. LettangentialPressure be the result of getting the propertytangentialPressure fromaction item.

  14. IftangentialPressure is notundefined andtangentialPressure is not aNumber greater than or equal to -1 and less than or equal to 1 returnerror witherror codeinvalid argument.

  15. Set thetangentialPressure property ofaction totangentialPressure.

  16. LettiltX be the result of getting the propertytiltX fromaction item.

  17. IftiltX is notundefined andtiltX is not anInteger greater than or equal to -90 and less than or equal to 90 returnerror witherror codeinvalid argument.

  18. Set thetiltX property ofaction totiltX.

  19. LettiltY be the result of getting the propertytiltY fromaction item.

  20. IftiltY is notundefined andtiltY is not anInteger greater than or equal to -90 and less than or equal to 90 returnerror witherror codeinvalid argument.

  21. Set thetiltY property ofaction totiltY.

  22. Lettwist be the result of getting the propertytwist fromaction item.

  23. Iftwist is notundefined andtwist is not anInteger greater than or equal to 0 and less than or equal to 359 returnerror witherror codeinvalid argument.

  24. Set thetwist property ofaction totwist.

  25. LetaltitudeAngle be the result of getting the propertyaltitudeAngle fromaction item.

  26. IfaltitudeAngle is notundefined andaltitudeAngle is not aNumber greater than or equal to 0 and less than or equal to π/2 returnerror witherror codeinvalid argument.

  27. Set thealtitudeAngle property ofaction toaltitudeAngle.

  28. LetazimuthAngle be the result of getting the propertyazimuthAngle fromaction item.

  29. IfazimuthAngle is notundefined andazimuthAngle is not aNumber greater than or equal to 0 and less than or equal to 2π returnerror witherror codeinvalid argument.

  30. Set theazimuthAngle property ofaction toazimuthAngle.

  31. Return success with datanull.

Toprocess a pointer move action givenactionitem,action, andactions options:

  1. Letduration be the result of getting the propertyduration fromaction item.

  2. Ifduration is notundefined andduration is not anInteger greater than or equal to 0, returnerror witherror codeinvalid argument.

  3. Set theduration property ofaction toduration.

  4. Letorigin be the result ofgetting the propertyorigin fromaction item.

  5. Iforigin isundefined letorigin equal "viewport".

  6. Iforigin is not equal to "viewport" or "pointer", andactions optionsis element origin steps givenorigin return false, returnerror witherror codeinvalid argument.

  7. Set theorigin property ofaction toorigin.

  8. Letx be the result ofgetting the propertyx fromaction item.

  9. Ifx is not aNumber, returnerror witherror codeinvalid argument.

  10. Set thex property ofaction tox.

  11. Lety be the result ofgetting the propertyy fromaction item.

  12. Ify is not aNumber, returnerror witherror codeinvalid argument.

  13. Set they property ofaction toy.

  14. Letwidth be the result of getting the propertywidth fromaction item.

  15. Ifwidth is notundefined andwidth is not aNumber greater than or equal to 0 returnerror witherror codeinvalid argument.

  16. Set thewidth property ofaction towidth.

  17. Letheight be the result of getting the propertyheight fromaction item.

  18. Ifheight is notundefined andheight is not aNumber greater than or equal to 0 returnerror witherror codeinvalid argument.

  19. Set theheight property ofaction toheight.

  20. Letpressure be the result of getting the propertypressure fromaction item.

  21. Ifpressure is notundefined andpressure is not aNumber greater than or equal to 0 and less than or equal to 1 returnerror witherror codeinvalid argument.

  22. Set thepressure property ofaction topressure.

  23. LettangentialPressure be the result of getting the propertytangentialPressure fromaction item.

  24. IftangentialPressure is notundefined andtangentialPressure is not aNumber greater than or equal to -1 and less than or equal to 1 returnerror witherror codeinvalid argument.

  25. Set thetangentialPressure property ofaction totangentialPressure.

  26. LettiltX be the result of getting the propertytiltX fromaction item.

  27. IftiltX is notundefined andtiltX is not anInteger greater than or equal to -90 and less than or equal to 90 returnerror witherror codeinvalid argument.

  28. Set thetiltX property ofaction totiltX.

  29. LettiltY be the result of getting the propertytiltY fromaction item.

  30. IftiltY is notundefined andtiltY is not anInteger greater than or equal to -90 and less than or equal to 90 returnerror witherror codeinvalid argument.

  31. Set thetiltY property ofaction totiltY.

  32. Lettwist be the result of getting the propertytwist fromaction item.

  33. Iftwist is notundefined andtwist is not anInteger greater than or equal to 0 and less than or equal to 359 returnerror witherror codeinvalid argument.

  34. Set thetwist property ofaction totwist.

  35. LetaltitudeAngle be the result of getting the propertyaltitudeAngle fromaction item.

  36. IfaltitudeAngle is notundefined andaltitudeAngle is not aNumber greater than or equal to 0 and less than or equal to π/2 returnerror witherror codeinvalid argument.

  37. Set thealtitudeAngle property ofaction toaltitudeAngle.

  38. LetazimuthAngle be the result of getting the propertyazimuthAngle fromaction item.

  39. IfazimuthAngle is notundefined andazimuthAngle is not aNumber greater than or equal to 0 and less than or equal to 2π returnerror witherror codeinvalid argument.

  40. Set theazimuthAngle property ofaction toazimuthAngle.

  41. Return success with datanull.

15.6Dispatching actions

The algorithm todispatch actions takes a list of actions grouped bytick, and then causes each action to be run at the appropriate point in the sequence.

Towait for an action queue token giveninput state:

  1. Lettoken be a new unique identifier.

  2. Enqueuetoken ininput state'sactions queue.

  3. Wait fortoken to be the first item ininput state'sactions queue.

    Note

    This ensures that only one set of actions can be run at a time, and therefore different actions commands using the same underlying state don't race. In a session that is only a HTTP session only one command can run at a time, so this will never block. But other session types can allow running multiple commands in parallel, in which case this is necessary to ensure sequential access.

Todispatch actions giveninputstate,actions by tick,browsingcontext, andactions options:

  1. Wait for an action queue token withinput state.

  2. Letactions result be the result ofdispatch actions inner withinput state,actions by tick,browsing context, andactions options.

  3. Dequeueinput state'sactions queue.

    Assert: this returnstoken

  4. Returnactions result.

Todispatch actions inner giveninputstate,actions by tick,browsingcontext, andactions options:

  1. For each itemtick actions inactions by tick:

    1. Ifbrowsing context isno longer open, returnerror witherror codeno such window.
    2. Lettick duration be the result ofcomputing the tick duration with argumenttick actions.

    3. Try todispatch tick actions withinput state,tick actions,tick duration,browsing context, andactions options.

    4. Wait until the following conditions are all met:

  2. Return success with datanull.

Tocompute the tick duration giventick actions:

  1. Letmax duration be 0.

  2. For eachaction object intick actions:

    1. letduration beundefined.

    2. Ifaction object has subtype property set to "pause" oraction object has type property set to "pointer" and subtype property set to "pointerMove", oraction object has type property set to "wheel" and subtype property set to "scroll", letduration be equal to theduration property ofaction object.

    3. Ifduration is notundefined, andduration is greater thanmax duration, letmax duration be equal to duration.

  3. Returnmax duration.

Todispatch tick actions giveninput state,tick actions,tick duration,browsing context, andactions options:

  1. For eachaction object intick actions:

    1. Letinput id be equal to the value ofaction object's id property.

    2. Letsource type be equal to the value ofaction object's type property.

    3. Letsource be the result ofget an input source giveninput state andinput id.

    4. Assert:source is not undefined.

    5. Letglobal key state be the result ofget the global key state withinput state.

    6. Letsubtype beaction object's subtype.

    7. Letalgorithm be the value of the columndispatch action algorithm from the following table where thesource type column issource type and thesubtype column is equal tosubtype.

      source typesubtypeDispatch action algorithm
      "none""pause"Dispatch a pause action
      "key""pause"Dispatch a pause action
      "key""keyDown"Dispatch a keyDown action
      "key""keyUp"Dispatch a keyUp action
      "pointer""pause"Dispatch a pause action
      "pointer""pointerDown"Dispatch a pointerDown action
      "pointer""pointerUp"Dispatch a pointerUp action
      "pointer""pointerMove"Dispatch a pointerMove action
      "pointer""pointerCancel"Dispatch a pointerCancel action
      "wheel""pause"Dispatch a pause action
      "wheel""scroll"Dispatch a scroll action
    8. Try to runalgorithm with argumentsaction object,source,global key state,tick duration,browsing context, andactions options.
    9. Ifsubtype is "keyDown", append a copy ofaction object with thesubtype property changed to "keyUp" toinput state'sinput cancel list.

    10. Ifsubtype is "pointerDown", append a copy ofaction object with thesubtype property changed to "pointerUp" toinput state'sinput cancel list.

  2. Returnsuccess with datanull.

Todispatch a list of actions giveninputstate,actions,browsing context,andactions options:

Note

This is an entry point for other commands that are written in terms of a sequence of actions of a single input source in a single tick.

  1. Lettick actions be the list «actions»

  2. Letactions by tick be the list «tick actions».

  3. Return the result ofdispatch actions withinput state,actions by tick,browsing context, andactions options.

15.6.1General actions

Todispatch a pause action givenactionobject,source,global keystate,tick duration,browsing context, andactions options:

  1. Returnsuccess with datanull.

15.6.2Keyboard actions

Thenormalized key value for a raw keykey is, ifkey appears in the table below, the string value in the second column on the row containingkey'sunicode code point in the first column, otherwise it iskey.

key's codepointNormalized key value
\uE000"Unidentified"
\uE001"Cancel"
\uE002"Help"
\uE003"Backspace"
\uE004"Tab"
\uE005"Clear"
\uE006"Return"
\uE007"Enter"
\uE008"Shift"
\uE009"Control"
\uE00A"Alt"
\uE00B"Pause"
\uE00C"Escape"
\uE00D" "
\uE00E"PageUp"
\uE00F"PageDown"
\uE010"End"
\uE011"Home"
\uE012"ArrowLeft"
\uE013"ArrowUp"
\uE014"ArrowRight"
\uE015"ArrowDown"
\uE016"Insert"
\uE017"Delete"
\uE018";"
\uE019"="
\uE01A"0"
\uE01B"1"
\uE01C"2"
\uE01D"3"
\uE01E"4"
\uE01F"5"
\uE020"6"
\uE021"7"
\uE022"8"
\uE023"9"
\uE024"*"
\uE025"+"
\uE026","
\uE027"-"
\uE028"."
\uE029"/"
\uE031"F1"
\uE032"F2"
\uE033"F3"
\uE034"F4"
\uE035"F5"
\uE036"F6"
\uE037"F7"
\uE038"F8"
\uE039"F9"
\uE03A"F10"
\uE03B"F11"
\uE03C"F12"
\uE03D"Meta"
\uE040"ZenkakuHankaku"
\uE050"Shift"
\uE051"Control"
\uE052"Alt"
\uE053"Meta"
\uE054"PageUp"
\uE055"PageDown"
\uE056"End"
\uE057"Home"
\uE058"ArrowLeft"
\uE059"ArrowUp"
\uE05A"ArrowRight"
\uE05B"ArrowDown"
\uE05C"Insert"
\uE05D"Delete"

Thecode forkey is the value in the last column of the following table on the row withkey in either the first or second column, if any such row exists, otherwise it isundefined.

Ashifted character is one that appears in the second column of the following table.

KeyAlternate Keycode
"`""~""Backquote"
"\""|""Backslash"
"\uE003""Backspace"
"[""{""BracketLeft"
"]""}""BracketRight"
",""<""Comma"
"0"")""Digit0"
"1""!""Digit1"
"2""@""Digit2"
"3""#""Digit3"
"4""$""Digit4"
"5""%""Digit5"
"6""^""Digit6"
"7""&""Digit7"
"8""*""Digit8"
"9""(""Digit9"
"=""+""Equal"
"<"">""IntlBackslash"
"a""A""KeyA"
"b""B""KeyB"
"c""C""KeyC"
"d""D""KeyD"
"e""E""KeyE"
"f""F""KeyF"
"g""G""KeyG"
"h""H""KeyH"
"i""I""KeyI"
"j""J""KeyJ"
"k""K""KeyK"
"l""L""KeyL"
"m""M""KeyM"
"n""N""KeyN"
"o""O""KeyO"
"p""P""KeyP"
"q""Q""KeyQ"
"r""R""KeyR"
"s""S""KeyS"
"t""T""KeyT"
"u""U""KeyU"
"v""V""KeyV"
"w""W""KeyW"
"x""X""KeyX"
"y""Y""KeyY"
"z""Z""KeyZ"
"-""_""Minus"
"."".""Period"
"'"""""Quote"
";"":""Semicolon"
"/""?""Slash"
"\uE00A""AltLeft"
"\uE052""AltRight"
"\uE009""ControlLeft"
"\uE051""ControlRight"
"\uE006""Enter"
"\uE00B""Pause"
"\uE03D""MetaLeft"
"\uE053""MetaRight"
"\uE008""ShiftLeft"
"\uE050""ShiftRight"
" ""\uE00D""Space"
"\uE004""Tab"
"\uE017""Delete"
"\uE010""End"
"\uE002""Help"
"\uE011""Home"
"\uE016""Insert"
"\uE00F""PageDown"
"\uE00E""PageUp"
"\uE015""ArrowDown"
"\uE012""ArrowLeft"
"\uE014""ArrowRight"
"\uE013""ArrowUp"
"\uE00C""Escape"
"\uE031""F1"
"\uE032""F2"
"\uE033""F3"
"\uE034""F4"
"\uE035""F5"
"\uE036""F6"
"\uE037""F7"
"\uE038""F8"
"\uE039""F9"
"\uE03A""F10"
"\uE03B""F11"
"\uE03C""F12"
"\uE019""NumpadEqual"
"\uE01A""\uE05C""Numpad0"
"\uE01B""\uE056""Numpad1"
"\uE01C""\uE05B""Numpad2"
"\uE01D""\uE055""Numpad3"
"\uE01E""\uE058""Numpad4"
"\uE01F""Numpad5"
"\uE020""\uE05A""Numpad6"
"\uE021""\uE057""Numpad7"
"\uE022""\uE059""Numpad8"
"\uE023""\uE054""Numpad9"
"\uE025""NumpadAdd"
"\uE026""NumpadComma"
"\uE028""\uE05D""NumpadDecimal"
"\uE029""NumpadDivide"
"\uE007""NumpadEnter"
"\uE024""NumpadMultiply"
"\uE027""NumpadSubtract"

Thekey location forkey is the value in the last column in the table below on the row withkey appears in the first column, if such a row exists, otherwise it is0.

key's codepointDescriptionLocation
\uE007Enter1
\uE008Left Shift1
\uE009Left Control1
\uE00ALeft Alt1
\uE019Numpad =3
\uE01ANumpad 03
\uE01BNumpad 13
\uE01CNumpad 23
\uE01DNumpad 33
\uE01ENumpad 43
\uE01FNumpad 53
\uE020Numpad 63
\uE021Numpad 73
\uE022Numpad 83
\uE023Numpad 93
\uE024Numpad *3
\uE025Numpad +3
\uE026Numpad ,3
\uE027Numpad -3
\uE028Numpad .3
\uE029Numpad /3
\uE03DLeft Meta1
\uE050Right Shift2
\uE051Right Control2
\uE052Right Alt2
\uE053Right Meta2
\uE054Numpad PageUp3
\uE055Numpad PageDown3
\uE056Numpad End3
\uE057Numpad Home3
\uE058Numpad ArrowLeft3
\uE059Numpad ArrowUp3
\uE05ANumpad ArrowRight3
\uE05BNumpad ArrowDown3
\uE05CNumpad Insert3
\uE05DNumpad Delete3

Todispatch a keyDown action givenactionobject,source,global key state,tickduration,browsing context, andactions options:

  1. Letraw key be equal to theaction object'svalue property.

  2. Letkey be equal to thenormalized key value forraw key.

  3. If thesource'spressed property containskey, letrepeat be true, otherwise letrepeat be false.

  4. Letcode be thecode forraw key.

  5. Letlocation be thekey location forraw key.

  6. LetcharCode,keyCode andwhich be the implementation-specific values of thecharCode,keyCode andwhich properties appropriate for a key with keykey and locationlocation on a 102 key US keyboard, following the guidelines in [UI-EVENTS].

  7. Ifkey is"Alt", letsource'salt property be true.

  8. Ifkey is"Shift", letsource'sshift property be true.

  9. Ifkey is"Control", letsource'sctrl property be true.

  10. Ifkey is"Meta", letsource'smeta property be true.

  11. Addkey tosource'spressed property.

  12. Perform implementation-specific action dispatch steps onbrowsing context equivalent to pressing a key on the keyboard in accordance with the requirements of [UI-EVENTS], and producing the following events, as appropriate, with the specified properties. This will always produce events including at least akeyDown event.

    • keyDown with properties:
      AttributeValue
      keykey
      codecode
      locationlocation
      altKeysource'salt property
      shiftKeysource'sshift property
      ctrlKeysource'sctrl property
      metaKeysource'smeta property
      repeatrepeat
      isComposingfalse
      charCodecharCode
      keyCodekeyCode
      whichwhich
    • keyPress with properties:
      AttributeValue
      keykey
      codecode
      locationlocation
      altKeysource'salt property
      shiftKeysource'sshift property
      ctrlKeysource'sctrl property
      metaKeysource'smeta property
      repeatrepeat
      isComposingfalse
      charCodecharCode
      keyCodekeyCode
      whichwhich
  13. Returnsuccess with datanull.

Note

A singlekeyDown action produces a single key input, irrespective of how long the key is held down; there is no implicit key repetition.

Todispatch a keyUp action given,actionobject,source,global key state,tick duration,browsing context,andactions options:

  1. Letraw key be equal toaction object'svalue property.

  2. Letkey be equal to thenormalized key value forraw key.

  3. If thesource'spressed item does not containkey, return.

  4. Letcode be thecode forraw key.

  5. Letlocation be thekey location forraw key.

  6. LetcharCode,keyCode andwhich be the implementation-specific values of thecharCode,keyCode andwhich properties appropriate for a key with keykey and locationlocation on a 102 key US keyboard, following the guidelines in [UI-EVENTS].

  7. Ifkey is "Alt", letsource'salt property be false.

  8. Ifkey is "Shift", letsource'sshift property be false.

  9. Ifkey is"Control", letsource'sctrl property be false.

  10. Ifkey is"Meta", letsource'smeta property be false.

  11. Removekey fromsources'spressed property.

  12. Perform implementation-specific action dispatch steps onbrowsing context equivalent to releasing a key on the keyboard in accordance with the requirements of [UI-EVENTS], and producing at least the following events with the specified properties:

    • keyup, with properties:
      AttributeValue
      keykey
      codecode
      locationlocation
      altKeysource'saltKey property
      shiftKeysource'sshift property
      ctrlKeysource'sctrl property
      metaKeysource'smeta property
      repeatfalse
      isComposingfalse
      charCodecharCode
      keyCodekeyCode
      whichwhich
  13. Returnsuccess with datanull.

15.6.3Pointer actions

Todispatch a pointerDown action givenaction object,source,global key state,tick duration,browsing context, andactions options:

  1. LetpointerType be equal toaction object'spointerType property.

  2. Letbutton be equal toaction object'sbutton property.

  3. If thesource'spressed property containsbutton returnsuccess with datanull.

  4. Letx be equal tosource'sx property.

  5. Lety be equal tosource'sy property.

  6. Addbutton to the set corresponding tosource'spressed property, and letbuttons be the resulting value of that property.

  7. Letwidth be equal toaction object'swidth property.

  8. Letheight be equal toaction object'sheight property.

  9. Letpressure be equal toaction object'spressure property.

  10. LettangentialPressure be equal toaction object'stangentialPressure property.

  11. LettiltX be equal toaction object'stiltX property.

  12. LettiltY be equal toaction object'stiltY property.

  13. Lettwist be equal toaction object'stwist property.

  14. LetaltitudeAngle be equal toaction object'saltitudeAngle property.

  15. LetazimuthAngle be equal toaction object'sazimuthAngle property.

  16. Perform implementation-specific action dispatch steps onbrowsing context equivalent to pressing the button numberedbutton on the pointer with pointerId equal tosource's pointerId, having typepointerType at viewport x coordinatex, viewport y coordinatey,width,height,pressure,tangentialPressure,tiltX,tiltY,twist,altitudeAngle,azimuthAngle, with buttonsbuttons depressed in accordance with the requirements of [UI-EVENTS] and [POINTER-EVENTS]. setctrlKey,shiftKey,altKey, andmetaKey equal to the corresponding items inglobal key state. Type specific properties for the pointer that are not exposed through the webdriver API must be set to the default value specified for hardware that doesn't support that property.

  17. Returnsuccess with datanull.

Todispatch a pointerUp action given,actionobject,source,global keystate,tick duration,browsing context,andactions options:

  1. LetpointerType be equal toaction object'spointerType property.

  2. Letbutton be equal toaction object'sbutton property.

  3. If thesource'spressed property does not containbutton, returnsuccess with datanull.

  4. Letx be equal tosource'sx property.

  5. Lety be equal tosource'sy property.

  6. Removebutton from the set corresponding tosource'spressed property, and letbuttons be the resulting value of that property.

  7. Perform implementation-specific action dispatch steps onbrowsing context equivalent to releasing the button numberedbutton on the pointer with pointerId equal toinput source's pointerId, having typepointerType at viewport x coordinatex, viewport y coordinatey, with buttonsbuttons depressed, in accordance with the requirements of [UI-EVENTS] and [POINTER-EVENTS]. The generated events must setctrlKey,shiftKey,altKey, andmetaKey equal to the corresponding items inglobal key state. Type specific properties for the pointer that are not exposed through the webdriver API must be set to the default value specified for hardware that doesn't support that property.

  8. Returnsuccess with datanull.

Todispatch a pointerMove action givenactionobject,source,global key state,tick duration,browsing context,andactions options:

  1. Letx offset be equal to thex property ofaction object.

  2. Lety offset be equal to they property ofaction object.

  3. Letorigin be equal to theorigin property ofaction object.

  4. Let (x,y) be the result oftrying toget coordinates relative to an origin withsource,x offset,y offset,origin,browsing context, andactions options.

  5. Ifx is less than 0 or greater than the width of the viewport inCSS pixels, then returnerror with error codemove target out of bounds.

  6. Ify is less than 0 or greater than the height of the viewport inCSS pixels, then returnerror with error codemove target out of bounds.

  7. Letduration be equal toaction object'sduration property if it is notundefined, ortick duration otherwise.

  8. Ifduration is greater than 0 and inside any implementation-defined bounds,asynchronously wait for an implementation defined amount of time to pass.

    This wait allows the implementation to model the overall pointer move as a series of small movements occurring at an implementation defined rate (e.g. one movement per vsync).

  9. Letwidth be equal toaction object'swidth property.

  10. Letheight be equal toaction object'sheight property.

  11. Letpressure be equal toaction object'spressure property.

  12. LettangentialPressure be equal toaction object'stangentialPressure property.

  13. LettiltX be equal toaction object'stiltX property.

  14. LettiltY be equal toaction object'stiltY property.

  15. Lettwist be equal toaction object'stwist property.

  16. LetaltitudeAngle be equal toaction object'saltitudeAngle property.

  17. LetazimuthAngle be equal toaction object'sazimuthAngle property.

  18. Perform a pointer move with argumentssource,global key state,duration,start x,start y,x,y,width,height,pressure,tangentialPressure,tiltX,tiltY,twist,altitudeAngle,azimuthAngle.

  19. Returnsuccess with datanull.

Toperform a pointer move givensource,global key state,duration,start x,start y,target x,target y,width,height,pressure,tangentialPressure,tiltX,tiltY,twist,altitudeAngle,andazimuthAngle:

  1. Lettime delta be the time since the beginning of the currenttick, measured in milliseconds on a monotonic clock.

  2. Letduration ratio be the ratio oftime delta andduration, ifduration is greater than 0, or 1 otherwise.

  3. Ifduration ratio is 1, or close enough to 1 that the implementation will not further subdivide the move action, letlast be true. Otherwise letlast befalse.

  4. Iflast is true, letx equaltarget x andy equaltarget y.

    Otherwise letx equal an approximation toduration ratio × (target x -start x) +start x, andy equal an approximation toduration ratio × (target y -start y) +start y.

  5. Letcurrent x equal thex property ofinput state.

  6. Letcurrent y equal they property ofinput state.

  7. Ifx is not equal tocurrent x ory is not equal tocurrent y, run the following steps:

    1. Letbuttons be equal to input state'sbuttons property.

    2. Perform implementation-specific action dispatch steps onbrowsing context equivalent to moving the pointer with pointerId equal toinput source's pointerId, having typepointerType from viewport x coordinatecurrent x, viewport y coordinatecurrent y to viewport x coordinatex and viewport y coordinatey,width,height,pressure,tangentialPressure,tiltX,tiltY,twist,altitudeAngle,azimuthAngle, with buttonsbuttons depressed, in accordance with the requirements of [UI-EVENTS] and [POINTER-EVENTS]. The generated events must setctrlKey,shiftKey,altKey, andmetaKey equal to the corresponding items inglobal key state. Type specific properties for the pointer that are not exposed through the WebDriver API must be set to the default value specified for hardware that doesn't support that property. In the case where thepointerType is "pen" or "touch", andbuttons is empty, this may be a no-op. For a pointer of type "mouse" this will always produce events including at least apointerMove event.

    3. Letinput state'sx property equalx andy property equaly.

  8. Iflast is true, return.

  9. Run the following substepsin parallel:

    1. Asynchronously wait for an implementation defined amount of time to pass.

      This wait allows the implementation to model the overall pointer move as a series of small movements occurring at an implementation defined rate (e.g. one movement per vsync).

    2. Perform a pointer move with argumentsinput state,duration,start x,start y,target x,target y.

Todispatch a pointerCancel action givenactionobject,source,global key state,tick duration,browsing context,andactions options:

  1. Perform implementation-specific action dispatch steps onbrowsing context equivalent to cancelling the any action of the pointer with pointerId equal tosource's pointerId item. having typepointerType, in accordance with the requirements of [UI-EVENTS] and [POINTER-EVENTS].

  2. Returnsuccess with datanull.

15.6.4Wheel actions

Todispatch a scroll action givenactionobject,source,global key state,tick duration,browsing context,andactions options:

  1. Letx offset be equal to thex property ofaction object.

  2. Lety offset be equal to they property ofaction object.

  3. Letorigin be equal to theorigin property ofaction object.

  4. Let (x,y) be the result oftrying toget coordinates relative to an origin withsource,x offset,y offset,origin,browsing context, andactions options.

  5. Ifx is less than 0 or greater than the width of the viewport inCSS pixels, then returnerror with error codemove target out of bounds.

  6. Ify is less than 0 or greater than the height of the viewport inCSS pixels, then returnerror with error codemove target out of bounds.

  7. Letdelta x be equal to thedeltaX property ofaction object.

  8. Letdelta y be equal to thedeltaY property ofaction object.

  9. Letduration be equal toaction object'sduration property if it is notundefined, ortick duration otherwise.

  10. Ifduration is greater than 0 and inside any implementation-defined bounds,asynchronously wait for an implementation defined amount of time to pass.

    This wait allows the implementation to model the overall wheel scroll as a series of small scroll occurring at an implementation defined rate (e.g. one scroll per vsync).

  11. Perform a scroll with argumentsglobal key state,duration,x,y,delta x,delta y,0,0.

  12. Returnsuccess with datanull.

Toperform a scroll givenduration,x,y,target delta x,target delta y,current delta x andcurrent delta y:

  1. Lettime delta be the time since the beginning of the currenttick, measured in milliseconds on a monotonic clock.

  2. Letduration ratio be the ratio oftime delta andduration, ifduration is greater than 0, or 1 otherwise.

  3. Ifduration ratio is 1, or close enough to 1 that the implementation will not further subdivide the move action, letlast be true. Otherwise letlast befalse.

  4. Iflast is true, letdelta x equaltarget delta x -current delta x anddelta y equaltarget delta y -current delta y.

    Otherwise letdelta x equal an approximation toduration ratio ×target delta x -current delta x, anddelta y equal an approximation toduration ratio ×target delta y -current delta y.

  5. Ifdelta x is not equal to0 ordelta y is not equal to0, run the following steps:

    1. Perform implementation-specific action dispatch steps onbrowsing context equivalent to wheel scroll at viewport x coordinatex, viewport y coordinatey, deltaX valuedelta x, deltaY valuedelta y, in accordance with the requirements of [UI-EVENTS]. The generated events must setctrlKey,shiftKey,altKey, andmetaKey equal to the corresponding items inglobal key state.

    2. Letcurrent delta x property equaldelta x +current delta x andcurrent delta y property equaldelta y +current delta y.

  6. Iflast is true, return.

  7. Run the following substepsin parallel:

    1. Asynchronously wait for an implementation defined amount of time to pass.

      This wait allows the implementation to model the overall scroll as a series of small scrolls occurring at an implementation defined rate (e.g. one scroll per vsync).

    2. Perform a scroll with argumentsduration,x,y,target delta x,target delta y,current delta x,current delta y.

15.7Perform Actions

HTTP MethodURI Template
POST/session/{session id}/actions

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. Letinput state be the result ofget the input state withsession andsession'scurrent top-level browsing context.

  4. Letactions options be a newactions options with theis element origin steps set torepresents a web element, and theget element origin steps set toget a WebElement origin.

  5. Letactions by tick be the result oftrying toextract an action sequence withinput state,parameters, andactions options.

  6. Dispatch actions withinput state,actions by tick,current browsing context, andactions options. If this results in anerror return that error.

  7. Returnsuccess with datanull.

15.8Release Actions

HTTP MethodURI Template
DELETE/session/{session id}/actions
Note

TheRelease Actionscommandis used to release all the keys and pointer buttonsthat are currently depressed.This causes events to befiredas if the state was released by an explicit series of actions.It also clears all the internal state of the virtual devices.

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. Letinput state be the result ofget the input state withsession andcurrent top-level browsing context.

  4. Letactions options be a newactions options with theis element origin steps set torepresents a web element, and theget element origin steps set toget a WebElement origin.

  5. Wait for an action queue token withinput state.

  6. Letundo actions beinput state'sinput cancel list in reverse order.

  7. Try todispatch actions withinput state,undo actions,current browsing context, andactions options.

  8. Reset the input state withsession andsession'scurrent top-level browsing context.

  9. Returnsuccess with datanull.

16.User prompts

This chapter describes interaction with various types ofuser prompts. The common denominator for user prompts is that they are modal windows requiring users to interact with them before theevent loop isunpaused and control is returned tosession'scurrent top-level browsing context.

By defaultuser prompts are not handled automatically unless auser prompt handler has been defined. When auser prompt appears, it is the task of the subsequentcommand to handle it. If the subsequent requestedcommand is not one listed in this chapter, anunexpected alert openerror will be returned.

Wheneveractive sessions is a list containing exactly oneitem, and that item is aHTTP session, but is not aBiDisession, then in thesteps to fire beforeunload,implementations must act as if showing an unload prompt is likely tobe annoying, deceptive, or pointless.

Note

This means that beforeunload prompts are never shownwhen there's an active HTTP-only session.

Auser prompt has an associateduser prompt message that is the string message shown to the user, ornull if the message length is0.

Toget the active user prompt givenbrowsing context:

  1. Letagent bebrowsing context'sactive document'srelevant agent.

  2. Ifagent'sevent loop is not currentlypaused, return null.

  3. Return theuser prompt which handles the input required to meet the condition passed whenevent loop waspaused.

Thecurrent user prompt is the result ofget theactive user prompt withcurrent browsing context.

Todismiss auser prompt, act as if the user clicked theCancel button on that prompt, if present, or otherwiseaccept the prompt.

Toaccept auser prompt, act as if the user clicked theOK button on that prompt.

16.1User Prompt Handler

Aremote end has auser prompt handler whichdefines how a WebDriver session will react when a user prompt isdisplayed. It is either null or amap between stringsandprompt handler configuration values. Initially it is null.

Aprompt handler configuration is astruct with twoitems; ahandler, which is astring, and anotify,which is a boolean.

Toserialize a prompt handler configurationgivenconfiguration:

  1. Letserialized beconfiguration'shandler.

  2. If «"dismiss", "acceptcontainsserialized, andconfiguration'snotify is true, append " and notify" toserialized.

  3. Returnserialized.

Theknown prompt handlers are:
Handler keyDescription (non-normative).
"dismiss"Allsimple dialogs encountered should bedismissed.
"accept"Allsimple dialogs encountered should beaccepted.
"dismiss and notify"Allsimple dialogs encountered should bedismissed, and an error returned that the dialog was handled.
"accept and notify"Allsimple dialogs encountered should beaccepted, and an error returned that the dialog was handled.
"ignore"Allsimple dialogs encountered should be left to the user to handle.

Thevalid prompt types are «"alert","beforeUnload", "confirm","default", "file", "prompt"».

Note

The "default" type represents a fallbackwhen no specific handler is defined for a given prompt type, includingthe "beforeUnload" prompt type. It can only be set if theunhandled prompt behavior is amap whichcontains "default". For HTTP-only sessions settingunhandled prompt behavior as a string value, the value will be assigned tothe internal type "fallbackDefault". The"fallbackDefault" value is not used for the"beforeUnload" prompt type, instead it falls back to the"accept" handler. This is because HTTP-only sessions do notallow the "beforeUnload" handler to be customized, and enablingother protocols isn't expected to change the user prompt handling as aside effect.

Note

The "file" prompt type is respected only in[WebDriver-BiDi] sessions.

Todeserialize as an unhandled prompt behavior givenargumentvalue:

  1. Setvalue to the result ofconverting a JSON-derived JavaScript value to an Infra value withvalue.

  2. Ifvalue is not a string, an implementation that does not also support [WebDriver-BiDi] may returnerror witherror codeinvalid argument.

    Note

    This is to avoid [WebDriver-BiDi] monkey-patching the current spec.

  3. Letis string value be false.

  4. Ifvalue is astring setvalue to themap «["fallbackDefault" →value]» and setis string value to true.

  5. Ifvalue is not amap returnerror witherror codeinvalid argument.

  6. Letuser prompt handler be an emptymap.
  7. For eachprompt typehandler invalue:

    1. Ifis string value is false andvalid prompt types does notcontainprompt type returnerror witherror codeinvalid argument.

    2. Ifknown prompt handlers does not contain an entry withhandler keyhandler returnerror witherror codeinvalid argument.

    3. Letnotify be false.

    4. Ifhandler is "accept and notify", sethandler to "accept" andnotify to true.

    5. Ifhandler is "dismiss and notify", sethandler to "dismiss" andnotify to true.

    6. Ifhandler is "ignore", setnotify to true.

    7. Letconfiguration be aprompt handler configuration withhandlerhandler andnotifynotify.

    8. Setuser prompt handler[prompt type] toconfiguration.

  8. Returnsuccess with datauser prompt handler.

Tocheck user prompt handler matchesgivenrequested prompt handler:

  1. If theuser prompt handler is null, return true.

  2. For eachrequest prompt typerequest handler inrequested prompt handler:

    1. If theuser prompt handlercontainsrequest prompt type:

      1. If therequested prompt handler'shandler is not equal to theuser prompt handler'shandler, return false.

  3. Return true
Note

This does not check therequested prompthandler'snotify matchesthehandler, because thenotify component only affects theHTTP session, if any.

Toupdate the user prompt handler givenrequested prompt handler:

  1. If theuser prompt handler is null, set theuser prompt handler to an empty map.

  2. For eachrequest prompt typerequest handler inrequested prompt handler:

    1. Setuser prompt handler[request prompt type] torequest handler.

Toserialize the user prompt handler:

  1. If theuser prompt handler is null, return "dismiss and notify".

  2. If theuser prompt handler hassize 1, anduser prompt handlercontains "fallbackDefault", return the result ofserialize a prompt handler configuration withuser prompt handler["fallbackDefault"].

  3. Letserialized be an emptymap.

  4. For eachkeyvalue ofuser prompt handler:

    1. Setserialized[key] toserialize a prompt handler configuration withvalue.

  5. Returnconvert an Infra value to a JSON-compatible JavaScript value withserialized.

Anannotated unexpected alert open error is anerror witherror codeunexpected alert open and an optionalerror data dictionary with the following entries:

"text"
Thecurrent user prompt'smessage.

Toget the prompt handlertype:

  1. If theuser prompt handler is null, lethandlers be an empty map. Otherwise lethandlers beuser prompt handler.

  2. Ifhandlers containstype returnhandlers[type].

  3. Ifhandlers contains "default" returnhandlers["default"].

  4. Iftype is "beforeUnload", return aprompt handler configuration withhandler "accept" andnotify false.

  5. Ifhandlers contains "fallbackDefault" returnhandlers["fallbackDefault"].

  6. Return aprompt handler configuration withhandler "dismiss" andnotify true.

Tohandle any user prompts:

  1. If thecurrent browsing context is not blocked by a dialog returnsuccess.

  2. Lettype be "default".

  3. If thecurrent user prompt is an alert dialog, settype to "alert". Otherwise, if thecurrent user prompt is a beforeunload dialog, settype to "beforeUnload". Otherwise, if thecurrent user prompt is a confirm dialog, settype to "confirm". Otherwise, if thecurrent user prompt is a prompt dialog, settype to "prompt".

  4. Lethandler beget the prompt handler withtype.

  5. Perform the following substeps based onhandler'shandler:

    "accept"

    Accept thecurrent user prompt.

    "dismiss"

    Dismiss thecurrent user prompt.

    "ignore"

    Do nothing.

  6. Ifhandler'snotifyis true, returnannotated unexpected alert open error.

  7. Returnsuccess.

Example 12

When returning anerror withunexpected alert open,aremote end may choose to return theuser prompt messageas part of an additional "data"Objecton theerror representation:

{"error":"unexpected alert open","message":"implementation defined","stacktrace":"","data": {"text":"the text from the alert"}}

16.2Dismiss Alert

HTTP MethodURI Template
POST/session/{session id}/alert/dismiss
Note

TheDismiss Alertcommanddismisses asimple dialogifpresent.A request todismiss an alertuser prompt,which may not necessarily have a dismiss button,has the same effect asaccepting it.

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent top-level browsing context isno longer open, returnerror witherror codeno such window.

  2. If thecurrent user prompt is null, returnerror witherror codeno such alert.

  3. Dismiss thecurrent user prompt.

  4. Returnsuccess with datanull.

16.3Accept Alert

HTTP MethodURI Template
POST/session/{session id}/alert/accept

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent top-level browsing context isno longer open, returnerror witherror codeno such window.

  2. If thecurrent user prompt is null, returnerror witherror codeno such alert.

  3. Accept thecurrent user prompt.

  4. Returnsuccess with datanull.

16.4Get Alert Text

HTTP MethodURI Template
GET/session/{session id}/alert/text

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent top-level browsing context isno longer open, returnerror witherror codeno such window.

  2. If thecurrent user prompt is null, returnerror witherror codeno such alert.

  3. Letmessage be the text message associated with thecurrent user prompt, or otherwise benull.

  4. Returnsuccess with datamessage.

16.5Send Alert Text

HTTP MethodURI Template
POST/session/{session id}/alert/text
Note

TheSend Alert Textcommandsets the text field of awindow.promptuser prompt to the given value.

Theremote end steps, givensession,URLvariables andparameters are:

  1. Lettext be the result ofgetting the property "text" fromparameters.

  2. Iftext is not aString, returnerror witherror codeinvalid argument.

  3. Ifsession'scurrent top-level browsing context isno longer open, returnerror witherror codeno such window.

  4. If thecurrent user prompt is null, returnerror witherror codeno such alert.

  5. Run the substeps for the API that created thecurrent user prompt:

    window.alert
    window.confirm

    Returnerror witherror codeelement not interactable.

    window.prompt

    Do nothing.

    Otherwise

    Returnerror witherror codeunsupported operation.

  6. Perform user agent dependent steps to set the value ofcurrent user prompt's text field totext.

  7. Returnsuccess with datanull.

17.Screen capture

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

WebDriver provides theTake Screenshotcommand to capture thetop-level browsing context'sinitial viewport, and acommandTake Element Screenshot for doing the same with the visible region of anelement'sbounding rectangle after it has beenscrolled into view.

In order todraw a bounding box from the framebuffer, given arectangle:

  1. If either theinitial viewport's width or height is 0CSS pixels, returnerror witherror codeunable to capture screen.

  2. Letpaint width be theinitial viewport's width –min(rectangle x coordinate,rectangle x coordinate +rectangle width dimension).

  3. Letpaint height be theinitial viewport's height –min(rectangle y coordinate,rectangle y coordinate +rectangle height dimension).

  4. Letcanvas be a newcanvas element, and set itswidth andheight topaint width andpaint height, respectively.

  5. Letcontext, acanvas context mode, be the result of invoking the2D context creation algorithm givencanvas as the target.

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

    X coordinate
    rectangle x coordinate
    Y coordinate
    rectangle y coordinate
    Width
    paint width
    Height
    paint height
  7. Returnsuccess withcanvas.

Toencode a canvas as Base64 acanvaselement:

  1. If thecanvas element's bitmap'sorigin-clean flag is set to false, returnerror witherror codeunable to capture screen.

  2. If thecanvas element's bitmap has no pixels (i.e. either its horizontal dimension or vertical dimension is zero) then returnerror witherror codeunable to capture screen.

  3. Letfile bea serialization of thecanvas element's bitmap as a file, using "image/png" as an argument.

  4. Letdata URL be adata: URL representingfile. [RFC2397]

  5. Letindex be theindex of "," indata URL.

  6. Letencoded string be asubstring ofdata URL using (index + 1) as thestart argument.

  7. Returnsuccess with dataencoded string.

17.1Take Screenshot

HTTP MethodURI Template
GET/session/{session id}/screenshot

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent top-level browsing context isno longer open, returnerror witherror codeno such window.

  2. When the user agent is next torun the animation frame callbacks:

    1. Letroot rect besession'scurrent top-level browsing context'sdocument element'srectangle.

    2. Letscreenshot result be the result oftrying to calldraw a bounding box from the framebuffer, givenroot rect as an argument.

    3. Letcanvas be acanvas element ofscreenshot result's data.

    4. Letencoding result be the result oftryingencoding a canvas as Base64canvas.

    5. Letencoded string beencoding result's data.

  3. Returnsuccess with dataencoded string.

17.2Take Element Screenshot

HTTP MethodURI Template
GET/session/{session id}/element/{element id}/screenshot
Note

TheTake Element Screenshotcommandtakes a screenshot of the visible region encompassedby thebounding rectangle of anelement.

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. Letelement be the result oftrying toget a known element withsession andURL variables["element id"].

  4. Scroll into view theelement.

  5. When the user agent is next torun the animation frame callbacks:

    1. Letelement rect beelement'srectangle.

    2. Letscreenshot result be the result oftrying to calldraw a bounding box from the framebuffer, givenelement rect as an argument.

    3. Letcanvas be acanvas element ofscreenshot result's data.

    4. Letencoding result be the result oftryingencoding a canvas as Base64canvas.

    5. Letencoded string beencoding result's data.

  6. Returnsuccess with dataencoded string.

18.Print

The print functions are a mechanism to render the document to a paginated format. It is returned to thelocal end as a Base64 encoded string containing a PDF representation of the paginated document.

When required toparse a page range withargumentspageRanges andtotalPages, animplementation must:

  1. Letpages be an emptySet
  2. For eachrange inpageRanges, run the following steps:
    1. Ifrange is not either aNumber or aString, returnerror witherror codeinvalid argument.
    2. Ifrange is aNumber:

      1. Ifrange is not an integer or is less than 0, returnerror witherror codeinvalid argument
      2. Appendrange topages

      Otherwise:

      1. LetrangeParts be the result of splittingrange on a "-" character.
      2. IfrangeParts has fewer than 1 or more than 2 elements, returnerror witherror codeinvalid argument.
      3. If rangeParts has one element, append the result oftrying toparse as an integer the first element ofrangeParts topages.

        Otherwise:

        1. If the first element ofrangeParts isequivalent to an empty string, letlowerBound be1. Otherwise letlowerBound be the result oftrying toparse as an integer the first element ofrangeParts.
        2. If the second element ofrangeParts isequivalent to an empty string letupperBound betotalPages. Otherwise letupperBound be the result oftrying toparse as an integer the second element ofrangeParts.
        3. IflowerBound is greater thanupperBound, returnerror witherror codeinvalid argument.
        4. Append all integers in the inclusive rangelowerBound toupperBound topages
    3. Returnsuccess with datapages.

AString isequivalent to an empty string if ithas zero length after removing allwhitespace characters.

When required toparse as an integer withargumentinput an implementation must:

  1. Letstripped be the result of stripping all leading and trailingwhitespace characters frominput.
  2. Ifstripped has zero length, returnerror with statusinvalid argument.
  3. Ifstripped contains any characters outside the rangeU+0030 -U+0039 (i.e. 0 - 9) inclusive, returnerror with statusinvalid argument.
  4. Letoutput be the result of callingparseInt with stringstripped and radix10.
  5. Returnsuccess with dataoutput.

18.1Print Page

HTTP MethodURI Template
POST/session/{session id}/print

Theremote end steps, givensession,URLvariables andparameters are:

  1. Ifsession'scurrent top-level browsing context isno longer open, returnerror witherror codeno such window.

  2. Try tohandle any user prompts withsession.

  3. Letorientation be the result ofgetting a property with default named "orientation" and with default "portrait" fromparameters.

  4. Iforientation is not aString or does not have one of the values "landscape" or "portrait", returnerror witherror codeinvalid argument.

  5. Letscale be the result ofgetting a property with default named "scale" and with default1 fromparameters.

  6. Ifscale is not aNumber, or is less than0.1 or greater than2 returnerror witherror codeinvalid argument.

  7. Letbackground be the result ofgetting a property with default named "background" and with defaultfalse fromparameters.

  8. Ifbackground is not aBoolean returnerror witherror codeinvalid argument.

  9. Letpage be the result ofgetting a property with default named "page" and with a default of an emptyObject fromparameters.

  10. LetpageWidth be the result ofgetting a property with default named "width" and with a default of21.59 frompage.

  11. LetpageHeight be the result ofgetting a property with default named "height" and with a default of27.94 frompage.

  12. If either ofpageWidth orpageHeight is not aNumber, or is less than(2.54 / 72), returnerror witherror codeinvalid argument.

    Note

    The minimum page size is1 point, which is(2.54 / 72) as perabsolute lengths.

  13. Letmargin be the result ofgetting a property with default named "margin" and with a default of an emptyObject fromparameters.

  14. LetmarginTop be the result ofgetting a property with default named "top" and with a default of1 frommargin.

  15. LetmarginBottom be the result ofgetting a property with default named "bottom" and with a default of1 frommargin.

  16. LetmarginLeft be the result ofgetting a property with default named "left" and with a default of1 frommargin.

  17. LetmarginRight be the result ofgetting a property with default named "right" and with a default of1 frommargin.

  18. If any ofmarginTop,marginBottom,marginLeft, ormarginRight is not aNumber, or is less then 0, returnerror witherror codeinvalid argument.

  19. LetshrinkToFit be the result ofgetting a property with default named "shrinkToFit" and with defaulttrue fromparameters.

  20. IfshrinkToFit is not aBoolean returnerror witherror codeinvalid argument.

  21. LetpageRanges be the result ofgetting a property with default named "pageRanges" fromparameters with default of an emptyArray.

  22. IfpageRanges is not anArray returnerror witherror codeinvalid argument.

  23. When the user agent is next torun the animation frame callbacks, letpdfData be the result oftrying to take UA-specific steps to generate a paginated representation ofsession'scurrent browsing context, with the CSSmedia type set toprint, encoded as a PDF, with the following paper settings:

    PropertyValue
    Width in cmpageWidth iforientation is "portrait" otherwisepageHeight
    Height in cmpageHeight iforientation is "portrait" otherwisepageWidth
    Top margin, in cmmarginTop
    Bottom margin, in cmmarginBottom
    Left margin, in cmmarginLeft
    Right margin, in cmmarginRight

    In addition, the following formatting hints should be applied by the UA:

    Ifscale is not equal to1
    Zoom the size of the content by a factorscale
    Ifbackground isfalse
    Suppress output of background images
    IfshrinkToFit istrue
    Resize the content to match the page width, overriding any page width specified in the content
  24. IfpageRanges is not an emptyArray, Letpages be the result oftrying toparse a page range with argumentspageRanges and the number of pages contained inpdfData, then remove any pages frompdfData whose one-based index is not contained inpages

  25. Letencoding result be the result of callingBase64 Encode onpdfData.

  26. Letencoded string beencoding result's data.

  27. Returnsuccess with dataencoded string

A.Privacy

It is advisable thatremote endscreate a new profile whencreating a new session.This prevents potentially sensitive session datafrom being accessible to newsessions,ensuring both privacy and preventing state from bleeding through to the next session.

B.Security

A user agent can rely on a command-line flag or a configuration option to test whether to enable WebDriver, or alternatively 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.

It is strongly suggested that user agents require users to take explicit action to enable WebDriver, and that WebDriver remains disabled in publicly consumed versions of the user agent.

To prevent arbitrary machines on the network from connecting and creatingsessions, it is suggested that only connections from loopback devices are allowed by default.

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

It is also suggested that user agents make an effort to visually distinguish a user agent session that is under control of WebDriver from those used for normal browsing sessions. This can be done through abrowser chrome element such as a “door hanger”, colorful decoration of the OS window, or some widget element that is prevalent in the window so that it easy to identify automation windows.

C.Element displayedness

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

The visibility of anelement is guided by what is perceptually visible to the human eye. In this context, anelement's displayedness does not relate to thevisibility ordisplay style properties.

The approach recommended to implementors to ascertain anelement's visibility was originally developed by theSelenium project, and is based on crude approximations about anelement's nature and relationship in the tree. Anelement is in general to be considered visible if any part of it is drawn on the canvas within the boundaries of the viewport.

Theelement displayed state is a boolean representingwhether an element is currently visible.

To get theelement displayed state usingthebot.dom.isShown Selenium atoms,givenelement:

  1. Letfunction be thebot.dom.isShown function.

  2. Letresult be the result of callingfunction's[[Call]] internal method with arguments null andelement. If this raises an exception, return anerror witherror codeunknown error.

  3. Returnsuccess with dataresult.

    Theelement displayed state is typically exposed as an endpoint forGET requests with aURI Template of/session/{session id}/element/{element id}/displayed.

D.Acknowledgements

There have been a lot of people that have helped makebrowser automation possible over the yearsand thereby furthered the goals of this standard.In particular, thanks goes to theSelenium Open Source community,without which this standard would never have been possible.

This standard is authored by Aleksey Chemakin,Andreas Tolfsen, Andrey Botalov, Brian Burg, Christian Bromann, Clayton Martin, Daniel Wagner-Hall,David Burns, Dominique Hazael-Massieux, Eran Messeri, Erik Wilde, Gábor Csárdi, Henrik Skupin, James Graham, Jason Juang, Jason Leyba, Jim Evans, John Chen, John Jansen, Jonathan Lipps, Jonathon Kereliuk, Luke Inman-Semerau,Maja Frydrychowicz, Malini Das, Manoj Kumar, Marc Fisher, Mike Pennisi, Ondřej Machulda, Randall Kent, Sam Sneddon, Seva Lotoshnikov,Simon Stewart, Sri Harsha, Titus Fortner, and Vangelis Katsikaros.The work is coordinated and edited byDavid BurnsandSimon Stewart.

Thanks toBerge Schwebs Bjørlo,Lukas Tetzlaff,Malcolm Rowe,Michael[tm] Smith,Nathan Bloomfield,Philippe Le Hégaret,Robin Berjon,Ross Patterson,and Wilhelm Joys Andersenfor proofreading and suggesting areas for improvement.

E.Index

This specification relies on several other underlying specifications.

ARIA and related specifications

The following terms are defined in the Accessible Rich Internet Applications (WAI-ARIA) 1.2 specification: [wai-aria-1.2]

The following terms are defined in the Accessible Name and Description Computation 1.1 specification: [accname-1.1]

Web App Security

The following terms are defined in the Content Security Policy Level 3 specification: [CSP3]

Base16, Base32, and Base64 Data Encodings

The following terms are defined in The Base16, Base32, and Base64 Data Encodings specification: [RFC4648]

DOM

The following terms are defined in the DOM Parsing and Serialization specification: [DOM-PARSING]

The following attributes are defined in the UI Events specification: [UI-EVENTS]

The following attributes are defined in the UI Events Code specification: [UIEVENTS-KEY]

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 theinternal methods from the ECMAScript Language Specification [ECMAScript]:
The ECMAScript Language Specification also defines the following types, values, and operations that are used throughout this specification:
Encoding

The following terms are defined in the WHATWG Encoding specification: [ENCODING]

Fetch

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

Fullscreen

The following terms are defined in the WHATWG Fullscreen specification: [FULLSCREEN]

HTML

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

The HTML specification also definesstates of theinput element:

The HTML specification also defines a range of different attributes:

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

To beHTTP compliant, it is supposed that the implementation supports the relevant subsets of [RFC7230], [RFC7231], [RFC7232], [RFC7234], and [RFC7235].

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

The following terms are defined in the Same Site Cookie specification: [RFC6265bis]

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

Infra

The following terms are defined in the Infra specification: [INFRA]

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

The specification usesURI Templates. [URI-TEMPLATE]

Interaction
The following terms are defined in the Page Visibility Specification [PAGE-VISIBILITY]
Selenium
The following functions are defined within theSelenium project, at revision775cfb33b193eb8832cd5488f298006f45254685.
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]:
The following terms are defined in [mediaqueries-4]:
SOCKS Proxy:

The following terms are defined in the standard: [RFC1928]

Unicode
The following terms are defined in the standard: [Unicode]
Unicode Standard Annex #29
The following terms are defined in the standard: [UAX29]
Unicode Standard Annex #44
The following terms are defined in the standard: [UAX44]
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]

Promises Guide

The following terms are defined in the Promises Guide. [PROMISES-GUIDE]

XPATH

The following terms are defined in the Document Object Model XPath standard [XPATH]

E.1Terms defined by this specification

E.2Terms defined by reference

F.References

F.1Normative references

[accname-1.1]
Accessible Name and Description Computation 1.1. Joanmarie Diggs; Bryan Garaventa; Michael Cooper. W3C. 18 December 2018. W3C Recommendation. URL:https://www.w3.org/TR/accname-1.1/
[CSP3]
Content Security Policy Level 3. Mike West; Antonio Sartori. W3C. 11 July 2025. W3C Working Draft. URL:https://www.w3.org/TR/CSP3/
[CSS-CASCADE-4]
CSS Cascading and Inheritance Level 4. Elika Etemad; Tab Atkins Jr. W3C. 13 January 2022. W3C Candidate Recommendation. URL:https://www.w3.org/TR/css-cascade-4/
[CSS-DEVICE-ADAPT]
CSS Device Adaptation Module Level 1. Rune Lillesveen; Florian Rivoal; Matt Rakow. W3C. 29 March 2016. W3C Working Draft. URL:https://www.w3.org/TR/css-device-adapt-1/
[CSS21]
Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification. Bert Bos; Tantek Çelik; Ian Hickson; Håkon Wium Lie. W3C. 7 June 2011. W3C Recommendation. URL:https://www.w3.org/TR/CSS2/
[CSS3-BOX]
CSS Box Model Module Level 3. Elika Etemad. W3C. 11 April 2024. W3C Recommendation. URL:https://www.w3.org/TR/css-box-3/
[CSS3-DISPLAY]
CSS Display Module Level 3. Elika Etemad; Tab Atkins Jr. W3C. 30 March 2023. W3C Candidate Recommendation. URL:https://www.w3.org/TR/css-display-3/
[CSS3-VALUES]
CSS Values and Units Module Level 3. Tab Atkins Jr.; Elika Etemad. W3C. 22 March 2024. CRD. URL:https://www.w3.org/TR/css-values-3/
[CSSOM]
CSS Object Model (CSSOM). Daniel Glazman; Emilio Cobos Álvarez. W3C. 26 August 2021. W3C Working Draft. URL:https://www.w3.org/TR/cssom-1/
[CSSOM-VIEW]
CSSOM View Module. Simon Fraser; Emilio Cobos Álvarez. W3C. 16 September 2025. W3C Working Draft. URL:https://www.w3.org/TR/cssom-view-1/
[DOM]
DOM Standard. Anne van Kesteren. WHATWG. Living Standard. URL:https://dom.spec.whatwg.org/
[DOM-PARSING]
DOM Parsing and Serialization. Travis Leithead. W3C. 17 May 2016. W3C Working Draft. URL:https://www.w3.org/TR/DOM-Parsing/
[ECMA-262]
ECMAScript Language Specification. Ecma International. URL:https://tc39.es/ecma262/multipage/
[EDITING]
HTML Editing APIs. A. Gregor. W3C. URL:https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html
[ENCODING]
Encoding Standard. Anne van Kesteren. WHATWG. Living Standard. URL:https://encoding.spec.whatwg.org/
[FETCH]
Fetch Standard. Anne van Kesteren. WHATWG. Living Standard. URL:https://fetch.spec.whatwg.org/
[fileapi]
File API. Marijn Kruisselbrink. W3C. 4 December 2024. W3C Working Draft. URL:https://www.w3.org/TR/FileAPI/
[FULLSCREEN]
Fullscreen API Standard. Philip Jägenstedt. WHATWG. Living Standard. URL:https://fullscreen.spec.whatwg.org/
[GEOMETRY-1]
Geometry Interfaces Module Level 1. Simon Pieters; Chris Harrelson. W3C. 4 December 2018. W3C Candidate Recommendation. URL:https://www.w3.org/TR/geometry-1/
[HTML]
HTML Standard. Anne van Kesteren; Domenic Denicola; Dominic Farolino; Ian Hickson; Philip Jägenstedt; Simon Pieters. WHATWG. Living Standard. URL:https://html.spec.whatwg.org/multipage/
[INFRA]
Infra Standard. Anne van Kesteren; Domenic Denicola. WHATWG. Living Standard. URL:https://infra.spec.whatwg.org/
[mediaqueries-4]
Media Queries Level 4. Florian Rivoal; Tab Atkins Jr. W3C. 25 December 2021. CRD. URL:https://www.w3.org/TR/mediaqueries-4/
[PAGE-VISIBILITY]
Page Visibility (Second Edition). Jatinder Mann; Arvind Jain. W3C. 29 October 2013. W3C Recommendation. URL:https://www.w3.org/TR/page-visibility/
[POINTER-EVENTS]
Pointer Events. Jacob Rossi; Matt Brubeck. W3C. 4 April 2019. W3C Recommendation. URL:https://www.w3.org/TR/pointerevents/
[PROMISES-GUIDE]
Writing Promise-Using Specifications. Domenic Denicola. W3C. 9 November 2018. TAG Finding. URL:https://www.w3.org/2001/tag/doc/promises-guide
[RFC1928]
SOCKS Protocol Version 5. M. Leech; M. Ganis; Y. Lee; R. Kuris; D. Koblas; L. Jones. IETF. March 1996. Proposed Standard. URL:https://www.rfc-editor.org/rfc/rfc1928
[RFC2397]
The "data" URL scheme. L. Masinter. IETF. August 1998. Proposed Standard. URL:https://www.rfc-editor.org/rfc/rfc2397
[RFC3514]
The Security Flag in the IPv4 Header. S. Bellovin. IETF. 1 April 2003. Informational. URL:https://www.rfc-editor.org/rfc/rfc3514
[RFC4122]
A Universally Unique IDentifier (UUID) URN Namespace. P. Leach; M. Mealling; R. Salz. IETF. July 2005. Proposed Standard. URL:https://www.rfc-editor.org/rfc/rfc4122
[RFC4632]
Classless Inter-domain Routing (CIDR): The Internet Address Assignment and Aggregation Plan. V. Fuller; T. Li. IETF. August 2006. Best Current Practice. URL:https://www.rfc-editor.org/rfc/rfc4632
[RFC4648]
The Base16, Base32, and Base64 Data Encodings. S. Josefsson. IETF. October 2006. Proposed Standard. URL:https://www.rfc-editor.org/rfc/rfc4648
[RFC6265]
HTTP State Management Mechanism. A. Barth. IETF. April 2011. Proposed Standard. URL:https://httpwg.org/specs/rfc6265.html
[RFC6265bis]
Cookies: HTTP State Management Mechanism. M. West; J. Wilander. IETF. Draft. URL:https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-05
[RFC7230]
Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing. R. Fielding, Ed.; J. Reschke, Ed. IETF. June 2014. Proposed Standard. URL:https://httpwg.org/specs/rfc7230.html
[RFC7231]
Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content. R. Fielding, Ed.; J. Reschke, Ed. IETF. June 2014. Proposed Standard. URL:https://httpwg.org/specs/rfc7231.html
[RFC7232]
Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests. R. Fielding, Ed.; J. Reschke, Ed. IETF. June 2014. Proposed Standard. URL:https://httpwg.org/specs/rfc7232.html
[RFC7234]
Hypertext Transfer Protocol (HTTP/1.1): Caching. R. Fielding, Ed.; M. Nottingham, Ed.; J. Reschke, Ed. IETF. June 2014. Proposed Standard. URL:https://httpwg.org/specs/rfc7234.html
[RFC7235]
Hypertext Transfer Protocol (HTTP/1.1): Authentication. R. Fielding, Ed.; J. Reschke, Ed. IETF. June 2014. Proposed Standard. URL:https://httpwg.org/specs/rfc7235.html
[UAX29]
Unicode Text Segmentation. Josh Hadley. Unicode Consortium. 17 August 2025. Unicode Standard Annex #29. URL:https://www.unicode.org/reports/tr29/tr29-47.html
[UAX44]
Unicode Character Database. Ken Whistler. Unicode Consortium. 27 August 2025. Unicode Standard Annex #44. URL:https://www.unicode.org/reports/tr44/tr44-36.html
[UI-EVENTS]
UI Events. Gary Kacmarcik; Travis Leithead. W3C. 7 September 2024. W3C Working Draft. URL:https://www.w3.org/TR/uievents/
[UIEVENTS-KEY]
UI Events KeyboardEvent key Values. Travis Leithead; Gary Kacmarcik. W3C. 22 April 2025. W3C Recommendation. URL:https://www.w3.org/TR/uievents-key/
[Unicode]
The Unicode Standard. Unicode Consortium. URL:https://www.unicode.org/versions/latest/
[URI-TEMPLATE]
URI Template. J. Gregorio; R. Fielding; M. Hadley; M. Nottingham; D. Orchard. IETF. March 2012. Proposed Standard. URL:https://www.rfc-editor.org/rfc/rfc6570
[URL]
URL Standard. Anne van Kesteren. WHATWG. Living Standard. URL:https://url.spec.whatwg.org/
[wai-aria-1.2]
Accessible Rich Internet Applications (WAI-ARIA) 1.2. Joanmarie Diggs; James Nurthen; Michael Cooper; Carolyn MacLeod. W3C. 6 June 2023. W3C Recommendation. URL:https://www.w3.org/TR/wai-aria-1.2/
[WebDriver-BiDi]
WebDriver BiDi. James Graham; Alex Rudenko; Maksim Sadym. W3C. 21 October 2025. W3C Working Draft. URL:https://www.w3.org/TR/webdriver-bidi/
[WEBIDL]
Web IDL Standard. Edgar Chen; Timothy Gu. WHATWG. Living Standard. URL:https://webidl.spec.whatwg.org/
[XPATH]
XML Path Language (XPath) Version 1.0. James Clark; Steven DeRose. W3C. 16 November 1999. W3C Recommendation. URL:https://www.w3.org/TR/xpath-10/


[8]ページ先頭

©2009-2025 Movatter.jp