-
Notifications
You must be signed in to change notification settings - Fork 187
/
webdriver-spec.html
6322 lines (4956 loc) · 224 KB
/
webdriver-spec.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html>
<html
data-bug-blocked=20860
data-bug-product="Browser Test/Tools WG"
data-bug-component=WebDriver>
<meta charset=utf-8>
<title>WebDriver</title>
<script src=https://www.w3.org/Tools/respec/respec-w3c-common async class=remove></script>
<script class=remove>
var respecConfig = {
specStatus: "ED",
shortName: "webdriver",
subtitle: "Living Document",
// publishDate: "2009-08-06",
// copyrightStart: "2005"
// previousPublishDate: "1977-03-15",
// previousMaturity: "WD",
// lcEnd: "2009-08-05",
edDraftURI: "https://w3c.github.io/webdriver/webdriver-spec.html",
editors: [
{
name: "Simon Stewart", url: "http://www.rocketpoweredjetpants.com/",
company: "", companyURL: "",
w3cid: "50228"
},
{
name: "David Burns", url: "http://www.theautomatedtester.co.uk/",
company: "Mozilla", companyURL: "https://www.mozilla.org",
w3cid: "50184"
}
],
otherLinks: [{
key: "Participate",
data: [
{value: "GitHub w3c/webdriver", href: "https://github.com/w3c/webdriver"},
{value: "Open bugs", href: "https://www.w3.org/Bugs/Public/showdependencytree.cgi?id=20860&hide_resolved=1"},
{value: "#webdriver on irc.w3.org", href: "irc://irc.w3.org/"},
]
}],
wg: "Browser Testing and Tools Working Group",
wgURI: "http://www.w3.org/testing/browser/",
wgPublicList: "public-browser-tools-testing",
wgPatentURI: "http://www.w3.org/2004/01/pp-impl/49799/status",
noIDLSorting: true,
};
</script>
<script src=bug-assist.js></script>
<section id=abstract>
<p>WebDriver is a remote control interface
that enables introspection and control of user agents.
It provides a platform- and language-neutral wire protocol
as a way for out-of-process programs
to remotely instruct the behaviour of web browsers.
<p>Provided is a set of interfaces
to discover and manipulate DOM elements in web documents
and to control the behaviour of a user agent.
It is primarily intended to allow web authors to write tests
that automate a user agent from a separate controlling process,
but may also be used in such a way as to allow in-browser scripts
to control a — possibly separate — browser.
<p>The standard forms part of the
<a href=http://www.w3.org/testing/Activity>Web Testing Activity</a>
that authors a larger set of tools commonly used for testing.
</section>
<!-- ReSpec complains if removed completely -->
<section id=sotd></section>
<section>
<h2>Conformance</h2>
<p>All diagrams, examples, and notes in this specification are non-normative,
as are all sections explicitly marked non-normative.
Everything else in this specification is normative.
<p>The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHOULD”,
“SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL”
in the normative parts of this document are to be interpreted as described in [[!RFC2119]].
The key word “OPTIONALLY” in the normative parts of this document
is to be interpreted with the same normative meaning as “MAY” and “OPTIONAL”.
<p>Conformance requirements phrased as algorithms
or specific steps may be implemented in any manner,
so long as the end result is equivalent.
<p>The standard defines four broad conformance classes:
<dl>
<dt><dfn data-lt="local end|local ends|local">Local End</dfn>
<dd><p>The local end represents the client side of the protocol,
which is usually in the form of language-specific libraries
providing an API on top of the WebDriver <a href=#protocol>protocol</a>.
This specification does not place any restrictions on the details of those libraries
above the level of the wire protocol.
<p class=issue>Define the requirements on the local end somewhere.
<dt><dfn data-lt="remote end|remote ends|remote">Remote End</dfn>
<dd>The remote end hosts the server side of the <a href=#protocol>protocol</a>.
Defining the behaviour of a remote end in response to the WebDriver protocol
forms the largest part of this specification.
<dt><dfn data-lt="intermediary node|intermediary nodes">Intermediary Node</dfn>
<dd>Intermediary nodes are those that act as proxies,
implementing both the client and server sides of the <a href=#protocol>protocol</a>.
Intermediary nodes must be black-box indistinguishable from a <a>remote end</a>
from the point of view of <a>local end</a>,
and so are bound by the requirements on a <a>remote end</a> in terms of the wire protocol.
However they are not expected to implement <a>remote end steps</a> directly.
<dt><dfn>Endpoint Node</dfn>
<dd>An endpoint node is the final <a>remote end</a>
in a chain of nodes that is not an <a>intermediary node</a>.
The endpoint node is implemented by a user agent or a similar program.
An endpoint node must be, like <a>intermediary nodes</a>,
indistinguishable from a <a>remote end</a>.
</dl>
<section>
<h3>Dependencies</h3>
<p>This specification relies on several other underlying specifications.
<!--
Each item in the list begins with a comment
with term described using the characters [a-zA-Z].
This is so that the list items can be piped through sort(1)
to automatically sort each list alphabetically.
-->
<dl>
<dt>DOM
<dd><p>The following terms are defined in the Document Object Model specification: [[!DOM]]
<ul>
<!-- Attribute --> <li><dfn><a href=https://dom.spec.whatwg.org/#concept-attribute>Attribute</a></dfn>
<!-- context object --><li><dfn><a href="https://dom.spec.whatwg.org/#context-object">context object</a></dfn>
<!-- comapreDocumentPosition --> <li><dfn><a href=https://dom.spec.whatwg.org/#dom-node-comparedocumentposition>compareDocumentPosition</a></dfn>
<!-- Document element --> <li><dfn><a href=https://dom.spec.whatwg.org/#document-element>Document element</a></dfn>
<!-- Document --> <li><dfn><a href=https://dom.spec.whatwg.org/#concept-document>Document</a></dfn>
<!-- DOCUMENT_POSITION_DISCONNECTED --> <li><dfn><a href=https://dom.spec.whatwg.org/#dom-node-document_position_disconnected>DOCUMENT_POSITION_DISCONNECTED</a></dfn> (1)
<!-- Document type --> <li><dfn><a href=https://dom.spec.whatwg.org/#concept-document-type>Document type</a></dfn>
<!-- Document URL --> <li><dfn><a href=https://dom.spec.whatwg.org/#concept-document-url>Document URL</a></dfn>
<!-- Element --> <li><dfn data-lt=elements><a href=https://dom.spec.whatwg.org/#concept-element>Element</a></dfn>
<!-- Equals --> <li><dfn><a href=https://dom.spec.whatwg.org/#concept-node-equals>Equals</a></dfn>
<!-- Event --> <li><dfn><a href=https://dom.spec.whatwg.org/#event>Event</a></dfn>
<!-- Get an attribute by name --> <li><dfn data-lt="getting an attribute by name"><a href=https://dom.spec.whatwg.org/#concept-element-attributes-get-by-name>Get an attribute by name</a></dfn>
<!-- getAttribute --> <li><dfn><a href=https://dom.spec.whatwg.org/#dom-element-getattribute>getAttribute</a></dfn>
<!-- hasAttribute --> <li><dfn data-lt="has the attribute"><a href=https://dom.spec.whatwg.org/#dom-element-hasattribute>hasAttribute</a></dfn>
<!-- HTMLCollection --><li><dfn><a href="https://dom.spec.whatwg.org/#htmlcollection"><code>HTMLCollection</code></a></dfn>
<!-- isTrusted --> <li><dfn data-lt='is trusted'><a href="http://dom.spec.whatwg.org/#dom-event-istrusted">isTrusted</a></dfn>
<!-- Node --> <li><dfn><a href=https://dom.spec.whatwg.org/#concept-node>Node</a></dfn>
<!-- NodeList --> <li><dfn><a href=https://dom.spec.whatwg.org/#nodelist><code>NodeList</code></a></dfn>
<!-- Node length --> <li><dfn><a href="https://dom.spec.whatwg.org/#concept-node-length">Node Length</a></dfn>
<!-- ownerDocument --> <li><dfn><a href=https://dom.spec.whatwg.org/#dom-node-ownerdocument>ownerDocument</a></dfn>
<!-- querySelector --> <li><dfn><a href="https://dom.spec.whatwg.org/#dom-parentnode-queryselector"><code>querySelector</code></a></dfn>
<!-- querySelectorAll --> <li><dfn><a href="https://dom.spec.whatwg.org/#dom-parentnode-queryselectorall"><code>querySelectorAll</code></a></dfn>
<!-- tagName --> <li><dfn><a href=https://dom.spec.whatwg.org/#dom-element-tagname>tagName</a></dfn>
<!-- Text content --> <li><dfn><a href=https://dom.spec.whatwg.org/#dom-node-textcontent>Text content</a></dfn>
<!-- Text node --> <li><dfn><a href=https://dom.spec.whatwg.org/#text><code>Text</code> node</a></dfn>
</ul>
<dd><p>The following attributes are defined in
the DOM Parsing and Serialisation specification: [[!DOM-PARSING]]
<ul>
<li><dfn><a href=https://w3c.github.io/DOM-Parsing/#widl-Element-innerHTML><code>innerHTML</code> IDL attribute</a></dfn>
<li><dfn><a href=https://w3c.github.io/DOM-Parsing/#widl-Element-outerHTML><code>outerHTML</code> IDL attribute</a></dfn>
<li><dfn data-lt="serialising to string"><a href=https://w3c.github.io/DOM-Parsing/#widl-XMLSerializer-serializeToString-DOMString-Node-root><code>serializeToString</code></a></dfn>
</ul>
<dd><p>The following attributes are defined in the UI Events
specification: [[!UI-EVENTS]]
<ul>
<li><dfn><a href="https://w3c.github.io/uievents/#glossary-activation-trigger">Activation Trigger</a></dfn>
<li><dfn><a href="https://w3c.github.io/uievents/#interface-KeyboardEvent">Keyboard Event</a></dfn>
<li><dfn data-lt="keyUp-Event"><a href="https://w3c.github.io/uievents/#event-type-keyup">keyUp Event</a></dfn>
<li><dfn data-lt="keyPress-Event"><a href="https://w3c.github.io/uievents/#event-type-keypress">keyPress Event</a></dfn>
<li><dfn data-lt="keyDown-Event"><a href="https://w3c.github.io/uievents/#event-type-keydown">keyDown Event</a></dfn>
<li><dfn><a href="https://w3c.github.io/uievents/#events-keyboard-event-order">Keyboard Event Order</a></dfn>
<li><dfn><a href="https://w3c.github.io/uievents/#interface-MouseEvent">Mouse Event</a></dfn>
<li><dfn><a href="https://w3c.github.io/uievents/#event-type-mousedown">mousedown Event</a></dfn>
<li><dfn><a href="https://w3c.github.io/uievents/#event-type-mousedown">mouseup Event</a></dfn>
<li><dfn><a href="https://w3c.github.io/uievents/#events-mouse-event-order">Mouse Event Order</a></dfn>
</ul>
<dd><p>he following attributes are defined in the UI Events Code
specification: [[!UIEVENTS-CODE]]
<ul>
<li><dfn data-lt="keyboard event code"><a href="https://www.w3.org/TR/uievents-code/#code-value-tables">Keyboard Event Code Tables</a></dfn>
</ul>
<dd><p>he following attributes are defined in the UI Events Code
specification: [[!UIEVENTS-KEY]]
<ul>
<li><dfn data-lt="modifier key"><a href="https://www.w3.org/TR/uievents-key/#keys-modifier">Keyboard Modifier Keys</a></dfn>
</ul>
<dt>ECMAScript
<dd><p>The following terms are defined in the ECMAScript Language Specification: [[!ECMA-262]]
<ul>
<!-- Create a function object --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-13.2>Create a function object</a></dfn>
<!-- Directive prologue --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-14.1>Directive prologue</a></dfn>
<!-- Early error --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-16>Early error</a></dfn>
<!-- FunctionBody --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-13>FunctionBody</a></dfn>
<!-- Function --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-4.3.24>Function</a></dfn>
<!-- Global environment --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-10.2.3>Global environment</a></dfn>
<!-- Own Property --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-4.3.30>Own property</a></dfn>
<!-- parseFloat --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-15.1.2.3>parseFloat</a></dfn>
<!-- Use strict directive --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-14.1>Use strict directive</a></dfn>
</ul>
<dd>This specification also presumes that you are able to call
some of the internal methods from the ECMAScript Language Specification:
<ul>
<!-- Call --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-13.2.1>[[\Call]]</a></dfn>
<!-- Class --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-8.6.2>[[\Class]]</a></dfn>
<!-- GetOwnProperty --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-8.12.1>[[\GetOwnProperty]]</a></dfn>
<!-- GetProperty --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-8.12.2>[[\GetProperty]]</a></dfn>
<!-- Index of --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-15.5.4.7>Index of</a></dfn>
<!-- Substring --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-15.5.4.15>Substring</a></dfn>
</ul>
<dd>The ECMAScript Language Specification also defines
the following types and values that are used throughout this specification:
<ul>
<!-- Array --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-11.1.4>Array</a></dfn>
<!-- Boolean type --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-4.3.14>Boolean</a></dfn> type
<!-- List --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-8.8>List</a></dfn>
<!-- null --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-4.3.11>Null</a></dfn>
<!-- Number --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-4.3.19>Number</a></dfn>
<!-- Object --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-4.2.1>Object</a></dfn>
<!-- String --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-4.3.18>String</a></dfn>
<!-- undefined --> <li><dfn><a href=http://www.ecma-international.org/ecma-262/5.1/#sec-4.3.9>Undefined</a></dfn>
</ul>
<dt>Fetch
<dd><p>The following terms are defined in the WHATWG Fetch specification: [[!FETCH]]
<ul>
<!-- Body --> <li><dfn><a href=https://fetch.spec.whatwg.org/#concept-request-body>Body</a></dfn>
<!-- Method --> <li><dfn><a href=https://fetch.spec.whatwg.org/#concept-request-method>Method</a></dfn>
<!-- Response --> <li><dfn><a href=https://fetch.spec.whatwg.org/#concept-response>Response</a></dfn>
<!-- Request --> <li><dfn><a href=https://fetch.spec.whatwg.org/#concept-request>Request</a></dfn>
<!-- Status --> <li><dfn><a href=https://fetch.spec.whatwg.org/#concept-response-status>HTTP Status</a></dfn>
<!-- Status message --> <li><dfn><a href=https://fetch.spec.whatwg.org/#concept-response-status-message>Status message</a></dfn>
<!-- URL --> <li><dfn><a href=https://fetch.spec.whatwg.org/#concept-request-url>URL</a></dfn>
</ul>
<dt>HTML
<dd><p>The following terms are defined in the HTML specification: [[!HTML]]
<ul>
<!-- 2D context creation algorithm --> <li><dfn><a href=https://html.spec.whatwg.org/#2d-context-creation-algorithm>2D context creation algorithm</a></dfn>
<!-- A browsing context is discarded --> <li><dfn data-lt=discarded><a href=https://html.spec.whatwg.org/#a-browsing-context-is-discarded>A browsing context is discarded</a></dfn>
<!-- Active document --> <li><dfn><a href=https://html.spec.whatwg.org/#active-document>Active document</a></dfn>
<!-- Active element --> <li><dfn>Active element</dfn> being the <a href=https://html.spec.whatwg.org/#dom-document-activeelement><code>activeElement</code></a> attribute on <a href=https://html.spec.whatwg.org/#document><code>Document</code></a>
<!-- Ancestor browsing context --> <li><dfn><a href=https://html.spec.whatwg.org/#ancestor-browsing-context>Ancestor browsing context</a></dfn>
<!-- A serialization of the bitmap as a file --> <li><dfn data-lt="a serialisation of the canvas element’s bitmap as a file"><a href=https://html.spec.whatwg.org/#a-serialisation-of-the-bitmap-as-a-file>A serialisation of the bitmap as a file</a></dfn>
<!-- Associated window --> <li><dfn><a href=https://html.spec.whatwg.org/#concept-document-window>Associated window</a></dfn>
<!-- Boolean attribute --> <li><dfn><a href=https://html.spec.whatwg.org/#boolean-attribute>Boolean attribute</a></dfn>
<!-- Browsing context --> <li><dfn data-lt="browsing contexts"><a href=https://html.spec.whatwg.org/#browsing-context>Browsing context</a></dfn>
<!-- Button --> <li><dfn><a href="https://html.spec.whatwg.org/#button-state-%28type=button%29">Button</a></dfn> state
<!-- Buttons --> <li><dfn><a href=https://html.spec.whatwg.org/#concept-button>Buttons</a></dfn>
<!-- Canvas context mode --> <li><dfn><a href=https://html.spec.whatwg.org/#concept-canvas-context-mode>Canvas context mode</a></dfn>
<!-- Change event --> <li><dfn><a href=https://html.spec.whatwg.org/#event-change>Change</a></dfn> event
<!-- Checkbox --> <li><dfn><a href="https://html.spec.whatwg.org/#checkbox-state-%28type=checkbox%29">Checkbox</a></dfn> state
<!-- Checkedness --> <li><dfn><a href=https://html.spec.whatwg.org/#concept-fe-checked>Checkedness</a></dfn>
<!-- Child browsing context --> <li><dfn><a href=https://html.spec.whatwg.org/#child-browsing-context>Child browsing context</a></dfn>
<!-- Close a browsing context --> <li><dfn data-lt="close|closes"><a href=https://html.spec.whatwg.org/#close-a-browsing-context>Close a browsing context</a></dfn>
<!-- Code entry-point --> <li><dfn><a href=https://html.spec.whatwg.org/#code-entry-point>Code entry-point</a></dfn>
<!-- Cookie-averse Document object --> <li><dfn><a href=https://html.spec.whatwg.org/#cookie-averse-document-object>Cookie-averse <code>Document</code> object</a></dfn>
<!-- Current entry --> <li><dfn><a href=https://html.spec.whatwg.org/#current-entry>Current entry</a></dfn>
<!-- Determine the value of an indexed property --> <li><dfn data-lt="determining the value of an indexed property"><a href=https://html.spec.whatwg.org/#dom-window-item>Determine the value of an indexed property</a></dfn> of a <a><code>Window</code></a> object
<!-- Disabled --> <li><dfn><a href=https://html.spec.whatwg.org/#concept-fe-disabled>Disabled</a></dfn>
<!-- Document address --> <li><dfn data-lt=address><a href=https://dom.spec.whatwg.org/#concept-document-url>Document address</a></dfn>
<!-- Document title --> <li><dfn data-lt=title><a href=https://html.spec.whatwg.org/#dom-title-text>Document title</a></dfn>
<!-- Enumerated attribute --> <li><dfn><a href=https://html.spec.whatwg.org/#enumerated-attribute>Enumerated attribute</a></dfn>
<!-- Environment settings object --> <li><dfn><a href=https://html.spec.whatwg.org/#environment-settings-object>Environment settings object</a></dfn>
<!-- Event loop --> <li><dfn><a href=https://html.spec.whatwg.org/#event-loop>Event loop</a></dfn>
<!-- File --> <li><dfn><a href="https://html.spec.whatwg.org/#file-upload-state-%28type=file%29">File</a></dfn> state
<!-- Focusing steps --> <li><dfn><a href="https://html.spec.whatwg.org/#focusing-steps">Focusing steps</a></dfn>
<!-- Getting innerText --> <li><dfn><a href=http://rocallahan.github.io/innerText-spec/index.html#setting-innertext>Getting <code>innerText</code></a></dfn>
<!-- Hidden --> <li><dfn><a href="https://html.spec.whatwg.org/#hidden-state-%28type=hidden%29">Hidden</a></dfn> state
<!-- Image Button --> <li><dfn><a href="https://html.spec.whatwg.org/#image-button-state-%28type=image%29">Image Button</a></dfn> state
<!-- Input type file selected --> <li><dfn><a href="https://html.spec.whatwg.org/#concept-input-type-file-selected">Selected Files</a></dfn>
<!-- Joint session history --> <li><dfn><a href=https://html.spec.whatwg.org/#joint-session-history>Joint session history</a></dfn>
<!-- Missing value default state --> <li><dfn><a href=https://html.spec.whatwg.org/#missing-value-default>Missing value default state</a></dfn>
<!-- Navigate --> <li><dfn><a href=https://html.spec.whatwg.org/#navigate>Navigate</a></dfn>
<!-- Nested browsing context --> <li><dfn><a href=https://html.spec.whatwg.org/#nested-browsing-context>Nested browsing context</a></dfn>
<!-- Origin-clean --> <li><dfn><a href=https://html.spec.whatwg.org/#concept-canvas-origin-clean>Origin-clean</a></dfn>
<!-- Parent browsing context --> <li><dfn><a href=https://html.spec.whatwg.org/#parent-browsing-context>Parent browsing context</a></dfn>
<!-- Pause --> <li><dfn data-lt=unpaused><a href=https://html.spec.whatwg.org/#pause>HTML Pause</a></dfn>
<!-- Prompt to unload a document --> <li><dfn data-lt="prompt to unload a document|prompting to unload"><a href=https://html.spec.whatwg.org/#prompt-to-unload-a-document>Prompt to unload a document</a></dfn>
<!-- Radio button --> <li><dfn><a href="https://html.spec.whatwg.org/#radio-button-state-%28type=radio%29">Radio Button</a></dfn> state
<!-- Replacement enabled --> <li><dfn><a href=https://html.spec.whatwg.org/#replacement-enabled>Replacement enabled</a></dfn>
<!-- Reset Button --> <li><dfn><a href="https://html.spec.whatwg.org/#reset-button-state-%28type=reset%29">Reset Button</a></dfn> state
<!-- Script execution environment --> <li><dfn><a href=https://html.spec.whatwg.org/#script-execution-environment>Script execution environment</a></dfn>
<!-- Script --> <li><dfn><a href=https://html.spec.whatwg.org/#concept-script>Script</a></dfn>
<!-- Selectedness --> <li><dfn><a href=https://html.spec.whatwg.org/#concept-option-selectedness>Selectedness</a></dfn>
<!-- setSelectionRange --> <li><dfn data-lt="set selection range"><a href=https://html.spec.whatwg.org/#dom-textarea/input-setselectionrange><code>setSelectionRange</code></a></dfn>
<!-- Settings object --> <li><dfn><a href=https://html.spec.whatwg.org/#settings-object>Settings object</a></dfn>
<!-- Simple dialogues --> <li><dfn data-lt="simple dialogue"><a href=https://html.spec.whatwg.org/#simple-dialogs>Simple dialogues</a></dfn>
<!-- Submit Button --> <li><dfn><a href="https://html.spec.whatwg.org/#submit-button-state-%28type=submit%29">Submit Button</a></dfn> state
<!-- Submittable elements --> <li><dfn data-lt="submittable element"><a href=https://html.spec.whatwg.org/#category-submit>Submittable elements</a></dfn>
<!-- Top-level browsing context --> <li><dfn data-lt="top-level browsing context|top-level browsing contexts"><a href=https://html.spec.whatwg.org/#top-level-browsing-context>Top-level browsing context</a></dfn>
<!-- Traverse the history by a delta --> <li><dfn><a href=https://html.spec.whatwg.org/#traverse-the-history-by-a-delta>Traverse the history by a delta</a></dfn>
<!-- Traverse the history --> <li><dfn data-lt="traverse the history|traversing the history"><a href=https://html.spec.whatwg.org/#traverse-the-history>Traverse the history</a></dfn>
<!-- Tree order --> <li><dfn><a href=https://html.spec.whatwg.org/#tree-order>Tree order</a></dfn>
<!-- User prompt --> <li><dfn data-lt="user prompts"><a href=https://html.spec.whatwg.org/#user-prompts>User prompt</a></dfn>
<!-- Value attribute --><li><dfn><a href=https://html.spec.whatwg.org/#dom-input-value><code>value</code> attribute</a></dfn>
<!-- Value --> <li><dfn><a href=https://html.spec.whatwg.org/#concept-fe-value>Value</a></dfn>
</ul>
<dd><p>The HTML specification also defines a number of elements
which this specification has special-cased behaviour for:
<ul>
<!-- a element --> <li><a href=https://html.spec.whatwg.org/#the-a-element><dfn data-lt="a elements"><code>a</code> element</dfn></a>
<!-- frame element --> <li><a href=https://html.spec.whatwg.org/#frame><dfn><code>frame</code></dfn> element</a>
<!-- iframe element --> <li><a href=https://html.spec.whatwg.org/#the-iframe-element><dfn><code>iframe</code></dfn> element</a>
<!-- canvas element --> <li><dfn><a href=https://html.spec.whatwg.org/#the-canvas-element><code>canvas</code> element</a></dfn>
<!-- HTML Element --> <li><dfn><a href="https://html.spec.whatwg.org/#the-html-element"><code>html</code> element</a></dfn>
<!-- input element --> <li><a href=https://html.spec.whatwg.org/#the-input-element><dfn data-lt="input elements|input"><code>input</code> element</dfn></a>
<!-- option element --> <li><a href=https://html.spec.whatwg.org/#the-option-element><dfn><code>option</code></dfn> element</a>
<!-- textarea element --> <li><a href=https://html.spec.whatwg.org/#the-textarea-element><dfn><code>textarea</code> element</dfn></a>
</ul>
<dd><p>The following types are also defined in the HTML specification,
and referenced here:
<ul>
<!-- Canvas height atribute --> <li><dfn><a href=https://html.spec.whatwg.org/#attr-canvas-height><code>canvas</code>’s height attribute</a></dfn>
<!-- Canvas width attribute --> <li><dfn><a href=https://html.spec.whatwg.org/#attr-canvas-width><code>canvas</code>’ width attribute</a></dfn>
<!-- Window object --> <li><dfn><a href=https://html.spec.whatwg.org/#the-window-object><code>Window</code></a></dfn> object
<!-- WindowProxy exotic object --> <li><dfn><a href=https://html.spec.whatwg.org/#windowproxy><code>WindowProxy</code></a></dfn> exotic object
<!-- readOnly attribute --> <li><dfn><a href=https://html.spec.whatwg.org/#the-readonly-attribute><code>readOnly</code> attribute</a></dfn>
<!-- showModalDialog --> <li><dfn><a href=https://html.spec.whatwg.org/#dom-showmodaldialog><code>showModalDialog()</code></a></dfn>
<!-- type attribute --> <li><dfn><a href=https://html.spec.whatwg.org/#attr-input-type><code>type</code> attribute</a></dfn>
<!-- window confirm --> <li><dfn>window.<a href=https://html.spec.whatwg.org/#dom-confirm><code>confirm</code></a></dfn>
<!-- window.alert --> <li><dfn>window.<a href=https://html.spec.whatwg.org/#dom-alert><code>alert</code></a></dfn>
<!-- window.print --> <li><dfn>window.<a href=https://html.spec.whatwg.org/#dom-print><code>print</code></a></dfn>
<!-- window.prompt --> <li><dfn>window.<a href=https://html.spec.whatwg.org/#dom-prompt><code>prompt</code></a></dfn>
</ul>
<dd><p>The HTML Editing APIs specification defines the following terms: [[!EDITING]]
<ul>
<li><dfn><a href=https://w3c.github.io/editing/contentEditable.html>Content editable</a></dfn></li>
</ul>
<dd><p>The following events are also defined in the HTML specification:
<ul>
<!-- beforeunload --> <li><dfn><a href=https://html.spec.whatwg.org/#event-beforeunload><code>beforeunload</code></a></dfn>
</ul>
<dd><p>The “data” URL scheme specification defines the following terms: [[!RFC2397]]
<ul>
<li><dfn><a href=https://tools.ietf.org/html/rfc2397#section-2><code>data:</code> URL</a></dfn>
</ul>
<dt>HTTP and related specifications
<dd><p>The following terms are defined in the Cookie specification: [[!RFC6265]]
<ul>
<!-- Compute cookie-string --> <li><dfn><a href=https://tools.ietf.org/html/rfc6265#section-5.4>Compute <code>cookie-string</code></a></dfn>
<!-- Cookie --> <li><dfn data-lt=cookies><a href=https://tools.ietf.org/html/rfc6265#section-5.3>Cookie</a></dfn>
<!-- Cookie store --> <li><dfn><a href=https://tools.ietf.org/html/rfc6265#section-5.3>Cookie store</a></dfn>
<!-- Receives a cookie --> <li><dfn data-lt="receiving a cookie"><a href=https://tools.ietf.org/html/rfc6265#section-5.3>Receives a cookie</a></dfn>
</ul>
<dd><p>The following terms are defined in
the Hypertext Transfer Protocol (HTTP) Status Code Registry:
<ul>
<li><dfn><a href=http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml>Status code registry</a></dfn>
</ul>
<dd>The following terms are defined in
the Netscape Navigator Proxy Auto-Config File Format:
<ul>
<li><dfn><a href=https://web.archive.org/web/20070602031929/http://wp.netscape.com/eng/mozilla/2.0/relnotes/demo/proxy-live.html>Proxy autoconfiguration</a></dfn>
</ul>
<dd><p>The specification uses
<dfn data-lt="uri templates|uri template">URI Templates</dfn>. [[!URI-TEMPLATE]]
<dt>Styling
<dd>The following terms are defined in
the CSS Values and Units Module Level 3 specification: [[!CSS3-VALUES]]
<ul>
<li><dfn><a href=http://www.w3.org/TR/css3-values/#reference-pixel>CSS reference pixels</a></dfn>
</ul>
<dd>The following properties are defined in
the CSS Basic Box Model Level 3 specification: [[!CSS3-BOX]]
<ul>
<li>The <dfn><a href=https://drafts.csswg.org/css-box/#visibility><code>visibility</code></a></dfn> property
</ul>
<dd>The following terms are defined in
the CSS Device Adaptation Module Level 1 specification: [[!CSS-DEVICE-ADAPT]]
<ul>
<li><dfn data-lt=viewport><a href=https://drafts.csswg.org/css-device-adapt/#initial-viewport>Initial viewport</a></dfn>,
sometimes here referred to as the <i>viewport</i>.
</ul>
<dd>The following properties are defined in
the CSS Display Module Level 3 specification: [[!CSS3-DISPLAY]]
<ul>
<li>The <dfn><a href=https://drafts.csswg.org/css-display/#the-display-properties><code>display</code></a></dfn> property
</ul>
<dd>The following terms are defined in
the Geometry Interfaces Module Level 1 specification: [[!GEOMETRY-1]]
<ul>
<!-- DOMRect --> <li><a href="https://www.w3.org/TR/geometry-1/#dom-domrect"><dfn><code>DOMRect</code></dfn></a>
<!-- Rectangle --> <li><dfn data-lt="bounding rectangle"><a href=https://drafts.fxtf.org/geometry/#rectangle>Rectangle</a></dfn>
<!-- Rectangle height dimension --> <li><dfn data-lt="height dimension"><a href=https://drafts.fxtf.org/geometry/#rectangle-height-dimension>Rectangle height dimension</a></dfn>
<!-- Rectangle width dimension --> <li><dfn data-lt="width dimension"><a href=https://drafts.fxtf.org/geometry/#rectangle-width-dimension>Rectangle width dimension</a></dfn>
<!-- Rectangle x coordinate --> <li><dfn data-lt="x coordinate"><a href=https://drafts.fxtf.org/geometry/#rectangle-x-coordinate>Rectangle x coordinate</a></dfn>
<!-- Rectangle y coordinate --> <li><dfn data-lt="y coordinate"><a href=https://drafts.fxtf.org/geometry/#rectangle-y-coordinate>Rectangle y coordinate</a></dfn>
</ul>
<dd>The following terms are defined in
the CSS Cascading and Inheritance Level 4 specification: [[!CSS-CASCADE-4]]
<ul>
<li><dfn><a href=https://drafts.csswg.org/css-cascade-4/#computed-value>Computed value</a></dfn>
</ul>
<dd>The following terms are defined in the CSS Object Model: [[!CSSOM]]:
<ul>
<li><dfn><a href=https://drafts.csswg.org/cssom/#resolved-value>Resolved value</a></dfn>
</ul>
<dd>The following functions are defined in
the CSSOM View Module: [[!CSSOM-VIEW]]:
<ul>
<!-- elementsFromPoint --> <li><dfn>Elements from point</dfn> as <a href=https://drafts.csswg.org/cssom-view/#dom-document-elementsfrompoint>elementsFromPoint()</a>
<!-- getClientRects --> <li><dfn><a href=http://www.w3.org/TR/cssom-view/#dom-range-getclientrects>getClientRects</a></dfn>
<!-- innerHeight --> <li><dfn><a href=https://drafts.csswg.org/cssom-view/#dom-window-innerheight>innerHeight</a></dfn>
<!-- innerWidth --> <li><dfn><a href=https://drafts.csswg.org/cssom-view/#dom-window-innerwidth>innerWidth</a></dfn>
<!-- offsetLeft --> <li><dfn><a href=https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsetleft>offsetLeft</a></dfn>
<!-- offsetParent --> <li><dfn><a href=https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsetparent>offsetParent</a></dfn>
<!-- offsetTop --> <li><dfn><a href=https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsettop>offsetTop</a></dfn>
<!-- scrollIntoView --> <li><dfn><a href=https://drafts.csswg.org/cssom-view/#dom-element-scrollintoview>scrollIntoView()</a></dfn>
</ul>
<dt>URLs
<dd>The following terms are defined in the WHATWG URL standard: [[!URL]]
<ul>
<!-- Domain --><li><dfn><a href="https://url.spec.whatwg.org/#concept-domain">Domain</a></dfn>
<!-- Path --> <li><dfn><a href=https://url.spec.whatwg.org/#concept-url-path>Path</a></dfn>
<!-- Path-absolute URL --> <li><dfn><a href=https://url.spec.whatwg.org/#syntax-url-path-absolute>Path-absolute URL</a></dfn>
<!-- URL serialiser --> <li><dfn><a href=https://url.spec.whatwg.org/#concept-url-serializer>URL serialiser</a></dfn>
</ul>
<dt>Web IDL
<dd><p>The IDL fragments in this specification
must be interpreted as required for conforming IDL fragments,
as described in the Web IDL specification. [[!WEBIDL]]
<ul>
<!-- Sequence --><li><a href="https://heycam.github.io/webidl/#idl-sequence"><dfn>Sequence</dfn></a>
<li><dfn data-lt="supported property index"><a href=http://heycam.github.io/webidl/#dfn-supported-property-indices>Supported property indices</a></dfn>
<li><dfn><a href="https://heycam.github.io/webidl/#syntaxerror"><code>SyntaxError</code></a></dfn></li>
<!-- DOMException --><li><a href="https://heycam.github.io/webidl/#dfn-DOMException"><dfn><code>DOMException</code></dfn></a>
</ul>
<dt>XPATH
<dd><p>The following terms are defined in the Document Object Model XPath standard [[!XPATH]]
<ul>
<!-- evaluate --><li><a href="https://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathEvaluator-evaluate"><dfn><code>evaluate</code></dfn></a>
<!-- XPathException --><li><a href="https://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathException"><dfn><code>XPathException</code></dfn></a>
</ul>
</dl>
</section> <!-- /Dependencies -->
</section> <!-- /Conformance -->
<section>
<h2>Terminology</h2>
<p>In equations, all numbers are integers,
addition is represented by “+”,
subtraction is represented by “−”,
and bitwise OR by “|”.
The characters “(” and “)” are used to provide logical grouping in these contexts.
<p>The shorthand
<dfn>min</dfn>(<var>value</var>, <var>value</var>[, <var>value</var>])
returns the smallest item of two or more values.
Conversely, the shorthand
<dfn>max</dfn>(<var>value</var>, <var>value</var>[, <var>value</var>])
returns the largest item of two or more values.
<p>An <dfn>ASCII string</dfn> is a string
in the range U+0000 to U+007F, inclusive.
<p>A <dfn data-lt=uuid>Universally Unique IDentifier (UUID)</dfn> is
a 128 bits long URN that requires no central registration process. [[!RFC4122]]
<p>The <dfn data-lt="Unix timestamp">Unix Epoch</dfn>
is a value that approximates the number of seconds
that have elapsed since the Epoch,
as described by The Open Group Base Specifications Issue 7
<a href=http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_15>section 4.15</a> (IEEE Std 1003.1).
</section> <!-- /Terminology -->
<section>
<h2>Interface</h2>
<pre class=idl>partial interface Navigator {
readonly attribute boolean webdriver;
};</pre>
<p>The <code>webdriver</code> IDL attribute
of the <code><a>Navigator</a></code> interface must return
the value of the <dfn>webdriver-active flag</dfn>, which is initially false.
<p>This property allows websites to determine
that the user agent is under control by WebDriver,
and can be used to help mitigate
<a href=https://en.wikipedia.org/wiki/Denial-of-service_attack>denial-of-service attacks</a>.
</section>
<section>
<h2>Protocol</h2>
<p>WebDriver <a>remote ends</a> must provide
an HTTP-based wire protocol
where the <a>endpoints</a> map to different <a>commands</a>.
<p>As this standard only defines the <a>remote end</a> protocol,
it puts no demands to how <a>local ends</a> should be implemented.
<a>Local ends</a> are only expected to be compatible to the extent
that they can speak the <a>remote end</a>’s protocol;
no requirements are made upon their exposed user-facing API.
<section>
<h3>Algorithms</h3>
<p>Various parts of this specification are written in terms of step-by-step algorithms.
The details of these algorithms do not have any normative significance;
implementations are free to adopt any implementation strategy
that produces equivalent output to the specification.
In particular algorithms in this document are optimised
for readability rather than performance.
<p>Where algorithms that return values are fallible,
they are written in terms of returning either
<dfn>success</dfn> or <dfn>error</dfn>.
A <a>success</a> value has an associated <var>data</var> field
which encapsulates the value returned,
whereas an <a>error</a> response has an associated <a>error code</a>.
<p>The result of <dfn data-lt="getting properties">getting a property</dfn>
with <var>name</var> from an <a>Object</a> is defined as
the result of calling the <a>[[\GetOwnProperty]]</a>
internal method of with property name <var>name</var>.
</section> <!-- /Algorithms -->
<section>
<h3>Commands</h3>
<p>The WebDriver protocol is organised into <a>commands</a>.
Each HTTP request with a method and template defined in this specification
represents a single <dfn data-lt="command|commands">command</dfn>
and therefore each command produces a single HTTP response.
In response to a <a>command</a>,
a <a>remote end</a> will run a series of actions against the remote browser.
<p>Each <a>command</a> defined in this specification
has an associated list of <dfn>remote end steps</dfn>.
This provides the sequence of actions that a <a>remote end</a> takes
when it receives a particular command.
</section>
<section>
<h3>Processing Model</h3>
<p>The <a>remote end</a> acts as a HTTP server reading requests
from the client and writing responses, typically over TCP socket.
For the purposes of this specification we model the data transmission
between a particular <a>local end</a> and <a>remote end</a> with a <dfn>connection</dfn>
to which the <a>remote end</a> may <dfn>write bytes</dfn> and <dfn>read bytes</dfn>.
However the exact details of how this <a>connection</a> works
and how it is established are out of scope.
<p>After such a <a>connection</a> has been established,
a remote end MUST run the following steps:</p>
<p class=issue>Should mention what happens if it can’t be decoded as HTTP.
Note that <a href=https://fetch.spec.whatwg.org/>Fetch</a> isn’t quite right
because it doesn’t specify how to construct a request from network data, or serialize a response.
<ol>
<li><p><a>Read bytes</a> from the connection
until a complete HTTP request can be constructed from the data.
Let <var>request</var> be a <a>request</a>
constructed from the received data,
according to the requirements of [[!RFC7230]].
<li><p>Let <var>request match</var> be the result of the algorithm
to <a>match a request</a> with <var>request</var>’s
<a>method</a> and <a>URL</a> as arguments.
<li><p>If <var>request match</var> is of type <a>error</a>,
<a>send an error</a> with <var>request match</var>’s <a>error code</a>
and jump to step 1.
<p>Otherwise, let <var>command</var> and <var>url variables</var>
be <var>request match</var>’s data.
<li><p>Let <var>session id</var> be the corresponding variable
from <var>url variables</var>.
<li><p>If <var>command</var> is not <a>New Session</a>:
<ol>
<li><p>If <var>session id</var> is not equal to the <a data-lt="session id">ID</a>
of any session in the list of <a>active sessions</a>,
<a>send an error</a> with <a>error code</a> <a>invalid session id</a>,
then jump to step 1 in this overall algorithm.
<p>Otherwise, let the <a>current session</a> be
the <a>session</a> with <a data-lt="session id">ID</a> <var>session id</var>.
</ol>
<li><p>If <var>request</var>’s <a>method</a> is POST:
<ol>
<li><p>Let <var>parse result</var> be the result of
<a>parsing as JSON</a> with <var>request</var>’s
<a>body</a> as the argument.
<li><p>If <var>parse result</var> is an <a>error</a> or if it is a <a>success</a>
but its associated data is not an <a>Object</a>,
<a>send an error</a> with <a>error code</a> <a>invalid argument</a>
and jump back to step 1 in this overall algorithm.
<p>Otherwise, let <var>parameters</var> be <var>parse result</var>’s data.
</ol>
<p>Otherwise, let <var>parameters</var> be null.</p>
<li><p>Let <var>response result</var> be the return value
obtained by running the <a>remote end steps</a> for <var>command</var>
with <var>url variables</var> as arguments.
<li><p>If <var>response result</var> is an <a>error</a>,
<a>send an error</a> with <a>error code</a>
equal to <var>response result</var>’s <a>error code</a>
and jump back to step 1 in this overall algorithm.
<p>Otherwise, if <var>response result</var> is a <a>success</a>,
let <var>response data</var> be <var>response result</var>’s data.
<li><p><a>Send a response</a> with status 200 and <var>response data</var>.
<li><p>Jump to step 1.
</ol>
<p>When required to <dfn>send an error</dfn>,
with <var>error code</var>,
a <a>remote end</a> must run the following steps:</p>
<ol>
<li><p>Let <var>http status</var> and <var>name</var>
be the <a>error response data</a> for <var>error code</var>.
<li><p>Let <var>message</var> be an implementation-defined string
containing a human-readable description of the reason for the error.
<li><p>Let <var>stacktrace</var> be an implementation-defined string
containing a stack trace report of the active stack frames
at the time when the error occurred.
<li><p class=issue>Really need a better way to construct JSON literals.
<p>Let <var>data</var> be a new JSON Object
initialised with the following properties:
<dl>
<dt>"<code>error</code>"
<dd>Value of <var>name</var>.
<dt>"<code>message</code>"
<dd>Value of <var>message</var>.
<dt>"<code>stacktrace</code>"
<dd>Value of <var>stacktrace</var>.
</dl>
<li><p><a>Send a response</a> with <var>status</var>
and <var>data</var> as arguments.
</ol>
<p>When required to <dfn>send a response</dfn>,
with arguments <var>status</var> and <var>data</var>,
a <a>remote end</a> must run the following steps:
<ol>
<li><p>Let <var>response</var> be a new <a>response</a>.
<li><p>Set <var>response</var>’s <a>HTTP status</a> to <var>status</var>,
and <a>status message</a> to the string corresponding
to the description of <var>status</var> in the <a>status code registry</a>.
<li><p>If <var>data</var> is not null, let <var>response</var>’s
<a>body</a> be the result of <a>serializing as JSON</a>
with <var>data</var> as the argument.
<li><p>Let <var>response bytes</var> be the byte sequence resulting
from serializing <var>response</var> according to the rules in [[!RFC7230]].
<li><p><a data-lt="write bytes">Write</a> <var>response bytes</var>
to the <a>connection</a>.
</ol>
</section> <!-- /Processing Model -->
<section>
<h3>Routing Requests</h3>
<p><dfn data-lt="routing requests">Request routing</dfn>
is the process of going from a HTTP request
to the <a data-lt="remote end steps">series of steps</a> needed
to implement the <a>command</a> represented by that request.
<p>A <a>remote end</a> has an associated <dfn>URL prefix</dfn>,
which is used as a prefix on all WebDriver-defined URLs on that remote end.
This must either be undefined or an <a>path-absolute URL</a>.
<aside class=example>
<p>For example a <a>remote end</a> wishing
to run alongside other services on <code>example.com</code>
might set its <a>URL prefix</a> to <code>/wd</code>
so that a <a>new session</a> <a>command</a> would be invoked
by sending a POST request to <code>/wd/session</code>,
rather than <code>/session</code>.
</aside>
<p>In order to <dfn>match a request</dfn> given
a <a><var>method</var></a> and <a><var>URL</var></a>,
the following steps must be taken:
<ol>
<li><p>Let <var>endpoints</var> be a list
containing each row in the <a>table of endpoints</a>.
<li><p>Remove each entry from <var>endpoints</var>
for which the concatenation of the <a>URL prefix</a>
and the entry’s <var>URI template</var>
does not match <var>URL</var>’s <a>path</a>.
<li><p>If there are no entries in <var>endpoints</var>,
return <a>error</a> with <a>error code</a> <a>unknown command</a>.
<li><p>Remove each entry in <var>endpoints</var>
for which the <i>method</i> column
is not an exact case-sensitive match for <var>method</var>.
<li><p>If there are no entries in <var>endpoints</var>,
return <a>error</a> with <a>error code</a> <a>unknown method</a>.
<li><p>There is now exactly one entry in <var>endpoints</var>;
let <var>entry</var> be this entry.
<li><p>Let <var>parameters</var> be the result of extracting the variables
from <var>URL</var> using <var>entry</var>’s <var>URI template</var>.
<li><p>Let <var>command</var> be <var>entry</var>’s <a>command</a>.
<li><p>Return <a>success</a> with data
<var>command</var> and <var>parameters</var>.
</ol>
</section> <!-- /Routing Requests -->
<section>
<h3>List of Endpoints</h3>
<p>The following <dfn data-lt=endpoints>table of endpoints</dfn> lists
the <a>method</a> and <a>URI template</a>
for each <a>endpoint node</a> <a>command</a>.
<table class=simple>
<tr>
<th>Method</th>
<th>URI Template</th>
<th>Command</th>
</tr>
<tr>
<td>POST</td>
<td>/session</td>
<td><a>New Session</a></td>
</tr>
<tr>
<td>DELETE</td>
<td>/session/{<var>session id</var>}</td>
<td><a>Delete Session</a></td>
</tr>
<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/url</td>
<td><a>Go</a></td>
</tr>
<tr>
<td>GET</td>
<td>/session/{<var>session id</var>}/url</td>
<td><a>Get Current URL</a></td>
</tr>
<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/back</td>
<td><a>Back</a></td>
</tr>
<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/forward</td>
<td><a>Forward</a></td>
</tr>
<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/refresh</td>
<td><a>Refresh</a></td>
</tr>
<tr>
<td>GET</td>
<td>/session/{<var>session id</var>}/title</td>
<td><a>Get Title</a></td>
</tr>
<tr>
<td>GET</td>
<td>/session/{<var>session id</var>}/window</td>
<td><a>Get Window Handle</a></td>
</tr>
<tr>
<td>DELETE</td>
<td>/session/{<var>session id</var>}/window</td>
<td><a>Close Window</a></td>
</tr>
<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/window</td>
<td><a>Switch To Window</a></td>
</tr>
<tr>
<td>GET</td>
<td>/session/{<var>session id</var>}/window/handles</td>
<td><a>Get Window Handles</a></td>
</tr>
<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/window/fullscreen</td>
<td><a>Fullscreen Window</a></td>
</tr>
<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/window/maximize</td>
<td><a>Maximize Window</a></td>
</tr>
<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/window/size</td>
<td><a>Set Window Size</a></td>
</tr>
<tr>
<td>GET</td>
<td>/session/{<var>session id</var>}/window/size</td>
<td><a>Get Window Size</a></td>
</tr>
<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/frame</td>
<td><a>Switch To Frame</a></td>
</tr>
<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/frame/parent</td>
<td><a>Switch To Parent Frame</a></td>
</tr>
<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/element</td>
<td><a>Find Element</a></td>
</tr>
<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/element/{element id}/element</td>
<td><a>Find Element From Element</a></td>
</tr>
<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/elements</td>
<td><a>Find Elements</a></td>
</tr>
<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/element/{element id}/elements</td>
<td><a>Find Elements From Element</a></td>
</tr>
<tr>
<td>GET</td>
<td>/session/{<var>session id</var>}/element/active</td>
<td><a>Get Active Element</a></td>
</tr>
<tr>
<td>GET</td>
<td>/session/{<var>session id</var>}/element/{<var>element id</var>}/selected</td>
<td><a>Is Element Selected</a></td>
</tr>
<tr>
<td>GET</td>
<td>/session/{<var>session id</var>}/element/{<var>element id</var>}/attribute/{<var>name</var>}</td>
<td><a>Get Element Attribute</a></td>
</tr>
<tr>
<td>GET</td>
<td>/session/{<var>session id</var>}/element/{<var>element id</var>}/property/{<var>name</var>}</td>
<td><a>Get Element Property</a></td>
</tr>
<tr>
<td>GET</td>
<td>/session/{<var>session id</var>}/element/{<var>element id</var>}/css/{<var>property name</var>}</td>
<td><a>Get Element CSS Value</a></td>
</tr>
<tr>
<td>GET</td>
<td>/session/{<var>session id</var>}/element/{<var>element id</var>}/text</td>
<td><a>Get Element Text</a></td>
</tr>
<tr>
<td>GET</td>
<td>/session/{<var>session id</var>}/element/{<var>element id</var>}/name</td>
<td><a>Get Element Tag Name</a></td>
</tr>
<tr>
<td>GET</td>
<td>/session/{<var>session id</var>}/element/{<var>element id</var>}/rect</td>
<td><a>Get Element Rect</a></td>
</tr>
<tr>
<td>GET</td>
<td>/session/{<var>session id</var>}/element/{<var>element id</var>}/enabled</td>
<td><a>Is Element Enabled</a></td>
</tr>
<tr>
<td>GET</td>
<td>/session/{<var>session id</var>}/source</td>
<td><a>Get Page Source</a></td>
</tr>
<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/execute/sync</td>
<td><a>Execute Script</a></td>
</tr>
<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/execute/async</td>
<td><a>Execute Async Script</a></td>
</tr>
<tr>
<td>GET</td>
<td>/session/{<var>session id</var>}/cookie/{<var>name</var>}</td>
<td><a>Get Cookie</a></td>
</tr>
<tr>
<td>POST</td>