forked from w3c/webdriver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
11444 lines (9123 loc) · 408 KB
/
index.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 lang=en-us
data-issue-url="https://github.com/w3c/webdriver/"
data-issue-param-milestone="Level 1">
<meta charset=utf-8>
<title>WebDriver</title>
<script src=https://www.w3.org/Tools/respec/respec-w3c defer class=remove></script>
<script class=remove>
var respecConfig = {
specStatus: "ED",
shortName: "webdriver2",
testSuiteURI: "https://wpt.live/webdriver/",
implementationReportURI: "https://wpt.fyi/results/webdriver",
github: {
repoURL: "https://github.com/w3c/webdriver/",
branch: "master",
},
editors: [
{
name: "Simon Stewart", url: "http://www.rocketpoweredjetpants.com/",
company: "Apple", companyURL: "https://www.apple.com",
w3cid: "50228"
},
{
name: "David Burns", url: "http://www.theautomatedtester.co.uk/",
company: "BrowserStack", companyURL: "https://www.browserstack.com",
w3cid: "50184"
}
],
otherLinks: [{
key: "Channel",
data: [
{value: "#webdriver on irc.w3.org", href: "https://www.w3.org/wiki/IRC"},
]
}],
localBiblio: {
"RFC6265bis": {
"authors": [
"M. West",
"J. Wilander"
],
"href": "https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-05",
"title": "Cookies: HTTP State Management Mechanism",
"status": "Draft",
"publisher": "IETF"
}
},
group: "browser-tools-testing",
noIDLSorting: true,
mdn: "webdriver",
xref: {
specs: ["fileapi"],
profile: "web-platform",
},
};
</script>
<script src=issue.js></script>
<style>
/* ul.brief to create inline comma separated lists */
ul.brief::before {
content: '\21D2\A0';
font: 1.2em/1.45 Helvetica Neue, sans-serif;
}
ul.brief li { display: inline }
ul.brief li::after { content: ", " }
ul.brief li:last-child::after { content: "" }
/* dl.subcategories when the definition list subdivides a definition */
dl.subcategories { margin-left: 2em }
</style>
<body data-cite="CSSOM-VIEW GEOMETRY-1">
<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 behavior of web browsers.
<p>
Provided is a set of interfaces
to discover and manipulate DOM elements in web documents
and to control the behavior 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.
</section>
<!-- ReSpec complains if removed completely -->
<section id=sotd></section>
<section class=informative>
<h2>Design</h2>
<p>
The WebDriver standard attempts to follow a number of design goals:
<section>
<h3>Compatibility</h3>
<p>
This specification is derived from the popular
<a href=https://selenium.dev>Selenium WebDriver</a> browser automation framework.
Selenium is a long-lived project,
and due to its age and breadth of use
it 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 WebDriver
to avoid unexpected breakages.
</section>
<section>
<h3>Simplicity</h3>
<p>
The largest intended group of users of this specification
are software developers and testers
writing 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 commands
that simplify common tasks such as <a data-lt="Element Send Keys">typing into</a>
and <a data-lt="Element Click">clicking</a> elements.
</section>
<section>
<h3>Extensions</h3>
<p>
WebDriver provides a mechanism for others to define extensions to the protocol
for the purposes of automating functionality that cannot be implemented entirely
in <a href=https://tc39.github.io/ecma262/>ECMAScript</a>. This allows other
web standards to support the automation of new platform features. It also
allows vendors to expose functionality that is specific to their browser.
</section>
</section> <!-- /Design Notes -->
<section id="conformance">
<p>
Conformance requirements phrased as algorithms
or 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.
</section>
<section>
<h2>Terminology</h2>
<p>
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.
<p>
The mathematical function
<dfn>min</dfn>(<var>value</var>, <var>value</var>[, <var>value</var>])
returns the smallest item of two or more values.
Conversely, the function
<dfn>max</dfn>(<var>value</var>, <var>value</var>[, <var>value</var>])
returns the largest item of two or more values.
<p>
The mathematical function <dfn>floor</dfn>(<var>value</var>)
produces the largest integer, closest to positive infinity,
that is not larger than <var>value</var>.
<p>
A <dfn data-lt=uuid>Universally Unique Identifier (UUID)</dfn>
is a 128 bits long URN that requires no central registration process.
<dfn>Generating a UUID</dfn> means
<i>Creating a UUID From Truly Random or Pseudo-Random Numbers</i>,
and converting it to the string representation.
[[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=https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_15>section 4.15</a> (IEEE Std 1003.1).
<p>
An <dfn>integer</dfn> is a <a>Number</a> that is unchanged
under the <a>ToInteger</a> operation.
<p>
The <dfn>initial value</dfn> of an ECMAScript property
is 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.
<!--
‘Chrome’ definition is borrowed
from Web Security Context: User Interface Guidelines:
https://www.w3.org/TR/wsc-ui/#def-chrome
-->
<p>
The <dfn>browser chrome</dfn> is a non-normative term
to refer to the representation through which the user
interacts with the user agent itself,
as distinct from the accessed web content.
Examples of <dfn data-lt="browser chrome element">browser chrome elements</dfn>
include, 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).
</section> <!-- /Terminology -->
<section>
<h2>Interface</h2>
<p>
The <dfn>webdriver-active flag</dfn>
is set to true when the user agent is under remote control.
It is initially false.
<pre class=idl>
interface mixin NavigatorAutomationInformation {
readonly attribute boolean webdriver;
};
Navigator includes NavigatorAutomationInformation;
</pre>
<p class=note>
The {{NavigatorAutomationInformation}} interface
should not be exposed on {{WorkerNavigator}}.
<dl>
<dt><dfn>webdriver</dfn>
<dd>
<p>Returns true if <a>webdriver-active flag</a> is set, false otherwise.
</dl>
<aside class=example>
<p>
For web authors (non-normative):
<dl>
<dt><code>navigator</code>.<a><code>webdriver</code></a>
<dd><p>
Defines a standard way for co-operating user agents
to inform the document that it is controlled by WebDriver,
for example so that alternate code paths can be triggered during automation.
</dl>
</aside>
<p style="display: none">
It is acknowledged that this is complementary to the Evil Bit [[RFC3514]].
</section>
<section>
<h2>Nodes</h2>
<p>The WebDriver protocol consists of communication between:
<dl>
<dt><dfn data-lt="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.
<dt><dfn data-lt="remote ends|remote">Remote end</dfn>
<dd>The remote end hosts the server side of the <a href=#protocol>protocol</a>.
Defining the behavior of a remote end in response to the WebDriver protocol
forms the largest part of this specification.
</dl>
<p>For <a>remote ends</a> the standard defines two broad conformance
classes, known as <dfn data-lt="node type">node types</dfn>:
<dl>
<dt><dfn data-lt="intermediary nodes">Intermediary node</dfn>
<dd>Intermediary nodes are those that act as proxies, implementing
both the <a>local end</a> and <a>remote end</a> of
the <a href=#protocol>protocol</a>. However they are not expected
to implement <a>remote end steps</a> directly. All nodes between a
specific <a>intermediary node</a> and a <a>local end</a> are said to
be <dfn data-lt="downstream node">downstream</dfn> of that
node. Conversely, any nodes between a specific <a>intermediary
node</a> and an <a>endpoint node</a> are said to
be <dfn data-lt="upstream node">upstream</dfn>.
<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.
</dl>
<p>All remote end <a>node types</a> 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.
<p>
The <dfn>readiness state</dfn> of a <a>remote end</a>
indicates whether it is free to accept new connections.
It must be false if the maximum <a>active sessions</a>
is equal to the length of the list of <a>active sessions</a>,
or if the node is an <a>intermediary node</a>
and is known to be in a state in which attempting to create <a>new sessions</a> would fail.
In all other cases it must be true.
<p class=example>If the <a>intermediary node</a>
is a multiplexer that manages
multiple <a data-lt="endpoint node">endpoint nodes</a>,
this might indicate its ability to purvey more <a>sessions</a>,
for example if it has hit its maximum capacity.
</section> <!-- /Nodes -->
<section>
<h2>Protocol</h2>
<p>WebDriver <a>remote ends</a> must provide
an <a>HTTP compliant</a> 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 optimized
for readability rather than performance.
<p>Where algorithms that return values are fallible,
they are written in terms of returning either
<dfn class="export">success</dfn> or <dfn class="export">error</dfn>.
A <a>success</a> value has an associated <var>data</var> field
which encapsulates the value returned,
whereas an <a>error</a> value has an associated <a>error code</a>.
<p>When calling a fallible algorithm,
the construct “Let <var>result</var> be the result
of <dfn class="export" data-lt="try">trying</dfn> to call <var>algorithm</var>”
is equivalent to
<ol>
<li><p>Let <var>temp</var> be the result of calling <var>algorithm</var>.
<li><p>If <var>temp</var> is an <a>error</a> return <var>temp</var>,
otherwise let <var>result</var> be <var>temp</var>’s <var>data</var> field.
</ol>
<p>The result of <dfn data-lt="getting properties|getting the
property">getting a property</dfn> with <var>name</var>
from <var>object</var> is defined as being the same as the result of
calling <a>Object.[[\GetOwnProperty]]</a>(<var>name</var>) on <var>object</var>.
<p>The result of <dfn data-lt="getting the property with
default">getting a property with default</dfn> with
arguments <var>name</var> and <var>default</var>
from <var>object</var> is defined as being the same as the result of
calling
<a>Object.[[\GetOwnProperty]]</a>(<var>name</var>)
on <var>object</var> if that results in a value other
than <code>undefined</code> and <var>default</var> otherwise.
<p><dfn data-lt='set a property'>Setting a property</dfn> with
arguments <var>name</var> and <var>value</var> on <var>object</var>
is defined as being the same as calling
<a>Object.[[\Put]]</a>(<var>name</var>, <var>value</var>) on <var>object</var>.
<p>The result of <dfn>JSON serialization</dfn> with <var>object</var>
of type JSON <a>Object</a> is defined as the result of
calling <a>stringify</a>(<var>object</var>).
<p>The result of <dfn data-lt='parsing as json'>JSON deserialization</dfn> with <var>text</var> is defined as
the result of calling <a>parse</a>(<var>text</var>).
</section> <!-- /Algorithms -->
<section>
<h3>Commands</h3>
<p>
The WebDriver protocol is organized into <a>commands</a>.
Each <a>HTTP request</a> with a method and template defined in this specification
represents a single <dfn data-lt=commands>command</dfn>,
and therefore each command produces a single <a>HTTP response</a>.
<p>
In response to a <a>command</a>,
a <a>remote end</a> will run a series of actions
known as <dfn class="export">remote end steps</dfn>.
These provide the sequences of actions that a <a>remote end</a> takes
when it receives a particular <a>command</a>.
</section>
<section>
<h3>Processing model</h3>
<p>The <a>remote end</a> 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 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 <a>remote end</a> must run the following steps:</p>
<ol>
<li><p><a>Read bytes</a> from the <a>connection</a> until a
complete <a>HTTP request</a> 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]]. If it
is not possible to construct a complete <a>HTTP request</a>,
the <a>remote end</a> must either close the <a>connection</a>,
return an HTTP response with status code 500, or return
an <a>error</a> with <a>error code</a> <a>unknown error</a>.
<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>command parameters</var>
be <var>request match</var>’s data. Let <var>url variables</var> be a
<a>url variables</a> dictionary mapping the <var>command parameters</var>
to their corresponding values.
<li><p>If <var>session id</var> is among the variables defined by <var>command parameters</var>:
<p class=note>This condition is intended to exclude the <a>New Session</a> and <a>Status</a>
<a>commands</a> and any <a>extension commands</a> which do not operate on a particular <a>session</a>.
<ol>
<li><p>Let <var>session id</var> be the corresponding variable
from <var>command parameters</var>.
<li><p>Let the <a>current session</a> be the <a>session</a>
with <a data-lt="session id">ID</a> <var>session id</var>
in the list of <a>active sessions</a>,
or <a><code>null</code></a> if there is no such matching <a>session</a>.
<li><p>If the <a>current session</a> is <a><code>null</code></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.
<li><p>If the <a>current session</a> is not <a><code>null</code></a>:
<ol>
<li><p>Enqueue <var>request</var>
in the <a>current session</a>’s <a>request queue</a>.
<li><p>Wait until the first element
in the <a>current session</a>’s <a>request queue</a>
is <var>request</var>:
<li><p>Dequeue <var>request</var> from the <a>current session</a>’s <a>request queue</a>.
<li><p>If the list of <a>active sessions</a> no longer contains the <a>current session</a>,
set the <a>current session</a> to <a><code>null</code></a>.
</ol>
</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. If this process throws an exception,
return an <a>error</a> with <a>error code</a> <a>invalid
argument</a> and jump back to step 1 in this overall algorithm.
<li><p>If <var>parse result</var> 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>.
</ol>
<p>Otherwise, let <var>parameters</var> be <a><code>null</code></a>.
<li><p><a>Wait for navigation to complete</a>. If this returns
an <a>error</a> <a data-lt="send an error">return its value</a> and
jump to step 1 in this overall algorithm, otherwise continue.
<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 an argument named <var>url variables</var> whose value is
<var>url variables</var> and an
additional argument named <var>parameters</var> whose value is
<var>parameters</var>.
<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>
and an optional <var>error data</var> dictionary,
a <a>remote end</a> must run the following steps:</p>
<ol>
<li><p>Let <var>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.
<p>Let <var>body</var> be a new JSON <a>Object</a>
initialized with the following properties:
<dl>
<dt>"<code>error</code>"
<dd><var>name</var>
<dt>"<code>message</code>"
<dd><var>message</var>
<dt>"<code>stacktrace</code>"
<dd><var>stacktrace</var>
</dl>
<li><p>If the <a>error data</a> dictionary contains any entries,
set the "<code>data</code>" field on <var>body</var>
to a new JSON <a>Object</a> populated with the dictionary.
<li><p><a>Send a response</a> with <var>status</var>
and <var>body</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><a data-lt="set header">Set</a> the <var>response</var>’s <a>header</a>
with <a data-lt="header name">name</a>
and <a data-lt="header value">value</a>
with the following values:
<dl>
<dt><code>Content-Type</code>
<dd>"<code>application/json; charset=utf-8</code>"
<dt><code>Cache-Control</code>
<dd>"<code>no-cache</code>"
</dl>
<li><p>Let <var>response</var>’s <a>body</a> be
the <a data-lt="utf-8 encode">UTF-8 encoded</a> <a>JSON
serialization</a> of a JSON <a>Object</a> with a key
"<code>value</code>" set to <var>data</var>.
<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>
<p>A <dfn data-lt="url variables">url variable</dfn> dictionary is defined
as the mapping of a <a>command</a>’s <a>URI template</a> variable names
to their corresponding values.
</section> <!-- /Processing model -->
<section>
<h3>Routing requests</h3>
<p><dfn data-lt="routing requests">Request routing</dfn>
is the process of going from a <a>HTTP request</a>
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 <a>remote end</a>.
This must either be <a>undefined</a> or a <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 <a>URI template</a>
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 equal to <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 <a>URI template</a>.
<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>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>. <a>Extension commands</a> are implicitly
appended to this table.
<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>GET</td>
<td>/status</td>
<td><a>Status</a></td>
</tr>
<tr>
<td>GET</td>
<td>/session/{<var>session id</var>}/timeouts</td>
<td><a>Get Timeouts</a></td>
</tr>
<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/timeouts</td>
<td><a>Set Timeouts</a></td>
</tr>
<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/url</td>
<td><a>Navigate To</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/new</td>
<td><a>New Window</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>GET</td>
<td>/session/{<var>session id</var>}/window/rect</td>
<td><a>Get Window Rect</a></td>
</tr>
<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/window/rect</td>
<td><a>Set Window Rect</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/minimize</td>
<td><a>Minimize Window</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>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>}/shadow</td>
<td><a>Get Element Shadow Root</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>}/elements</td>
<td><a>Find Elements</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>}/element/{element id}/elements</td>
<td><a>Find Elements From Element</a></td>
</tr>
<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/shadow/<var>{shadow id}</var>/element</td>
<td><a>Find Element From Shadow Root</a></td>
</tr>
<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/shadow/<var>{shadow id}</var>/elements</td>
<td><a>Find Elements From Shadow Root</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>}/element/{<var>element id</var>}/computedrole</td>
<td><a>Get Computed Role</a></td>
</tr>
<tr>
<td>GET</td>
<td>/session/{<var>session id</var>}/element/{<var>element id</var>}/computedlabel</td>
<td><a>Get Computed Label</a></td>
</tr>
<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/element/{<var>element id</var>}/click</td>
<td><a>Element Click</a></td>
</tr>
<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/element/{<var>element id</var>}/clear</td>
<td><a>Element Clear</a></td>
</tr>
<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/element/{<var>element id</var>}/value</td>
<td><a>Element Send Keys</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</td>
<td><a>Get All Cookies</a></td>
</tr>
<tr>
<td>GET</td>
<td>/session/{<var>session id</var>}/cookie/{<var>name</var>}</td>
<td><a>Get Named Cookie</a></td>
</tr>
<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/cookie</td>
<td><a>Add Cookie</a></td>
</tr>
<tr>
<td>DELETE</td>
<td>/session/{<var>session id</var>}/cookie/{<var>name</var>}</td>
<td><a>Delete Cookie</a></td>
</tr>
<tr>
<td>DELETE</td>
<td>/session/{<var>session id</var>}/cookie</td>
<td><a>Delete All Cookies</a></td>
</tr>
<tr>
<td>POST</td>
<td>/session/{<var>session id</var>}/actions</td>
<td><a>Perform Actions</a></td>
</tr>
<tr>
<td>DELETE</td>
<td>/session/{<var>session id</var>}/actions</td>
<td><a>Release Actions</a></td>
</tr>