@appium/base-driver 9.14.1 → 9.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/build/lib/basedriver/commands/execute.d.ts.map +1 -1
  2. package/build/lib/basedriver/commands/execute.js +24 -2
  3. package/build/lib/basedriver/commands/execute.js.map +1 -1
  4. package/build/lib/basedriver/core.d.ts +4 -10
  5. package/build/lib/basedriver/core.d.ts.map +1 -1
  6. package/build/lib/basedriver/core.js +4 -68
  7. package/build/lib/basedriver/core.js.map +1 -1
  8. package/build/lib/basedriver/driver.d.ts +7 -1
  9. package/build/lib/basedriver/driver.d.ts.map +1 -1
  10. package/build/lib/basedriver/driver.js +8 -0
  11. package/build/lib/basedriver/driver.js.map +1 -1
  12. package/build/lib/basedriver/extension-core.d.ts +16 -0
  13. package/build/lib/basedriver/extension-core.d.ts.map +1 -0
  14. package/build/lib/basedriver/extension-core.js +103 -0
  15. package/build/lib/basedriver/extension-core.js.map +1 -0
  16. package/build/lib/basedriver/helpers.d.ts +2 -2
  17. package/build/lib/basedriver/helpers.d.ts.map +1 -1
  18. package/build/lib/basedriver/helpers.js +1 -1
  19. package/build/lib/express/server.d.ts +23 -17
  20. package/build/lib/express/server.d.ts.map +1 -1
  21. package/build/lib/express/server.js +15 -3
  22. package/build/lib/express/server.js.map +1 -1
  23. package/build/lib/index.d.ts +3 -0
  24. package/build/lib/index.d.ts.map +1 -1
  25. package/build/lib/index.js +8 -1
  26. package/build/lib/index.js.map +1 -1
  27. package/build/lib/jsonwp-proxy/proxy.d.ts +17 -1
  28. package/build/lib/jsonwp-proxy/proxy.d.ts.map +1 -1
  29. package/build/lib/jsonwp-proxy/proxy.js +20 -3
  30. package/build/lib/jsonwp-proxy/proxy.js.map +1 -1
  31. package/build/lib/protocol/bidi-commands.js +3 -2
  32. package/build/lib/protocol/bidi-commands.js.map +1 -1
  33. package/build/lib/protocol/index.d.ts +3 -1
  34. package/build/lib/protocol/index.d.ts.map +1 -1
  35. package/build/lib/protocol/index.js +3 -1
  36. package/build/lib/protocol/index.js.map +1 -1
  37. package/build/lib/protocol/protocol.d.ts +5 -3
  38. package/build/lib/protocol/protocol.d.ts.map +1 -1
  39. package/build/lib/protocol/protocol.js +10 -11
  40. package/build/lib/protocol/protocol.js.map +1 -1
  41. package/build/lib/protocol/routes.d.ts +637 -602
  42. package/build/lib/protocol/routes.d.ts.map +1 -1
  43. package/build/lib/protocol/routes.js +370 -351
  44. package/build/lib/protocol/routes.js.map +1 -1
  45. package/lib/basedriver/commands/execute.ts +27 -2
  46. package/lib/basedriver/core.ts +6 -96
  47. package/lib/basedriver/driver.ts +10 -0
  48. package/lib/basedriver/extension-core.ts +128 -0
  49. package/lib/basedriver/helpers.js +1 -1
  50. package/lib/express/server.js +24 -6
  51. package/lib/index.js +6 -0
  52. package/lib/jsonwp-proxy/proxy.js +20 -3
  53. package/lib/protocol/bidi-commands.js +1 -3
  54. package/lib/protocol/index.js +4 -0
  55. package/lib/protocol/protocol.js +5 -6
  56. package/lib/protocol/routes.js +452 -437
  57. package/package.json +6 -11
@@ -22,6 +22,12 @@ const SET_ALERT_TEXT_PAYLOAD_PARAMS = {
22
22
  * @satisfies {import('@appium/types').MethodMap<import('../basedriver/driver').BaseDriver>}
23
23
  */
24
24
  export const METHOD_MAP = /** @type {const} */ ({
25
+
26
+ //
27
+ // W3C WebDriver (and deprecated MJSONWP that will be removed in Appium 3)
28
+ // https://www.w3.org/TR/webdriver1/
29
+ // https://www.w3.org/TR/webdriver2/
30
+ //
25
31
  '/status': {
26
32
  GET: {command: 'getStatus'},
27
33
  },
@@ -29,6 +35,7 @@ export const METHOD_MAP = /** @type {const} */ ({
29
35
  POST: {
30
36
  command: 'createSession',
31
37
  payloadParams: {
38
+ // TODO: Appium 3 will accept only 'capabilities'.
32
39
  validate: (jsonObj) =>
33
40
  !jsonObj.capabilities &&
34
41
  !jsonObj.desiredCapabilities &&
@@ -37,11 +44,8 @@ export const METHOD_MAP = /** @type {const} */ ({
37
44
  },
38
45
  },
39
46
  },
40
- '/sessions': {
41
- GET: {command: 'getSessions'},
42
- },
43
47
  '/session/:sessionId': {
44
- GET: {command: 'getSession'},
48
+ GET: {command: 'getSession', deprecated: true},
45
49
  DELETE: {command: 'deleteSession'},
46
50
  },
47
51
  '/session/:sessionId/timeouts': {
@@ -59,7 +63,7 @@ export const METHOD_MAP = /** @type {const} */ ({
59
63
  return 'W3C protocol expects any of script, pageLoad or implicit to be set';
60
64
  }
61
65
  } else {
62
- // MJSONWP
66
+ // TODO: Remove in Appium 3
63
67
  if (!util.hasValue(jsonObj.type) || !util.hasValue(jsonObj.ms)) {
64
68
  return 'MJSONWP protocol requires type and ms';
65
69
  }
@@ -69,25 +73,6 @@ export const METHOD_MAP = /** @type {const} */ ({
69
73
  },
70
74
  },
71
75
  },
72
- '/session/:sessionId/timeouts/async_script': {
73
- POST: {command: 'asyncScriptTimeout', payloadParams: {required: ['ms']}, deprecated: true},
74
- },
75
- '/session/:sessionId/timeouts/implicit_wait': {
76
- POST: {command: 'implicitWait', payloadParams: {required: ['ms']}, deprecated: true},
77
- },
78
- // JSONWP
79
- '/session/:sessionId/window_handle': {
80
- GET: {command: 'getWindowHandle'},
81
- },
82
- // W3C
83
- '/session/:sessionId/window/handle': {
84
- GET: {command: 'getWindowHandle'},
85
- },
86
- // JSONWP
87
- '/session/:sessionId/window_handles': {
88
- GET: {command: 'getWindowHandles'},
89
- },
90
- // W3C
91
76
  '/session/:sessionId/window/handles': {
92
77
  GET: {command: 'getWindowHandles'},
93
78
  },
@@ -104,39 +89,10 @@ export const METHOD_MAP = /** @type {const} */ ({
104
89
  '/session/:sessionId/refresh': {
105
90
  POST: {command: 'refresh'},
106
91
  },
107
- // MJSONWP
108
- '/session/:sessionId/execute': {
109
- POST: {command: 'execute', payloadParams: {required: ['script', 'args']}},
110
- },
111
- // MJSONWP
112
- '/session/:sessionId/execute_async': {
113
- POST: {
114
- command: 'executeAsync',
115
- payloadParams: {required: ['script', 'args']},
116
- },
117
- },
92
+
118
93
  '/session/:sessionId/screenshot': {
119
94
  GET: {command: 'getScreenshot'},
120
95
  },
121
- '/session/:sessionId/ime/available_engines': {
122
- GET: {command: 'availableIMEEngines', deprecated: true},
123
- },
124
- '/session/:sessionId/ime/active_engine': {
125
- GET: {command: 'getActiveIMEEngine', deprecated: true},
126
- },
127
- '/session/:sessionId/ime/activated': {
128
- GET: {command: 'isIMEActivated', deprecated: true},
129
- },
130
- '/session/:sessionId/ime/deactivate': {
131
- POST: {command: 'deactivateIMEEngine', deprecated: true},
132
- },
133
- '/session/:sessionId/ime/activate': {
134
- POST: {
135
- command: 'activateIMEEngine',
136
- payloadParams: {required: ['engine']},
137
- deprecated: true,
138
- },
139
- },
140
96
  '/session/:sessionId/frame': {
141
97
  POST: {command: 'setFrame', payloadParams: {required: ['id']}},
142
98
  },
@@ -148,6 +104,7 @@ export const METHOD_MAP = /** @type {const} */ ({
148
104
  POST: {
149
105
  command: 'setWindow',
150
106
  payloadParams: {
107
+ // TODO: Appium 3 will only accept 'handle'. 'name' will be ginored.
151
108
  optional: ['name', 'handle'],
152
109
  // Return both values to match W3C and JSONWP protocols
153
110
  makeArgs: (jsonObj) => {
@@ -167,15 +124,17 @@ export const METHOD_MAP = /** @type {const} */ ({
167
124
  },
168
125
  DELETE: {command: 'closeWindow'},
169
126
  },
170
- '/session/:sessionId/window/:windowhandle/size': {
171
- GET: {command: 'getWindowSize', deprecated: true},
127
+ '/session/:sessionId/window/maximize': {
128
+ POST: {command: 'maximizeWindow'},
172
129
  },
173
- '/session/:sessionId/window/:windowhandle/position': {
174
- POST: {deprecated: true},
175
- GET: {deprecated: true},
130
+ '/session/:sessionId/window/minimize': {
131
+ POST: {command: 'minimizeWindow'},
176
132
  },
177
- '/session/:sessionId/window/:windowhandle/maximize': {
178
- POST: {command: 'maximizeWindow'},
133
+ '/session/:sessionId/window/fullscreen': {
134
+ POST: {command: 'fullScreenWindow'},
135
+ },
136
+ '/session/:sessionId/window/new': {
137
+ POST: {command: 'createNewWindow', payloadParams: {optional: ['type']}},
179
138
  },
180
139
  '/session/:sessionId/cookie': {
181
140
  GET: {command: 'getCookies'},
@@ -206,7 +165,7 @@ export const METHOD_MAP = /** @type {const} */ ({
206
165
  },
207
166
  '/session/:sessionId/element/active': {
208
167
  GET: {command: 'active'}, // W3C: https://w3c.github.io/webdriver/webdriver-spec.html#dfn-get-active-element
209
- POST: {command: 'active'},
168
+ POST: {command: 'active', deprecated: true},
210
169
  },
211
170
  '/session/:sessionId/element/:elementId': {
212
171
  GET: {},
@@ -226,9 +185,6 @@ export const METHOD_MAP = /** @type {const} */ ({
226
185
  '/session/:sessionId/element/:elementId/click': {
227
186
  POST: {command: 'click'},
228
187
  },
229
- '/session/:sessionId/element/:elementId/submit': {
230
- POST: {command: 'submit', deprecated: true},
231
- },
232
188
  '/session/:sessionId/element/:elementId/text': {
233
189
  GET: {command: 'getText'},
234
190
  },
@@ -240,6 +196,7 @@ export const METHOD_MAP = /** @type {const} */ ({
240
196
  !util.hasValue(jsonObj.value) &&
241
197
  !util.hasValue(jsonObj.text) &&
242
198
  'we require one of "text" or "value" params',
199
+ // TODO: Appium 3 will accept only 'value'.
243
200
  optional: ['value', 'text'],
244
201
  // override the default argument constructor because of the special
245
202
  // logic here. Basically we want to accept either a value (old JSONWP)
@@ -250,9 +207,6 @@ export const METHOD_MAP = /** @type {const} */ ({
250
207
  },
251
208
  },
252
209
  },
253
- '/session/:sessionId/keys': {
254
- POST: {command: 'keys', payloadParams: {required: ['value']}, deprecated: true},
255
- },
256
210
  '/session/:sessionId/element/:elementId/name': {
257
211
  GET: {command: 'getName'},
258
212
  },
@@ -268,21 +222,9 @@ export const METHOD_MAP = /** @type {const} */ ({
268
222
  '/session/:sessionId/element/:elementId/attribute/:name': {
269
223
  GET: {command: 'getAttribute'},
270
224
  },
271
- '/session/:sessionId/element/:elementId/equals/:otherId': {
272
- GET: {command: 'equalsElement', deprecated: true},
273
- },
274
225
  '/session/:sessionId/element/:elementId/displayed': {
275
226
  GET: {command: 'elementDisplayed'},
276
227
  },
277
- '/session/:sessionId/element/:elementId/location': {
278
- GET: {command: 'getLocation', deprecated: true},
279
- },
280
- '/session/:sessionId/element/:elementId/location_in_view': {
281
- GET: {command: 'getLocationInView', deprecated: true},
282
- },
283
- '/session/:sessionId/element/:elementId/size': {
284
- GET: {command: 'getSize', deprecated: true},
285
- },
286
228
  '/session/:sessionId/element/:elementId/shadow': {
287
229
  GET: {command: 'elementShadowRoot'},
288
230
  },
@@ -301,12 +243,8 @@ export const METHOD_MAP = /** @type {const} */ ({
301
243
  '/session/:sessionId/element/:elementId/css/:propertyName': {
302
244
  GET: {command: 'getCssProperty'},
303
245
  },
304
- '/session/:sessionId/orientation': {
305
- GET: {command: 'getOrientation'},
306
- POST: {
307
- command: 'setOrientation',
308
- payloadParams: {required: ['orientation']},
309
- },
246
+ '/session/:sessionId/element/:elementId/property/:name': {
247
+ GET: {command: 'getProperty'},
310
248
  },
311
249
  // w3c v2 https://www.w3.org/TR/webdriver2/#get-computed-role
312
250
  'session/:sessionId/element/:elementId/computedrole': {
@@ -316,118 +254,79 @@ export const METHOD_MAP = /** @type {const} */ ({
316
254
  'session/:sessionId/element/:elementId/computedlabel': {
317
255
  GET: {command: 'getComputedLabel'},
318
256
  },
319
- '/session/:sessionId/rotation': {
320
- GET: {command: 'getRotation'},
321
- POST: {command: 'setRotation', payloadParams: {required: ['x', 'y', 'z']}},
257
+ '/session/:sessionId/actions': {
258
+ POST: {command: 'performActions', payloadParams: {required: ['actions']}},
259
+ DELETE: {command: 'releaseActions'},
322
260
  },
323
- '/session/:sessionId/moveto': {
261
+ '/session/:sessionId/alert/text': {
262
+ GET: {command: 'getAlertText'},
324
263
  POST: {
325
- command: 'moveTo',
326
- payloadParams: {optional: ['element', 'xoffset', 'yoffset']},
327
- deprecated: true,
264
+ command: 'setAlertText',
265
+ payloadParams: SET_ALERT_TEXT_PAYLOAD_PARAMS,
328
266
  },
329
267
  },
330
- '/session/:sessionId/click': {
331
- POST: {command: 'clickCurrent', payloadParams: {optional: ['button']}, deprecated: true},
332
- },
333
- '/session/:sessionId/buttondown': {
334
- POST: {command: 'buttonDown', payloadParams: {optional: ['button']}, deprecated: true},
335
- },
336
- '/session/:sessionId/buttonup': {
337
- POST: {command: 'buttonUp', payloadParams: {optional: ['button']}, deprecated: true},
338
- },
339
- '/session/:sessionId/doubleclick': {
340
- POST: {command: 'doubleClick', deprecated: true},
341
- },
342
- '/session/:sessionId/touch/click': {
343
- POST: {command: 'click', payloadParams: {required: ['element']}, deprecated: true},
344
- },
345
- '/session/:sessionId/touch/down': {
346
- POST: {command: 'touchDown', payloadParams: {required: ['x', 'y']}, deprecated: true},
347
- },
348
- '/session/:sessionId/touch/up': {
349
- POST: {command: 'touchUp', payloadParams: {required: ['x', 'y']}, deprecated: true},
350
- },
351
- '/session/:sessionId/touch/move': {
352
- POST: {command: 'touchMove', payloadParams: {required: ['x', 'y']}, deprecated: true},
268
+ '/session/:sessionId/alert/accept': {
269
+ POST: {command: 'postAcceptAlert'},
353
270
  },
354
- '/session/:sessionId/touch/scroll': {
355
- POST: {deprecated: true},
271
+ '/session/:sessionId/alert/dismiss': {
272
+ POST: {command: 'postDismissAlert'},
356
273
  },
357
- '/session/:sessionId/touch/doubleclick': {
358
- POST: {},
274
+ '/session/:sessionId/element/:elementId/rect': {
275
+ GET: {command: 'getElementRect'},
359
276
  },
360
- '/session/:sessionId/actions': {
361
- POST: {command: 'performActions', payloadParams: {required: ['actions']}},
362
- DELETE: {command: 'releaseActions'},
277
+ '/session/:sessionId/execute/sync': {
278
+ POST: {command: 'execute', payloadParams: {required: ['script', 'args']}},
363
279
  },
364
- '/session/:sessionId/touch/longclick': {
280
+ '/session/:sessionId/execute/async': {
365
281
  POST: {
366
- command: 'touchLongClick',
367
- payloadParams: {required: ['elements']},
368
- deprecated: true,
282
+ command: 'executeAsync',
283
+ payloadParams: {required: ['script', 'args']},
369
284
  },
370
285
  },
371
- '/session/:sessionId/touch/flick': {
286
+ '/session/:sessionId/element/:elementId/screenshot': {
287
+ GET: {command: 'getElementScreenshot'},
288
+ },
289
+ '/session/:sessionId/window/rect': {
290
+ GET: {command: 'getWindowRect'},
372
291
  POST: {
373
- command: 'flick',
374
- payloadParams: {
375
- optional: ['element', 'xspeed', 'yspeed', 'xoffset', 'yoffset', 'speed'],
376
- },
377
- deprecated: true,
292
+ command: 'setWindowRect',
293
+ payloadParams: {optional: ['x', 'y', 'width', 'height']},
378
294
  },
379
295
  },
380
- '/session/:sessionId/location': {
381
- GET: {command: 'getGeoLocation'},
382
- POST: {command: 'setGeoLocation', payloadParams: {required: ['location']}},
383
- },
384
- '/session/:sessionId/local_storage': {
385
- GET: {deprecated: true},
386
- POST: {deprecated: true},
387
- DELETE: {deprecated: true},
388
- },
389
- '/session/:sessionId/local_storage/key/:key': {
390
- GET: {deprecated: true},
391
- DELETE: {deprecated: true},
392
- },
393
- '/session/:sessionId/local_storage/size': {
394
- GET: {deprecated: true},
395
- },
396
- '/session/:sessionId/session_storage': {
397
- GET: {deprecated: true},
398
- POST: {deprecated: true},
399
- DELETE: {deprecated: true},
296
+
297
+ //
298
+ // Appium specific
299
+ //
300
+ '/session/:sessionId/ime/available_engines': {
301
+ GET: {command: 'availableIMEEngines'},
400
302
  },
401
- '/session/:sessionId/session_storage/key/:key': {
402
- GET: {deprecated: true},
403
- DELETE: {deprecated: true},
303
+ '/session/:sessionId/ime/active_engine': {
304
+ GET: {command: 'getActiveIMEEngine'},
404
305
  },
405
- '/session/:sessionId/session_storage/size': {
406
- GET: {deprecated: true},
306
+ '/session/:sessionId/ime/activated': {
307
+ GET: {command: 'isIMEActivated'},
407
308
  },
408
- // Selenium 4 clients
409
- '/session/:sessionId/se/log': {
410
- POST: {command: 'getLog', payloadParams: {required: ['type']}},
309
+ '/session/:sessionId/ime/deactivate': {
310
+ POST: {command: 'deactivateIMEEngine'},
411
311
  },
412
- // Selenium 4 clients
413
- '/session/:sessionId/se/log/types': {
414
- GET: {command: 'getLogTypes'},
312
+ '/session/:sessionId/ime/activate': {
313
+ POST: {command: 'activateIMEEngine', payloadParams: {required: ['engine']}},
415
314
  },
416
- // mjsonwire, appium clients
417
- '/session/:sessionId/log': {
418
- POST: {command: 'getLog', payloadParams: {required: ['type']}},
315
+ '/session/:sessionId/rotation': {
316
+ GET: {command: 'getRotation'},
317
+ POST: {command: 'setRotation', payloadParams: {required: ['x', 'y', 'z']}},
419
318
  },
420
- // mjsonwire, appium clients
421
- '/session/:sessionId/log/types': {
422
- GET: {command: 'getLogTypes'},
319
+ '/session/:sessionId/location': {
320
+ GET: {command: 'getGeoLocation'},
321
+ POST: {command: 'setGeoLocation', payloadParams: {required: ['location']}},
423
322
  },
424
- '/session/:sessionId/application_cache/status': {
425
- GET: {},
323
+ '/session/:sessionId/orientation': {
324
+ GET: {command: 'getOrientation'},
325
+ POST: {
326
+ command: 'setOrientation',
327
+ payloadParams: {required: ['orientation']}
328
+ },
426
329
  },
427
-
428
- //
429
- // mjsonwire
430
- //
431
330
  '/session/:sessionId/context': {
432
331
  GET: {command: 'getCurrentContext'},
433
332
  POST: {command: 'setContext', payloadParams: {required: ['name']}},
@@ -435,9 +334,6 @@ export const METHOD_MAP = /** @type {const} */ ({
435
334
  '/session/:sessionId/contexts': {
436
335
  GET: {command: 'getContexts'},
437
336
  },
438
- '/session/:sessionId/element/:elementId/pageIndex': {
439
- GET: {command: 'getPageIndex', deprecated: true},
440
- },
441
337
  '/session/:sessionId/network_connection': {
442
338
  GET: {command: 'getNetworkConnection'},
443
339
  POST: {
@@ -445,54 +341,390 @@ export const METHOD_MAP = /** @type {const} */ ({
445
341
  payloadParams: {unwrap: 'parameters', required: ['type']},
446
342
  },
447
343
  },
448
- '/session/:sessionId/touch/perform': {
449
- POST: {
450
- command: 'performTouch',
451
- payloadParams: {wrap: 'actions', required: ['actions']},
452
- deprecated: true,
453
- },
454
- },
455
- '/session/:sessionId/touch/multi/perform': {
456
- POST: {
457
- command: 'performMultiAction',
458
- payloadParams: {required: ['actions'], optional: ['elementId']},
459
- deprecated: true,
460
- },
461
- },
462
344
  '/session/:sessionId/receive_async_response': {
463
345
  POST: {
464
346
  command: 'receiveAsyncResponse',
465
347
  payloadParams: {required: ['status', 'value']},
466
348
  },
467
349
  },
468
- '/session/:sessionId/appium/device/shake': {
469
- POST: {command: 'mobileShake', deprecated: true},
350
+ '/appium/sessions': {
351
+ GET: {command: 'getAppiumSessions'},
352
+ },
353
+ '/session/:sessionId/appium/capabilities': {
354
+ GET: {command: 'getAppiumSessionCapabilities'}
470
355
  },
471
356
  '/session/:sessionId/appium/device/system_time': {
472
357
  GET: {command: 'getDeviceTime', payloadParams: {optional: ['format']}},
473
358
  POST: {command: 'getDeviceTime', payloadParams: {optional: ['format']}},
474
359
  },
475
- '/session/:sessionId/appium/device/lock': {
476
- POST: {command: 'lock', payloadParams: {optional: ['seconds']}, deprecated: true},
477
- },
478
- '/session/:sessionId/appium/device/unlock': {
479
- POST: {command: 'unlock', deprecated: true},
480
- },
481
- '/session/:sessionId/appium/device/is_locked': {
482
- POST: {command: 'isLocked', deprecated: true},
483
- },
484
- '/session/:sessionId/appium/start_recording_screen': {
360
+ // #region Applications Management
361
+ '/session/:sessionId/appium/device/install_app': {
485
362
  POST: {
486
- command: 'startRecordingScreen',
487
- payloadParams: {optional: ['options']},
488
- deprecated: true,
363
+ command: 'installApp',
364
+ payloadParams: {
365
+ required: ['appPath'],
366
+ optional: ['options'],
367
+ },
489
368
  },
490
369
  },
491
- '/session/:sessionId/appium/stop_recording_screen': {
370
+ '/session/:sessionId/appium/device/activate_app': {
492
371
  POST: {
493
- command: 'stopRecordingScreen',
494
- payloadParams: {optional: ['options']},
495
- deprecated: true,
372
+ command: 'activateApp',
373
+ payloadParams: {
374
+ required: [['appId'], ['bundleId']],
375
+ optional: ['options'],
376
+ },
377
+ },
378
+ },
379
+ '/session/:sessionId/appium/device/remove_app': {
380
+ POST: {
381
+ command: 'removeApp',
382
+ payloadParams: {
383
+ required: [['appId'], ['bundleId']],
384
+ optional: ['options'],
385
+ },
386
+ },
387
+ },
388
+ '/session/:sessionId/appium/device/terminate_app': {
389
+ POST: {
390
+ command: 'terminateApp',
391
+ payloadParams: {
392
+ required: [['appId'], ['bundleId']],
393
+ optional: ['options'],
394
+ },
395
+ },
396
+ },
397
+ '/session/:sessionId/appium/device/app_installed': {
398
+ POST: {
399
+ command: 'isAppInstalled',
400
+ payloadParams: {
401
+ required: [['appId'], ['bundleId']],
402
+ },
403
+ },
404
+ },
405
+ '/session/:sessionId/appium/device/app_state': {
406
+ GET: {
407
+ command: 'queryAppState',
408
+ payloadParams: {
409
+ required: [['appId'], ['bundleId']],
410
+ },
411
+ },
412
+ POST: {
413
+ command: 'queryAppState',
414
+ payloadParams: {
415
+ required: [['appId'], ['bundleId']],
416
+ },
417
+ deprecated: true,
418
+ },
419
+ },
420
+ // #endregion
421
+ '/session/:sessionId/appium/device/hide_keyboard': {
422
+ POST: {
423
+ command: 'hideKeyboard',
424
+ payloadParams: {optional: ['strategy', 'key', 'keyCode', 'keyName']},
425
+ },
426
+ },
427
+ '/session/:sessionId/appium/device/is_keyboard_shown': {
428
+ GET: {command: 'isKeyboardShown'},
429
+ },
430
+ '/session/:sessionId/appium/device/push_file': {
431
+ POST: {command: 'pushFile', payloadParams: {required: ['path', 'data']}},
432
+ },
433
+ '/session/:sessionId/appium/device/pull_file': {
434
+ POST: {command: 'pullFile', payloadParams: {required: ['path']}},
435
+ },
436
+ '/session/:sessionId/appium/device/pull_folder': {
437
+ POST: {command: 'pullFolder', payloadParams: {required: ['path']}},
438
+ },
439
+ '/session/:sessionId/appium/settings': {
440
+ POST: {command: 'updateSettings', payloadParams: {required: ['settings']}},
441
+ GET: {command: 'getSettings'},
442
+ },
443
+ '/session/:sessionId/appium/events': {
444
+ POST: {command: 'getLogEvents', payloadParams: {optional: ['type']}},
445
+ },
446
+ '/session/:sessionId/appium/log_event': {
447
+ POST: {
448
+ command: 'logCustomEvent',
449
+ payloadParams: {required: ['vendor', 'event']},
450
+ },
451
+ },
452
+ // #region Inspector
453
+ '/session/:sessionId/appium/commands': {
454
+ GET: {command: 'listCommands'},
455
+ },
456
+ '/session/:sessionId/appium/extensions': {
457
+ GET: {command: 'listExtensions'},
458
+ },
459
+ // #endregion
460
+
461
+ //
462
+ // 3rd party vendor/protcol support
463
+ //
464
+ // #region Selenium/Chromium browsers
465
+ '/session/:sessionId/se/log': {
466
+ POST: {command: 'getLog', payloadParams: {required: ['type']}},
467
+ },
468
+ '/session/:sessionId/se/log/types': {
469
+ GET: {command: 'getLogTypes'},
470
+ },
471
+ // #endregion
472
+
473
+ // #region chromium devtools
474
+ // https://chromium.googlesource.com/chromium/src/+/master/chrome/test/chromedriver/server/http_handler.cc
475
+ '/session/:sessionId/:vendor/cdp/execute': {
476
+ POST: {command: 'executeCdp', payloadParams: {required: ['cmd', 'params']}},
477
+ },
478
+ // #endregion
479
+
480
+ // #region Webauthn
481
+ // https://www.w3.org/TR/webauthn-2/#sctn-automation-add-virtual-authenticator
482
+ '/session/:sessionId/webauthn/authenticator': {
483
+ POST: {
484
+ command: 'addVirtualAuthenticator',
485
+ payloadParams: {
486
+ required: ['protocol', 'transport'],
487
+ optional: ['hasResidentKey', 'hasUserVerification', 'isUserConsenting', 'isUserVerified'],
488
+ },
489
+ },
490
+ },
491
+ '/session/:sessionId/webauthn/authenticator/:authenticatorId': {
492
+ DELETE: {
493
+ command: 'removeVirtualAuthenticator',
494
+ },
495
+ },
496
+ '/session/:sessionId/webauthn/authenticator/:authenticatorId/credential': {
497
+ POST: {
498
+ command: 'addAuthCredential',
499
+ payloadParams: {
500
+ required: ['credentialId', 'isResidentCredential', 'rpId', 'privateKey'],
501
+ optional: ['userHandle', 'signCount'],
502
+ },
503
+ },
504
+ },
505
+ '/session/:sessionId/webauthn/authenticator/:authenticatorId/credentials': {
506
+ GET: {command: 'getAuthCredential'},
507
+ DELETE: {command: 'removeAllAuthCredentials'},
508
+ },
509
+ '/session/:sessionId/webauthn/authenticator/:authenticatorId/credentials/:credentialId': {
510
+ DELETE: {command: 'removeAuthCredential'},
511
+ },
512
+ '/session/:sessionId/webauthn/authenticator/:authenticatorId/uv': {
513
+ POST: {
514
+ command: 'setUserAuthVerified',
515
+ payloadParams: {
516
+ required: ['isUserVerified'],
517
+ },
518
+ },
519
+ },
520
+ // #endregion
521
+
522
+ //
523
+ // Endpoints deprecated entirely
524
+ //
525
+ // #region MJSONWP
526
+ '/sessions': {
527
+ GET: {command: 'getSessions', deprecated: true},
528
+ },
529
+ '/session/:sessionId/timeouts/async_script': {
530
+ POST: {command: 'asyncScriptTimeout', payloadParams: {required: ['ms']}, deprecated: true},
531
+ },
532
+ '/session/:sessionId/timeouts/implicit_wait': {
533
+ POST: {command: 'implicitWait', payloadParams: {required: ['ms']}, deprecated: true},
534
+ },
535
+ '/session/:sessionId/window_handle': {
536
+ GET: {command: 'getWindowHandle', deprecated: true},
537
+ },
538
+ // Only 'window/handles' exists in W3C WebDriver spec.
539
+ '/session/:sessionId/window/handle': {
540
+ GET: {command: 'getWindowHandle', deprecated: true},
541
+ },
542
+ '/session/:sessionId/window_handles': {
543
+ GET: {command: 'getWindowHandles', deprecated: true},
544
+ },
545
+ '/session/:sessionId/execute': {
546
+ POST: {
547
+ command: 'execute',
548
+ payloadParams: {required: ['script', 'args']},
549
+ deprecated: true
550
+ },
551
+ },
552
+ '/session/:sessionId/execute_async': {
553
+ POST: {
554
+ command: 'executeAsync',
555
+ payloadParams: {required: ['script', 'args']},
556
+ deprecated: true
557
+ },
558
+ },
559
+ '/session/:sessionId/window/:windowhandle/size': {
560
+ GET: {command: 'getWindowSize', deprecated: true},
561
+ },
562
+ '/session/:sessionId/window/:windowhandle/position': {
563
+ POST: {deprecated: true},
564
+ GET: {deprecated: true},
565
+ },
566
+ '/session/:sessionId/window/:windowhandle/maximize': {
567
+ POST: {command: 'maximizeWindow', deprecated: true},
568
+ },
569
+ '/session/:sessionId/element/:elementId/submit': {
570
+ POST: {command: 'submit', deprecated: true},
571
+ },
572
+ '/session/:sessionId/keys': {
573
+ POST: {command: 'keys', payloadParams: {required: ['value']}, deprecated: true},
574
+ },
575
+ '/session/:sessionId/element/:elementId/equals/:otherId': {
576
+ GET: {command: 'equalsElement', deprecated: true},
577
+ },
578
+ '/session/:sessionId/element/:elementId/location': {
579
+ GET: {command: 'getLocation', deprecated: true},
580
+ },
581
+ '/session/:sessionId/element/:elementId/location_in_view': {
582
+ GET: {command: 'getLocationInView', deprecated: true},
583
+ },
584
+ '/session/:sessionId/element/:elementId/size': {
585
+ GET: {command: 'getSize', deprecated: true},
586
+ },
587
+ '/session/:sessionId/moveto': {
588
+ POST: {
589
+ command: 'moveTo',
590
+ payloadParams: {optional: ['element', 'xoffset', 'yoffset']},
591
+ deprecated: true,
592
+ },
593
+ },
594
+ '/session/:sessionId/click': {
595
+ POST: {command: 'clickCurrent', payloadParams: {optional: ['button']}, deprecated: true},
596
+ },
597
+ '/session/:sessionId/buttondown': {
598
+ POST: {command: 'buttonDown', payloadParams: {optional: ['button']}, deprecated: true},
599
+ },
600
+ '/session/:sessionId/buttonup': {
601
+ POST: {command: 'buttonUp', payloadParams: {optional: ['button']}, deprecated: true},
602
+ },
603
+ '/session/:sessionId/doubleclick': {
604
+ POST: {command: 'doubleClick', deprecated: true},
605
+ },
606
+ '/session/:sessionId/touch/click': {
607
+ POST: {command: 'click', payloadParams: {required: ['element']}, deprecated: true},
608
+ },
609
+ '/session/:sessionId/touch/down': {
610
+ POST: {command: 'touchDown', payloadParams: {required: ['x', 'y']}, deprecated: true},
611
+ },
612
+ '/session/:sessionId/touch/up': {
613
+ POST: {command: 'touchUp', payloadParams: {required: ['x', 'y']}, deprecated: true},
614
+ },
615
+ '/session/:sessionId/touch/move': {
616
+ POST: {command: 'touchMove', payloadParams: {required: ['x', 'y']}, deprecated: true},
617
+ },
618
+ '/session/:sessionId/touch/scroll': {
619
+ POST: {deprecated: true},
620
+ },
621
+ '/session/:sessionId/touch/doubleclick': {
622
+ POST: {deprecated: true},
623
+ },
624
+ '/session/:sessionId/touch/longclick': {
625
+ POST: {
626
+ command: 'touchLongClick',
627
+ payloadParams: {required: ['elements']},
628
+ deprecated: true,
629
+ },
630
+ },
631
+ '/session/:sessionId/touch/flick': {
632
+ POST: {
633
+ command: 'flick',
634
+ payloadParams: {
635
+ optional: ['element', 'xspeed', 'yspeed', 'xoffset', 'yoffset', 'speed'],
636
+ },
637
+ deprecated: true,
638
+ },
639
+ },
640
+ '/session/:sessionId/local_storage': {
641
+ GET: {deprecated: true},
642
+ POST: {deprecated: true},
643
+ DELETE: {deprecated: true},
644
+ },
645
+ '/session/:sessionId/local_storage/key/:key': {
646
+ GET: {deprecated: true},
647
+ DELETE: {deprecated: true},
648
+ },
649
+ '/session/:sessionId/local_storage/size': {
650
+ GET: {deprecated: true},
651
+ },
652
+ '/session/:sessionId/session_storage': {
653
+ GET: {deprecated: true},
654
+ POST: {deprecated: true},
655
+ DELETE: {deprecated: true},
656
+ },
657
+ '/session/:sessionId/session_storage/key/:key': {
658
+ GET: {deprecated: true},
659
+ DELETE: {deprecated: true},
660
+ },
661
+ '/session/:sessionId/session_storage/size': {
662
+ GET: {deprecated: true},
663
+ },
664
+ '/session/:sessionId/application_cache/status': {
665
+ GET: {deprecated: true},
666
+ },
667
+ '/session/:sessionId/alert_text': {
668
+ GET: {command: 'getAlertText', deprecated: true},
669
+ POST: {
670
+ command: 'setAlertText',
671
+ payloadParams: SET_ALERT_TEXT_PAYLOAD_PARAMS,
672
+ deprecated: true
673
+ },
674
+ },
675
+ '/session/:sessionId/accept_alert': {
676
+ POST: {command: 'postAcceptAlert', deprecated: true},
677
+ },
678
+ '/session/:sessionId/dismiss_alert': {
679
+ POST: {command: 'postDismissAlert', deprecated: true},
680
+ },
681
+ // Pre-W3C endpoint for element screenshot
682
+ '/session/:sessionId/screenshot/:elementId': {
683
+ GET: {command: 'getElementScreenshot', deprecated: true},
684
+ },
685
+ // #endregion
686
+ // #region Appium specific
687
+ '/session/:sessionId/element/:elementId/pageIndex': {
688
+ GET: {command: 'getPageIndex', deprecated: true},
689
+ },
690
+ '/session/:sessionId/touch/perform': {
691
+ POST: {
692
+ command: 'performTouch',
693
+ payloadParams: {wrap: 'actions', required: ['actions']},
694
+ deprecated: true,
695
+ },
696
+ },
697
+ '/session/:sessionId/touch/multi/perform': {
698
+ POST: {
699
+ command: 'performMultiAction',
700
+ payloadParams: {required: ['actions'], optional: ['elementId']},
701
+ deprecated: true,
702
+ },
703
+ },
704
+ '/session/:sessionId/appium/device/shake': {
705
+ POST: {command: 'mobileShake', deprecated: true},
706
+ },
707
+ '/session/:sessionId/appium/device/lock': {
708
+ POST: {command: 'lock', payloadParams: {optional: ['seconds']}, deprecated: true},
709
+ },
710
+ '/session/:sessionId/appium/device/unlock': {
711
+ POST: {command: 'unlock', deprecated: true},
712
+ },
713
+ '/session/:sessionId/appium/device/is_locked': {
714
+ POST: {command: 'isLocked', deprecated: true},
715
+ },
716
+ '/session/:sessionId/appium/start_recording_screen': {
717
+ POST: {
718
+ command: 'startRecordingScreen',
719
+ payloadParams: {optional: ['options']},
720
+ deprecated: true,
721
+ },
722
+ },
723
+ '/session/:sessionId/appium/stop_recording_screen': {
724
+ POST: {
725
+ command: 'stopRecordingScreen',
726
+ payloadParams: {optional: ['options']},
727
+ deprecated: true,
496
728
  },
497
729
  },
498
730
  '/session/:sessionId/appium/performanceData/types': {
@@ -575,85 +807,6 @@ export const METHOD_MAP = /** @type {const} */ ({
575
807
  '/session/:sessionId/appium/device/current_package': {
576
808
  GET: {command: 'getCurrentPackage', deprecated: true},
577
809
  },
578
- //region Applications Management
579
- '/session/:sessionId/appium/device/install_app': {
580
- POST: {
581
- command: 'installApp',
582
- payloadParams: {
583
- required: ['appPath'],
584
- optional: ['options'],
585
- },
586
- },
587
- },
588
- '/session/:sessionId/appium/device/activate_app': {
589
- POST: {
590
- command: 'activateApp',
591
- payloadParams: {
592
- required: [['appId'], ['bundleId']],
593
- optional: ['options'],
594
- },
595
- },
596
- },
597
- '/session/:sessionId/appium/device/remove_app': {
598
- POST: {
599
- command: 'removeApp',
600
- payloadParams: {
601
- required: [['appId'], ['bundleId']],
602
- optional: ['options'],
603
- },
604
- },
605
- },
606
- '/session/:sessionId/appium/device/terminate_app': {
607
- POST: {
608
- command: 'terminateApp',
609
- payloadParams: {
610
- required: [['appId'], ['bundleId']],
611
- optional: ['options'],
612
- },
613
- },
614
- },
615
- '/session/:sessionId/appium/device/app_installed': {
616
- POST: {
617
- command: 'isAppInstalled',
618
- payloadParams: {
619
- required: [['appId'], ['bundleId']],
620
- },
621
- },
622
- },
623
- '/session/:sessionId/appium/device/app_state': {
624
- GET: {
625
- command: 'queryAppState',
626
- payloadParams: {
627
- required: [['appId'], ['bundleId']],
628
- },
629
- },
630
- POST: {
631
- command: 'queryAppState',
632
- payloadParams: {
633
- required: [['appId'], ['bundleId']],
634
- },
635
- deprecated: true,
636
- },
637
- },
638
- //endregion
639
- '/session/:sessionId/appium/device/hide_keyboard': {
640
- POST: {
641
- command: 'hideKeyboard',
642
- payloadParams: {optional: ['strategy', 'key', 'keyCode', 'keyName']},
643
- },
644
- },
645
- '/session/:sessionId/appium/device/is_keyboard_shown': {
646
- GET: {command: 'isKeyboardShown'},
647
- },
648
- '/session/:sessionId/appium/device/push_file': {
649
- POST: {command: 'pushFile', payloadParams: {required: ['path', 'data']}},
650
- },
651
- '/session/:sessionId/appium/device/pull_file': {
652
- POST: {command: 'pullFile', payloadParams: {required: ['path']}},
653
- },
654
- '/session/:sessionId/appium/device/pull_folder': {
655
- POST: {command: 'pullFolder', payloadParams: {required: ['path']}},
656
- },
657
810
  '/session/:sessionId/appium/device/toggle_airplane_mode': {
658
811
  POST: {command: 'toggleFlightMode', deprecated: true},
659
812
  },
@@ -743,10 +896,6 @@ export const METHOD_MAP = /** @type {const} */ ({
743
896
  deprecated: true,
744
897
  },
745
898
  },
746
- '/session/:sessionId/appium/settings': {
747
- POST: {command: 'updateSettings', payloadParams: {required: ['settings']}},
748
- GET: {command: 'getSettings'},
749
- },
750
899
  '/session/:sessionId/appium/receive_async_response': {
751
900
  POST: {
752
901
  command: 'receiveAsyncResponse',
@@ -754,94 +903,6 @@ export const METHOD_MAP = /** @type {const} */ ({
754
903
  deprecated: true,
755
904
  },
756
905
  },
757
- '/session/:sessionId/appium/events': {
758
- POST: {command: 'getLogEvents', payloadParams: {optional: ['type']}},
759
- },
760
- '/session/:sessionId/appium/log_event': {
761
- POST: {
762
- command: 'logCustomEvent',
763
- payloadParams: {required: ['vendor', 'event']},
764
- },
765
- },
766
-
767
- /*
768
- * The W3C spec has some changes to the wire protocol.
769
- * https://w3c.github.io/webdriver/webdriver-spec.html
770
- * Begin to add those changes here, keeping the old version
771
- * since clients still implement them.
772
- */
773
- // MJSONWP
774
- '/session/:sessionId/alert_text': {
775
- GET: {command: 'getAlertText'},
776
- POST: {
777
- command: 'setAlertText',
778
- payloadParams: SET_ALERT_TEXT_PAYLOAD_PARAMS,
779
- },
780
- },
781
- // MJSONWP
782
- '/session/:sessionId/accept_alert': {
783
- POST: {command: 'postAcceptAlert'},
784
- },
785
- // MJSONWP
786
- '/session/:sessionId/dismiss_alert': {
787
- POST: {command: 'postDismissAlert'},
788
- },
789
- // https://w3c.github.io/webdriver/webdriver-spec.html#user-prompts
790
- '/session/:sessionId/alert/text': {
791
- GET: {command: 'getAlertText'},
792
- POST: {
793
- command: 'setAlertText',
794
- payloadParams: SET_ALERT_TEXT_PAYLOAD_PARAMS,
795
- },
796
- },
797
- '/session/:sessionId/alert/accept': {
798
- POST: {command: 'postAcceptAlert'},
799
- },
800
- '/session/:sessionId/alert/dismiss': {
801
- POST: {command: 'postDismissAlert'},
802
- },
803
- // https://w3c.github.io/webdriver/webdriver-spec.html#get-element-rect
804
- '/session/:sessionId/element/:elementId/rect': {
805
- GET: {command: 'getElementRect'},
806
- },
807
- '/session/:sessionId/execute/sync': {
808
- POST: {command: 'execute', payloadParams: {required: ['script', 'args']}},
809
- },
810
- '/session/:sessionId/execute/async': {
811
- POST: {
812
- command: 'executeAsync',
813
- payloadParams: {required: ['script', 'args']},
814
- },
815
- },
816
- // Pre-W3C endpoint for element screenshot
817
- '/session/:sessionId/screenshot/:elementId': {
818
- GET: {command: 'getElementScreenshot'},
819
- },
820
- '/session/:sessionId/element/:elementId/screenshot': {
821
- GET: {command: 'getElementScreenshot'},
822
- },
823
- '/session/:sessionId/window/rect': {
824
- GET: {command: 'getWindowRect'},
825
- POST: {
826
- command: 'setWindowRect',
827
- payloadParams: {optional: ['x', 'y', 'width', 'height']},
828
- },
829
- },
830
- '/session/:sessionId/window/maximize': {
831
- POST: {command: 'maximizeWindow'},
832
- },
833
- '/session/:sessionId/window/minimize': {
834
- POST: {command: 'minimizeWindow'},
835
- },
836
- '/session/:sessionId/window/fullscreen': {
837
- POST: {command: 'fullScreenWindow'},
838
- },
839
- '/session/:sessionId/window/new': {
840
- POST: {command: 'createNewWindow', payloadParams: {optional: ['type']}},
841
- },
842
- '/session/:sessionId/element/:elementId/property/:name': {
843
- GET: {command: 'getProperty'},
844
- },
845
906
  '/session/:sessionId/appium/device/set_clipboard': {
846
907
  POST: {
847
908
  command: 'setClipboard',
@@ -861,61 +922,15 @@ export const METHOD_MAP = /** @type {const} */ ({
861
922
  deprecated: true,
862
923
  },
863
924
  },
864
-
865
- // chromium devtools
866
- // https://chromium.googlesource.com/chromium/src/+/master/chrome/test/chromedriver/server/http_handler.cc
867
- '/session/:sessionId/:vendor/cdp/execute': {
868
- POST: {command: 'executeCdp', payloadParams: {required: ['cmd', 'params']}},
869
- },
870
-
871
- //region Webauthn
872
- // https://www.w3.org/TR/webauthn-2/#sctn-automation-add-virtual-authenticator
873
-
874
- '/session/:sessionId/webauthn/authenticator': {
875
- POST: {
876
- command: 'addVirtualAuthenticator',
877
- payloadParams: {
878
- required: ['protocol', 'transport'],
879
- optional: ['hasResidentKey', 'hasUserVerification', 'isUserConsenting', 'isUserVerified'],
880
- },
881
- },
882
- },
883
-
884
- '/session/:sessionId/webauthn/authenticator/:authenticatorId': {
885
- DELETE: {
886
- command: 'removeVirtualAuthenticator',
887
- },
888
- },
889
-
890
- '/session/:sessionId/webauthn/authenticator/:authenticatorId/credential': {
891
- POST: {
892
- command: 'addAuthCredential',
893
- payloadParams: {
894
- required: ['credentialId', 'isResidentCredential', 'rpId', 'privateKey'],
895
- optional: ['userHandle', 'signCount'],
896
- },
897
- },
898
- },
899
-
900
- '/session/:sessionId/webauthn/authenticator/:authenticatorId/credentials': {
901
- GET: {command: 'getAuthCredential'},
902
- DELETE: {command: 'removeAllAuthCredentials'},
903
- },
904
-
905
- '/session/:sessionId/webauthn/authenticator/:authenticatorId/credentials/:credentialId': {
906
- DELETE: {command: 'removeAuthCredential'},
925
+ // #endregion
926
+ // #region JSONWP
927
+ '/session/:sessionId/log': {
928
+ POST: {command: 'getLog', payloadParams: {required: ['type']}, deprecated: true},
907
929
  },
908
-
909
- '/session/:sessionId/webauthn/authenticator/:authenticatorId/uv': {
910
- POST: {
911
- command: 'setUserAuthVerified',
912
- payloadParams: {
913
- required: ['isUserVerified'],
914
- },
915
- },
930
+ '/session/:sessionId/log/types': {
931
+ GET: {command: 'getLogTypes', deprecated: true},
916
932
  },
917
-
918
- //endregion
933
+ // #endregion
919
934
  });
920
935
 
921
936
  // driver command names
@@ -963,4 +978,4 @@ export function routeToCommandName(endpoint, method, basePath = DEFAULT_BASE_PAT
963
978
  }
964
979
 
965
980
  // driver commands that do not require a session to already exist
966
- export const NO_SESSION_ID_COMMANDS = ['createSession', 'getStatus', 'getSessions'];
981
+ export const NO_SESSION_ID_COMMANDS = ['createSession', 'getStatus', 'getSessions', 'getAppiumSessions'];