@@ -2101,39 +2101,41 @@ <h3>Processing Capabilities</h3>
2101
2101
return < a > error</ a > with < a > error code</ a > < a > invalid argument</ a > .
2102
2102
</ ol >
2103
2103
2104
- < li > < p > Let < var > desired capabilities</ var > be the result of < a > getting a property</ a >
2104
+ < li > < p > Let < var > all first match capabilities</ var > be the result of < a > getting a property</ a >
2105
2105
named "< code > firstMatch</ code > " from < var > capabilities request</ var > .
2106
2106
2107
2107
< ol >
2108
- < li > < p > If < var > desired capabilities</ var > is < a > undefined</ a > ,
2108
+ < li > < p > If < var > all first match capabilities</ var > is < a > undefined</ a > ,
2109
2109
set the value to a JSON < a > List</ a > with a single entry of an empty JSON < a > Object</ a > .
2110
2110
2111
- < li > < p > If < var > desired capabilities</ var > is not a JSON < a > List</ a > ,
2111
+ < li > < p > If < var > all first match capabilities</ var > is not a JSON < a > List</ a > ,
2112
2112
return < a > error</ a > with < a > error code</ a > < a > invalid argument</ a > .
2113
2113
</ ol >
2114
2114
2115
- < li > < p > For each < var > current desired capabilities</ var > corresponding
2116
- to an indexed property in < var > desired capabilities</ var > :
2115
+ < li > < p > For each < var > first match capabilities</ var > corresponding
2116
+ to an indexed property in < var > all first match capabilities</ var > :
2117
2117
2118
2118
< ol >
2119
- < li > < p > If < var > current desired capabilities</ var > is not a
2119
+ < li > < p > If < var > first match capabilities</ var > is not a
2120
2120
JSON < a > Object</ a > , return < a > error</ a > with < a > error
2121
2121
code</ a > < a > invalid argument</ a > .
2122
2122
2123
2123
< li > < p > Let < var > merged capabilities</ var > be the result of
2124
2124
< a > trying</ a > to < a data-lt ="merging capabilities "> merge
2125
2125
capabilities</ a > with < var > required capabilities</ var >
2126
- and < var > current desired capabilities</ var > as arguments.
2126
+ and < var > first match capabilities</ var > as arguments.
2127
2127
2128
2128
< li > < p > Let < var > matched capabilities</ var > be the result of
2129
- < a > matching capabilities</ a > with < var > merged capabilities</ var >
2130
- as an argument.
2129
+ < a > trying</ a > to < a data-lt ="matching capabilities "> match
2130
+ capabilities</ a > with < var > merged capabilities</ var > as an
2131
+ argument.
2131
2132
2132
- < li > < p > Return < var > matched capabilities</ var > if it is
2133
- not < code > null</ code > .
2133
+ < li > < p > If < var > matched capabilities</ var > is
2134
+ not < a > < code > null</ code > </ a > return
2135
+ < var > matched capabilities</ var > .
2134
2136
</ ol >
2135
2137
2136
- < li > < p > Return < code > null</ code > .
2138
+ < li > < p > Return < a > success </ a > with data < a > < code > null</ code > </ a > .
2137
2139
</ ol >
2138
2140
2139
2141
< p > When < dfn > merging capabilities</ dfn > with JSON < a > Object</ a > arguments
@@ -2152,8 +2154,8 @@ <h3>Processing Capabilities</h3>
2152
2154
property</ a > named < var > name</ var > from < var > primary</ var > .
2153
2155
2154
2156
< li > < p > If < var > value</ var > is not < a > < code > null</ code > </ a >
2155
- < a > set a property</ a > < var > name </ var > to < var > value </ var >
2156
- on < var > result </ var > .
2157
+ < a > set a property</ a > on < var > result </ var > with name
2158
+ < var > name </ var > and value < var > value </ var > .
2157
2159
</ ol >
2158
2160
2159
2161
< li > < p > If < var > secondary</ var > is < a > undefined</ a > , return < var > result</ var > .
@@ -2173,12 +2175,11 @@ <h3>Processing Capabilities</h3>
2173
2175
< li > < p > Run the substeps of the first matching condition:
2174
2176
< dl class =switch >
2175
2177
< dt > < var > value</ var > is < a > < code > null</ code > </ a >
2176
- < dt > < var > value</ var > and < var > primary value</ var > are equal.
2177
2178
< dd > Do nothing.
2178
2179
2179
2180
< dt > < var > primary value</ var > is < a > < code > undefined</ code > </ a >
2180
- < dd > < a > Set a property</ a > named < var > name </ var >
2181
- to < var > value </ var > on < var > result </ var > .
2181
+ < dd > < a > Set a property</ a > on < var > result </ var > with name
2182
+ < var > name </ var > and value < var > value </ var > .
2182
2183
2183
2184
< dt > Otherwise
2184
2185
< dd > Return an < a > error</ a > with < a > error code</ a >
@@ -2189,6 +2190,18 @@ <h3>Processing Capabilities</h3>
2189
2190
< li > < p > Return < var > result</ var > .
2190
2191
</ ol >
2191
2192
2193
+ < aside class =note >
2194
+ < p > The algorithm outlined in < a > matching capabilities</ a > blithely
2195
+ ignores real-world problems that make implemention less than
2196
+ perfectly straightforward, particularly since capbilities can
2197
+ interact in unforeseen ways.
2198
+
2199
+ < p > As an example, an implementation could have a capbility that gives
2200
+ the path to the browser binary to use. This could cause
2201
+ both < code > browserName</ code > and < code > browserVersion</ code > to be
2202
+ impossible to match against until the browser process is started.
2203
+ </ aside >
2204
+
2192
2205
< p > When < dfn > matching capabilities</ dfn >
2193
2206
with JSON < a > Object</ a > argument < var > capabilities</ var > ,
2194
2207
an < a > endpoint node</ a > must take the following steps:
@@ -2199,16 +2212,16 @@ <h3>Processing Capabilities</h3>
2199
2212
2200
2213
< dl >
2201
2214
< dt > "< code > browserName</ code > "
2202
- < dd > Lowercase name of the user agent.
2215
+ < dd > Lowercase name of the user agent as a < a > string </ a > .
2203
2216
2204
2217
< dt > "< code > browserVersion</ code > "
2205
- < dd > The user agent version, as a string.
2218
+ < dd > The user agent version, as a < a > string</ a > .
2206
2219
2207
2220
< dt > "< code > platformName</ code > "
2208
- < dd > Lowercase name of the current platform.
2221
+ < dd > Lowercase name of the current platform as a < a > string </ a > .
2209
2222
2210
2223
< dt > "< code > acceptInsecureCerts</ code > "
2211
- < dd > Boolean initially set to false,
2224
+ < dd > < a > Boolean</ a > initially set to < code > false</ code > ,
2212
2225
indicating the session will not implicitly trust untrusted
2213
2226
or self-signed TLS certificates on < a data-lt =go > navigation</ a > .
2214
2227
@@ -2217,40 +2230,99 @@ <h3>Processing Capabilities</h3>
2217
2230
< a > commands</ a > in < a href =#h-resizing-and-positioning-windows > Resizing and Positioning Windows</ a > .
2218
2231
</ dl >
2219
2232
2220
- < li > < p > Add any implementation-specific capabilities as entries
2221
- to < var > matched capabilities</ var >
2233
+ < li > < p > Optionally add < a > extension capabilities</ a > as entries
2234
+ to < var > matched capabilities</ var > . The values of these may be
2235
+ ellided, and there is no requirement that all
2236
+ < a > extension capabilities</ a > be added.
2222
2237
2223
- < p class =note >
2238
+ < aside class =note >
2239
+ < p >
2240
+ This allows a < a > remote end</ a > to add information that might be
2241
+ useful to a < a > local end</ a > without unnecessarily bloating the
2242
+ response sent back to the user with (e.g.) an entire browser
2243
+ profile.
2244
+
2245
+ < p >
2224
2246
For example, an implementation could choose to indicate that a
2225
2247
screenshot will be taken when returning an error by setting the
2226
2248
capability < code > selenium.screenshot-on-error</ code >
2227
2249
to < code > true</ code > .
2228
- </ p >
2229
-
2230
- < li > < p > For each < var > capability name</ var > corresponding to a
2231
- property in < var > capabilities</ var > :
2250
+ </ aside >
2232
2251
2252
+ < li > < p > For each < var > name</ var > and < var > value</ var > corresponding
2253
+ to < var > capability</ var > 's < a > own properties</ a > :
2233
2254
< ol >
2234
- < li > < p > Let < var > capability value</ var > be the value of
2235
- property < var > capability name</ var > in < var > capabilities</ var > .
2255
+ < li > < p > Run the substeps of the first matching condition:
2256
+ < dl class =switch >
2257
+ < dt > < var > name</ var > equals "< code > acceptInsecureCerts</ code > "
2258
+ < dd > < p > If < var > value</ var > is not a < a > boolean</ a > return
2259
+ an < a > error</ a > with < a > error code</ a > < a > invalid
2260
+ argument</ a > . Otherwise, let < var > capability value</ var > be set
2261
+ to < var > value</ var > .
2262
+
2263
+ < dt > < var > name</ var > equals "< code > browserName</ code > "
2264
+ < dt > < var > name</ var > equals "< code > browserVersion</ code > "
2265
+ < dt > < var > name</ var > equals "< code > platformName</ code > "
2266
+ < dd > < p > If < var > value</ var > is not a < a > string</ a > return
2267
+ an < a > error</ a > with an < a > error code</ a > < a > invalid
2268
+ argument</ a > . Otherwise, let < var > capability value</ var > be set
2269
+ to < var > value</ var > . return < var > value</ var > .
2270
+
2271
+ < dt > < var > name</ var > equals "< code > pageLoadStrategy</ code > "
2272
+ < dd > < p > Let < var > capability value</ var > be the result
2273
+ of < a > trying</ a > to < a > deserialize as a page load strategy</ a >
2274
+ < var > value</ var > .
2275
+
2276
+ < dt > < var > name</ var > equals "< code > proxy</ code > "
2277
+ < dd > < p > Let < var > capability value</ var > be the result
2278
+ of < a > trying</ a > to < a > deserialize as a proxy</ a >
2279
+ < var > value</ var > .
2280
+
2281
+ < dt > < var > name</ var > equals "< code > timeouts</ code > "
2282
+ < dd > < p > Let < var > capability value</ var > be the result
2283
+ of < a > trying</ a > to < a > deserialize as a timeout</ a >
2284
+ < var > value</ var > .
2285
+
2286
+ < dt > < var > name</ var > equals "< code > unhandledPromptBehavior</ code > "
2287
+ < dd > < p > Let < var > capability value</ var > be the result
2288
+ of < a > trying</ a > to < a > deserialize as an unhandled prompt behavior</ a >
2289
+ < var > value</ var > .
2290
+
2291
+ < dt > < var > name</ var > is the name of an < a > extension capability</ a >
2292
+ < dd > < p > Let < var > capability value</ var > be the result
2293
+ of < a > trying</ a > to deserialize < var > value</ var > in an
2294
+ implmentation-specific way.
2295
+
2296
+ < dt > The < a > remote end</ a > is an < a > endpoint node</ a >
2297
+ < dd > Let < var > capability value</ var > be < a > < code > null</ code > </ a > .
2298
+
2299
+ < dt > Otherwise
2300
+ < dd > Let < var > capability value</ var > be set to < var > value</ var > .
2301
+ </ dl >
2236
2302
2237
- < li > < p > Run the substeps of the first matching < var > capability name</ var > :
2303
+ < li > < p > If < var > capability value</ var > is < a > < code > null</ code > </ a >
2304
+ return < a > success</ a > with data < a > < code > null</ code > </ a > .
2305
+
2306
+ < li > < p > Run the substeps of the first matching < var > name</ var > :
2238
2307
2239
2308
< dl class =switch >
2240
2309
< dt > "< code > browserName</ code > "
2241
2310
< dd > < p > If < var > capability value</ var > is not a string equal to
2242
2311
the "< code > browserName</ code > " entry in
2243
- < var > matched capabilities</ var > , return < code > null</ code > .
2312
+ < var > matched capabilities</ var > , return < a > success</ a > with
2313
+ data < a > < code > null</ code > </ a > .
2244
2314
2245
2315
< dt > "< code > browserVersion</ code > "
2246
2316
< dd > < p > Compare < var > capability value</ var >
2247
2317
to the "< code > browserVersion</ code > " entry in < var > matched capabilities</ var >
2248
2318
using an implementation-defined comparison algorithm.
2249
2319
The comparison is to accept a < var > capability value</ var >
2250
2320
that places constraints on the version using
2251
- the "< code > <</ code > ", "< code > <=</ code > ", "< code > ></ code > ", and "< code > >=</ code > " operators.
2321
+ the "< code > <</ code > ", "< code > <=</ code > ", "< code > ></ code > ",
2322
+ and "< code > >=</ code > " operators.
2252
2323
2253
- < p > If the two values do not match, return < code > null</ code > .
2324
+ < p > If the two values do not match, return < a > success</ a > with
2325
+ data < a > < code > null</ code > </ a > .
2254
2326
2255
2327
< p class =note > Version comparison is left as an implementation detail
2256
2328
since each user agent will likely have conflicting methods
@@ -2260,7 +2332,7 @@ <h3>Processing Capabilities</h3>
2260
2332
< dt > "< code > platformName</ code > "
2261
2333
< dd > < p > If < var > capability value</ var > is not a string equal
2262
2334
to the "< code > platformName</ code > " entry in < var > matched capabilities</ var > ,
2263
- return < code > null</ code > .
2335
+ return < a > success </ a > with data < a > < code > null</ code > </ a > .
2264
2336
2265
2337
< div class =note >
2266
2338
< p > The following platform names are in common usage with
@@ -2289,67 +2361,31 @@ <h3>Processing Capabilities</h3>
2289
2361
and the < a > endpoint node</ a > does not support < a > insecure TLS certificates</ a > ,
2290
2362
return < a > error</ a > with < a > error code</ a > < a > invalid argument</ a > .
2291
2363
2292
- < p > Otherwise, set the "< code > acceptInsecureCerts</ code > " entry
2293
- in < var > matched capabilities</ var > to < var > capability value</ var >
2294
- with the < code > null</ code > value being set to < code > false</ code > .
2295
-
2296
- < dt > "< code > pageLoadStrategy</ code > "
2297
- < dd > < p > If < var > capability value</ var > is not a keyword in the
2298
- < a > table of page load strategies</ a > , return < a > error</ a > with
2299
- < a > error code</ a > < a > invalid argument</ a > .
2300
-
2301
- < p > Otherwise, set the "< code > pageLoadStrategy</ code > " entry
2302
- in < var > matched capabilities</ var > to < var > capability value</ var > .
2303
-
2304
2364
< dt > "< code > proxy</ code > "
2305
- < dd > < p > If < var > capability value</ var > is not a < a > proxy configuration</ a > ,
2306
- return < a > error</ a > with < a > error code</ a > < a > invalid argument</ a > .
2307
-
2308
- < p > If the < a > endpoint node</ a > does not support the proxy
2365
+ < dd > < p > If the < a > endpoint node</ a > does not support the proxy
2309
2366
configuration defined in < var > capability value</ var > ,
2310
- return < code > null</ code > .
2311
-
2312
- < p > Otherwise, set the "< code > proxy</ code > " entry
2313
- in < var > matched capabilities</ var > to < var > capability value</ var > .
2314
-
2315
- < dt > "< code > setWindowRect</ code > "
2316
- < dd > < p > If < var > capability value</ var > is not a boolean
2317
- return < a > error</ a > with < a > error code</ a > < a > invalid argument</ a > .
2318
-
2319
- < p > If < var > capability value</ var > is not equal to the
2320
- "< code > setWindowRect</ code > " entry in
2321
- < var > matched capabilities</ var > , return < code > null</ code > .
2322
-
2323
- < dt > "< code > timeouts</ code > "
2324
- < dd > < p > If < var > capability value</ var >
2325
- is not a < a > session timeouts configuration</ a > object,
2326
- return < a > error</ a > with < a > error code</ a > < a > invalid argument</ a > .
2327
-
2328
- < p > Otherwise, set the "< code > timeouts</ code > " entry
2329
- in < var > matched capabilities</ var > to < var > capability value</ var > .
2330
-
2331
- < dt > "< code > unhandledPromptBehavior</ code > "
2332
- < dd > < p > If < var > capability value</ var > is not a < a > user prompt handler</ a >
2333
- keyword, return < a > error</ a > with < a > error code</ a > < a > invalid argument</ a > .
2334
-
2335
- < p > Otherwise, set the "< code > unhandledPromptBehavior</ code > " entry in
2336
- < var > matched capabilities</ var > to < var > capability value</ var > .
2367
+ return < a > success</ a > with data < a > < code > null</ code > </ a > .
2337
2368
2338
2369
< dt > < strong > Otherwise</ strong >
2339
- < dd > < p > If < var > capability name</ var > is not recognized
2340
- by the < a > endpoint node</ a > , return < code > null</ code > .
2341
-
2342
- < p > Let < var > processed value</ var > be the result of < a > trying</ a >
2343
- implementation-specific steps to match on
2344
- < var > capability name</ var > with < var > capability value</ var > .
2345
-
2346
- < p > Create a new entry in < var > matched capabilities</ var >
2347
- with name < var > capability name</ var > and value < var > processed value</ var > .
2370
+ < dd > < p > If < var > name</ var > is not the name of an
2371
+ < a > extension capability</ a > and the < a > remote end</ a > is
2372
+ an < a > endpoint node</ a > return < a > success</ a > with data
2373
+ < code > null</ code > .
2374
+
2375
+ < p > Let < var > matched value</ var > be the result of < a > trying</ a >
2376
+ implementation-specific steps to match on < var > name</ var >
2377
+ with < var > capability value</ var > . If the match is not
2378
+ successful, return < a > success</ a > with
2379
+ data < a > < code > null</ code > </ a > .
2348
2380
</ dl >
2381
+
2382
+ < li > < p > < a > Set a property</ a > on < var > matched capability</ var >
2383
+ with name < var > name</ var > and value < var > capability value</ var > .
2349
2384
</ ol >
2350
2385
2351
- < li > < p > Return < var > matched capabilities</ var > .
2386
+ < li > < p > Return < a > success </ a > with data < var > matched capabilities</ var > .
2352
2387
</ ol >
2388
+
2353
2389
</ section > <!-- /Processing Capabilities -->
2354
2390
</ section > <!-- /Capabilities -->
2355
2391
@@ -2544,7 +2580,7 @@ <h3>New Session</h3>
2544
2580
return < a > error</ a > with < a > error code</ a > < a > session not created</ a > and
2545
2581
the error data from < var > capabilities result</ var > .
2546
2582
2547
- < li > < p > If < var > capabilities result</ var > is < a > null</ a > ,
2583
+ < li > < p > If < var > capabilities result</ var > 's data is < a > null</ a > ,
2548
2584
return < a > error</ a > with < a > error code</ a > < a > session not created</ a > .
2549
2585
2550
2586
< li > < p > Let < var > capabilities</ var > be < var > capabilities result</ var > ’s data.
0 commit comments