@appium/types 0.7.0 → 0.9.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.
@@ -1,44 +1,153 @@
1
1
  /// <reference types="node" />
2
2
  import type { EventEmitter } from 'events';
3
3
  import { Element, ActionSequence } from './action';
4
- import { HTTPMethod, AppiumServer, UpdateServerCallback, Class, MethodMap, AppiumLogger, StringRecord, ConstraintsToCaps, BaseDriverCapConstraints, W3CCapabilities, Capabilities } from '.';
4
+ import { HTTPMethod, AppiumServer, UpdateServerCallback, Class, MethodMap, AppiumLogger, StringRecord, ConstraintsToCaps, BaseDriverCapConstraints, W3CCapabilities, Capabilities, ExecuteMethodMap } from '.';
5
5
  import { ServerArgs } from './config';
6
- import { AsyncReturnType, ConditionalPick } from 'type-fest';
6
+ import { AsyncReturnType } from 'type-fest';
7
7
  export interface ITimeoutCommands {
8
+ /**
9
+ * Set the various timeouts associated with a session
10
+ * @see {@link https://w3c.github.io/webdriver/#set-timeouts}
11
+ *
12
+ * @param type - used only for the old (JSONWP) command, the type of the timeout
13
+ * @param ms - used only for the old (JSONWP) command, the ms for the timeout
14
+ * @param script - the number in ms for the script timeout, used for the W3C command
15
+ * @param pageLoad - the number in ms for the pageLoad timeout, used for the W3C command
16
+ * @param implicit - the number in ms for the implicit wait timeout, used for the W3C command
17
+ */
8
18
  timeouts(type: string, ms: number | string, script?: number, pageLoad?: number, implicit?: number | string): Promise<void>;
19
+ /**
20
+ * Set the new command timeout
21
+ *
22
+ * @param ms - the timeout in ms
23
+ */
9
24
  setNewCommandTimeout(ms: number): void;
25
+ /**
26
+ * Set the implicit wait timeout
27
+ *
28
+ * @param ms - the timeout in ms
29
+ *
30
+ * @deprecated Use `timeouts` instead
31
+ */
10
32
  implicitWait(ms: number | string): Promise<void>;
33
+ /**
34
+ * A helper method (not a command) used to set the implicit wait value
35
+ *
36
+ * @param ms - the implicit wait in ms
37
+ */
11
38
  setImplicitWait(ms: number): void;
39
+ /**
40
+ * Periodically retry an async function up until the currently set implicit wait timeout
41
+ *
42
+ * @param condition - the behaviour to retry until it returns truthy
43
+ *
44
+ * @returns The return value of the condition
45
+ */
12
46
  implicitWaitForCondition(condition: () => Promise<any>): Promise<unknown>;
47
+ /**
48
+ * Get the current timeouts
49
+ * @see {@link https://w3c.github.io/webdriver/#get-timeouts}
50
+ *
51
+ * @returns A map of timeout names to ms values
52
+ */
13
53
  getTimeouts(): Promise<Record<string, number>>;
54
+ /**
55
+ * Set the implicit wait value that was sent in via the W3C protocol
56
+ *
57
+ * @param ms - the timeout in ms
58
+ */
14
59
  implicitWaitW3C(ms: number): Promise<void>;
60
+ /**
61
+ * Set the implicit wait value that was sent in via the JSONWP
62
+ *
63
+ * @param ms - the timeout in ms
64
+ * @deprecated
65
+ */
15
66
  implicitWaitMJSONWP(ms: number): Promise<void>;
67
+ /**
68
+ * Set the page load timeout value that was sent in via the W3C protocol
69
+ *
70
+ * @param ms - the timeout in ms
71
+ */
16
72
  pageLoadTimeoutW3C(ms: number): Promise<void>;
73
+ /**
74
+ * Set the page load timeout value that was sent in via the JSONWP
75
+ *
76
+ * @param ms - the timeout in ms
77
+ * @deprecated
78
+ */
17
79
  pageLoadTimeoutMJSONWP(ms: number): Promise<void>;
80
+ /**
81
+ * Set the script timeout value that was sent in via the W3C protocol
82
+ *
83
+ * @param ms - the timeout in ms
84
+ */
18
85
  scriptTimeoutW3C(ms: number): Promise<void>;
86
+ /**
87
+ * Set the script timeout value that was sent in via the JSONWP
88
+ *
89
+ * @param ms - the timeout in ms
90
+ * @deprecated
91
+ */
19
92
  scriptTimeoutMJSONWP(ms: number): Promise<void>;
93
+ /**
94
+ * Set Appium's new command timeout
95
+ *
96
+ * @param ms - the timeout in ms
97
+ */
20
98
  newCommandTimeout(ms: number): Promise<void>;
99
+ /**
100
+ * Get a timeout value from a number or a string
101
+ *
102
+ * @param ms - the timeout value as a number or a string
103
+ *
104
+ * @returns The timeout as a number in ms
105
+ */
21
106
  parseTimeoutArgument(ms: number | string): number;
22
107
  }
23
108
  export interface IEventCommands {
109
+ /**
110
+ * Add a custom-named event to the Appium event log
111
+ *
112
+ * @param vendor - the name of the vendor or tool the event belongs to, to namespace the event
113
+ * @param event - the name of the event itself
114
+ */
24
115
  logCustomEvent(vendor: string, event: string): Promise<void>;
116
+ /**
117
+ * Get a list of events that have occurred in the current session
118
+ *
119
+ * @param type - filter the returned events by including one or more types
120
+ *
121
+ * @returns The event history for the session
122
+ */
25
123
  getLogEvents(type?: string | string[]): Promise<EventHistory | Record<string, number>>;
26
124
  }
27
125
  export interface ISessionCommands {
126
+ /**
127
+ * Get data for all sessions running on an Appium server
128
+ *
129
+ * @returns A list of session data objects
130
+ */
28
131
  getSessions(): Promise<MultiSessionData[]>;
132
+ /**
133
+ * Get the data for the current session
134
+ *
135
+ * @returns A session data object
136
+ */
29
137
  getSession(): Promise<SingularSessionData>;
30
138
  }
31
139
  export interface IExecuteCommands {
140
+ /**
141
+ * Call an `Execute Method` by its name with the given arguments. This method will check that the
142
+ * driver has registered the method matching the name, and send it the arguments.
143
+ *
144
+ * @param script - the name of the Execute Method
145
+ * @param args - a singleton array containing an arguments object
146
+ *
147
+ * @returns The result of calling the Execute Method
148
+ */
32
149
  executeMethod(script: string, args: [StringRecord] | []): Promise<any>;
33
150
  }
34
- export interface ExecuteMethodDef<D> {
35
- command: keyof ConditionalPick<Required<D>, DriverCommand>;
36
- params?: {
37
- required?: ReadonlyArray<string>;
38
- optional?: ReadonlyArray<string>;
39
- };
40
- }
41
- export declare type ExecuteMethodMap<D> = Readonly<Record<string, Readonly<ExecuteMethodDef<D>>>>;
42
151
  export interface MultiSessionData<C extends Constraints = BaseDriverCapConstraints, Extra extends StringRecord | void = void> {
43
152
  id: string;
44
153
  capabilities: Capabilities<C, Extra>;
@@ -48,12 +157,101 @@ export declare type SingularSessionData<C extends Constraints = BaseDriverCapCon
48
157
  error?: string;
49
158
  };
50
159
  export interface IFindCommands<Ctx = any> {
160
+ /**
161
+ * Find a UI element given a locator strategy and a selector, erroring if it can't be found
162
+ * @see {@link https://w3c.github.io/webdriver/#find-element}
163
+ *
164
+ * @param strategy - the locator strategy
165
+ * @param selector - the selector to combine with the strategy to find the specific element
166
+ *
167
+ * @returns The element object encoding the element id which can be used in element-related
168
+ * commands
169
+ */
51
170
  findElement(strategy: string, selector: string): Promise<Element>;
171
+ /**
172
+ * Find a a list of all UI elements matching a given a locator strategy and a selector
173
+ * @see {@link https://w3c.github.io/webdriver/#find-elements}
174
+ *
175
+ * @param strategy - the locator strategy
176
+ * @param selector - the selector to combine with the strategy to find the specific elements
177
+ *
178
+ * @returns A possibly-empty list of element objects
179
+ */
52
180
  findElements(strategy: string, selector: string): Promise<Element[]>;
181
+ /**
182
+ * Find a UI element given a locator strategy and a selector, erroring if it can't be found. Only
183
+ * look for elements among the set of descendants of a given element
184
+ * @see {@link https://w3c.github.io/webdriver/#find-element-from-element}
185
+ *
186
+ * @param strategy - the locator strategy
187
+ * @param selector - the selector to combine with the strategy to find the specific element
188
+ * @param elementId - the id of the element to use as the search basis
189
+ *
190
+ * @returns The element object encoding the element id which can be used in element-related
191
+ * commands
192
+ */
53
193
  findElementFromElement(strategy: string, selector: string, elementId: string): Promise<Element>;
194
+ /**
195
+ * Find a a list of all UI elements matching a given a locator strategy and a selector. Only
196
+ * look for elements among the set of descendants of a given element
197
+ * @see {@link https://w3c.github.io/webdriver/#find-elements-from-element}
198
+ *
199
+ * @param strategy - the locator strategy
200
+ * @param selector - the selector to combine with the strategy to find the specific elements
201
+ * @param elementId - the id of the element to use as the search basis
202
+ *
203
+ * @returns A possibly-empty list of element objects
204
+ */
54
205
  findElementsFromElement(strategy: string, selector: string, elementId: string): Promise<Element[]>;
206
+ /**
207
+ * Find an element from a shadow root
208
+ * @see {@link https://w3c.github.io/webdriver/#find-element-from-shadow-root}
209
+ * @param strategy - the locator strategy
210
+ * @param selector - the selector to combine with the strategy to find the specific elements
211
+ * @param shadowId - the id of the element to use as the search basis
212
+ *
213
+ * @returns The element inside the shadow root matching the selector
214
+ */
215
+ findElementFromShadowRoot?(strategy: string, selector: string, shadowId: string): Promise<Element>;
216
+ /**
217
+ * Find elements from a shadow root
218
+ * @see {@link https://w3c.github.io/webdriver/#find-element-from-shadow-root}
219
+ * @param strategy - the locator strategy
220
+ * @param selector - the selector to combine with the strategy to find the specific elements
221
+ * @param shadowId - the id of the element to use as the search basis
222
+ *
223
+ * @returns A possibly empty list of elements inside the shadow root matching the selector
224
+ */
225
+ findElementsFromShadowRoot?(strategy: string, selector: string, shadowId: string): Promise<Element[]>;
226
+ /**
227
+ * A helper method that returns one or more UI elements based on the search criteria
228
+ *
229
+ * @param strategy - the locator strategy
230
+ * @param selector - the selector
231
+ * @param mult - whether or not we want to find multiple elements
232
+ * @param context - the element to use as the search context basis if desiredCapabilities
233
+ *
234
+ * @returns A single element or list of elements
235
+ */
55
236
  findElOrEls<Mult extends boolean>(strategy: string, selector: string, mult: Mult, context?: Ctx): Promise<Mult extends true ? Element[] : Element>;
237
+ /**
238
+ * This is a wrapper for {@linkcode IFindCommands.findElOrEls} that validates locator strategies
239
+ * and implements the `appium:printPageSourceOnFindFailure` capability
240
+ *
241
+ * @param strategy - the locator strategy
242
+ * @param selector - the selector
243
+ * @param mult - whether or not we want to find multiple elements
244
+ * @param context - the element to use as the search context basis if desiredCapabilities
245
+ *
246
+ * @returns A single element or list of elements
247
+ */
56
248
  findElOrElsWithProcessing<Mult extends boolean>(strategy: string, selector: string, mult: Mult, context?: Ctx): Promise<Mult extends true ? Element[] : Element>;
249
+ /**
250
+ * Get the current page/app source as HTML/XML
251
+ * @see {@link https://w3c.github.io/webdriver/#get-page-source}
252
+ *
253
+ * @returns The UI hierarchy in a platform-appropriate format (e.g., HTML for a web page)
254
+ */
57
255
  getPageSource(): Promise<string>;
58
256
  }
59
257
  export interface ILogCommands<C extends Constraints> {
@@ -96,11 +294,46 @@ export interface LogDef<C extends Constraints, T = unknown> {
96
294
  getter: (driver: Driver<C>) => Promise<T[]>;
97
295
  }
98
296
  export interface ISettingsCommands {
297
+ /**
298
+ * Update the session's settings dictionary with a new settings object
299
+ *
300
+ * @param settings - A key-value map of setting names to values. Settings not named in the map
301
+ * will not have their value adjusted.
302
+ */
99
303
  updateSettings: (settings: StringRecord) => Promise<void>;
304
+ /**
305
+ * Get the current settings for the session
306
+ *
307
+ * @returns The settings object
308
+ */
100
309
  getSettings(): Promise<StringRecord>;
101
310
  }
102
311
  export interface SessionHandler<CreateResult, DeleteResult, C extends Constraints = BaseDriverCapConstraints, Extra extends StringRecord | void = void> {
103
- createSession(w3cCaps1: W3CCapabilities<C, Extra>, w3cCaps2?: W3CCapabilities<C, Extra>, w3cCaps?: W3CCapabilities<C, Extra>, driverData?: DriverData[]): Promise<CreateResult>;
312
+ /**
313
+ * Start a new automation session
314
+ * @see {@link https://w3c.github.io/webdriver/#new-session}
315
+ *
316
+ * @remarks
317
+ * The shape of this method is strange because it used to support both JSONWP and W3C
318
+ * capabilities. This will likely change in the future to simplify.
319
+ *
320
+ * @param w3cCaps1 - the new session capabilities
321
+ * @param w3cCaps2 - another place the new session capabilities could be sent (typically left undefined)
322
+ * @param w3cCaps - another place the new session capabilities could be sent (typically left undefined)
323
+ * @param driverData - a list of DriverData objects representing other sessions running for this
324
+ * driver on the same Appium server. This information can be used to help ensure no conflict of
325
+ * resources
326
+ *
327
+ * @returns The capabilities object representing the created session
328
+ */
329
+ createSession(w3cCaps1: W3CCapabilities<C, Extra>, w3cCaps2?: W3CCapabilities<C, Extra>, w3cCaps3?: W3CCapabilities<C, Extra>, driverData?: DriverData[]): Promise<CreateResult>;
330
+ /**
331
+ * Stop an automation session
332
+ * @see {@link https://w3c.github.io/webdriver/#delete-session}
333
+ *
334
+ * @param sessionId - the id of the session that is to be deleted
335
+ * @param driverData - the driver data for other currently-running sessions
336
+ */
104
337
  deleteSession(sessionId?: string, driverData?: DriverData[]): Promise<DeleteResult>;
105
338
  }
106
339
  /**
@@ -167,7 +400,7 @@ export interface Cookie {
167
400
  expiry?: number;
168
401
  sameSite?: 'Lax' | 'Strict';
169
402
  }
170
- export interface ScreenRecordOptions {
403
+ export interface StartScreenRecordOptions {
171
404
  remotePath?: string;
172
405
  username?: string;
173
406
  password?: string;
@@ -182,6 +415,15 @@ export interface ScreenRecordOptions {
182
415
  videoSize?: string;
183
416
  bugReport?: string;
184
417
  }
418
+ export interface StopScreenRecordOptions {
419
+ remotePath?: string;
420
+ user?: string;
421
+ pass?: string;
422
+ method?: string;
423
+ headers?: Record<string, string>;
424
+ fileFieldName?: string;
425
+ formFields: Record<string, string> | Array<[string, string]>;
426
+ }
185
427
  export declare type Size = Pick<Rect, 'width' | 'height'>;
186
428
  export declare type Position = Pick<Rect, 'x' | 'y'>;
187
429
  export interface Location {
@@ -265,16 +507,58 @@ export interface Core<C extends Constraints = BaseDriverCapConstraints> {
265
507
  * `Ctx` would be the type of the element context (e.g., string, dictionary of some sort, etc.)
266
508
  */
267
509
  export interface Driver<C extends Constraints = BaseDriverCapConstraints, CArgs extends StringRecord = StringRecord, Ctx = any> extends ISessionCommands, ILogCommands<C>, IFindCommands<Ctx>, ISettingsCommands, ITimeoutCommands, IEventCommands, IExecuteCommands, SessionHandler<[string, any], void, C>, Core {
510
+ /**
511
+ * The set of command line arguments set for this driver
512
+ */
268
513
  cliArgs: CArgs;
514
+ /**
515
+ * Execute a driver (WebDriver-protocol) command by its name as defined in the routes file
516
+ *
517
+ * @param cmd - the name of the command
518
+ * @param args - arguments to pass to the command
519
+ *
520
+ * @returns The result of running the command
521
+ */
269
522
  executeCommand(cmd: string, ...args: any[]): Promise<any>;
523
+ /**
524
+ * Signify to any owning processes that this driver encountered an error which should cause the
525
+ * session to terminate immediately (for example an upstream service failed)
526
+ *
527
+ * @param err - the Error object which is causing the shutdown
528
+ */
270
529
  startUnexpectedShutdown(err?: Error): Promise<void>;
530
+ /**
531
+ * Start the timer for the New Command Timeout, which when it runs out, will stop the current
532
+ * session
533
+ */
271
534
  startNewCommandTimeout(): Promise<void>;
535
+ /**
536
+ * Reset the current session (run the delete session and create session subroutines)
537
+ *
538
+ * @deprecated Use explicit session management commands instead
539
+ */
272
540
  reset(): Promise<void>;
541
+ /**
542
+ * The processed capabilities used to start the session represented by the current driver instance
543
+ */
273
544
  caps?: Capabilities<C>;
545
+ /**
546
+ * The original capabilities used to start the session represented by the current driver instance
547
+ */
274
548
  originalCaps?: W3CCapabilities<C>;
549
+ /**
550
+ * The constraints object used to validate capabilities
551
+ */
275
552
  desiredCapConstraints: C;
276
- validateDesiredCaps(caps: Capabilities<C>): boolean;
277
- logExtraCaps(caps: Capabilities<C>): void;
553
+ /**
554
+ * A helper function used to assign server information to the driver instance so the driver knows
555
+ * where the server is Running
556
+ *
557
+ * @param server - the server object
558
+ * @param host - the server hostname
559
+ * @param port - the server port
560
+ * @param path - the server base url
561
+ */
278
562
  assignServer?(server: AppiumServer, host: string, port: number, path: string): void;
279
563
  }
280
564
  /**
@@ -286,155 +570,1225 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
286
570
  serverHost?: string;
287
571
  serverPort?: number;
288
572
  serverPath?: string;
573
+ /**
574
+ * Navigate to a given url
575
+ * @see {@link https://w3c.github.io/webdriver/#navigate-to}
576
+ *
577
+ * @param url - the url
578
+ */
289
579
  setUrl?(url: string): Promise<void>;
580
+ /**
581
+ * Get the current url
582
+ * @see {@link https://w3c.github.io/webdriver/#get-current-url}
583
+ *
584
+ * @returns The url
585
+ */
290
586
  getUrl?(): Promise<string>;
587
+ /**
588
+ * Navigate back in the page history
589
+ * @see {@link https://w3c.github.io/webdriver/#back}
590
+ */
291
591
  back?(): Promise<void>;
592
+ /**
593
+ * Navigate forward in the page history
594
+ * @see {@link https://w3c.github.io/webdriver/#forward}
595
+ */
292
596
  forward?(): Promise<void>;
597
+ /**
598
+ * Refresh the page
599
+ * @see {@link https://w3c.github.io/webdriver/#refresh}
600
+ */
293
601
  refresh?(): Promise<void>;
602
+ /**
603
+ * Get the current page title
604
+ * @see {@link https://w3c.github.io/webdriver/#get-title}
605
+ *
606
+ * @returns The title
607
+ *
608
+ * @example
609
+ * ```js
610
+ * await driver.getTitle()
611
+ * ```
612
+ * ```py
613
+ * driver.title
614
+ * ```
615
+ * ```java
616
+ * driver.getTitle();
617
+ * ```
618
+ */
294
619
  title?(): Promise<string>;
620
+ /**
621
+ * Get the handle (id) associated with the current browser window
622
+ * @see {@link https://w3c.github.io/webdriver/#get-window-handle}
623
+ *
624
+ * @returns The handle string
625
+ */
295
626
  getWindowHandle?(): Promise<string>;
627
+ /**
628
+ * Close the current browsing context (window)
629
+ * @see {@link https://w3c.github.io/webdriver/#close-window}
630
+ *
631
+ * @returns An array of window handles representing currently-open windows
632
+ */
296
633
  closeWindow?(): Promise<string[]>;
634
+ /**
635
+ * Switch to a specified window
636
+ * @see {@link https://w3c.github.io/webdriver/#switch-to-window}
637
+ *
638
+ * @param handle - the window handle of the window to make active
639
+ */
297
640
  setWindow?(handle: string): Promise<void>;
641
+ /**
642
+ * Get a set of handles representing open browser windows
643
+ * @see {@link https://w3c.github.io/webdriver/#get-window-handles}
644
+ *
645
+ * @returns An array of window handles representing currently-open windows
646
+ */
298
647
  getWindowHandles?(): Promise<string[]>;
648
+ /**
649
+ * Create a new browser window
650
+ * @see {@link https://w3c.github.io/webdriver/#new-window}
651
+ *
652
+ * @param type - a hint to the driver whether to create a "tab" or "window"
653
+ *
654
+ * @returns An object containing the handle of the newly created window and its type
655
+ */
656
+ createNewWindow?(type?: NewWindowType): Promise<NewWindow>;
657
+ /**
658
+ * Switch the current browsing context to a frame
659
+ * @see {@link https://w3c.github.io/webdriver/#switch-to-frame}
660
+ *
661
+ * @param id - the frame id, index, or `null` (indicating the top-level context)
662
+ */
299
663
  setFrame?(id: null | number | string): Promise<void>;
664
+ /**
665
+ * Set the current browsing context to the parent of the current context
666
+ * @see {@link https://w3c.github.io/webdriver/#switch-to-parent-frame}
667
+ */
668
+ switchToParentFrame?(): Promise<void>;
669
+ /**
670
+ * Get the size and position of the current window
671
+ * @see {@link https://w3c.github.io/webdriver/#get-window-rect}
672
+ *
673
+ * @returns A `Rect` JSON object with x, y, width, and height properties
674
+ */
300
675
  getWindowRect?(): Promise<Rect>;
676
+ /**
677
+ * Set the current window's size and position
678
+ * @see {@link https://w3c.github.io/webdriver/#set-window-rect}
679
+ *
680
+ * @param x - the screen coordinate for the new left edge of the window
681
+ * @param y - the screen coordinate for the new top edge of the window
682
+ * @param width - the width in pixels to resize the window to
683
+ * @param height - the height in pixels to resize the window to
684
+ *
685
+ * @returns The actual `Rect` of the window after running the command
686
+ */
301
687
  setWindowRect?(x: number, y: number, width: number, height: number): Promise<Rect>;
688
+ /**
689
+ * Run the window-manager specific 'maximize' operation on the current window
690
+ * @see {@link https://w3c.github.io/webdriver/#maximize-window}
691
+ *
692
+ * @returns The actual `Rect` of the window after running the command
693
+ */
302
694
  maximizeWindow?(): Promise<Rect>;
695
+ /**
696
+ * Run the window-manager specific 'minimize' operation on the current window
697
+ * @see {@link https://w3c.github.io/webdriver/#minimize-window}
698
+ *
699
+ * @returns The actual `Rect` of the window after running the command
700
+ */
303
701
  minimizeWindow?(): Promise<Rect>;
702
+ /**
703
+ * Put the current window into full screen mode
704
+ * @see {@link https://w3c.github.io/webdriver/#fullscreen-window}
705
+ *
706
+ * @returns The actual `Rect` of the window after running the command
707
+ */
304
708
  fullScreenWindow?(): Promise<Rect>;
305
- createNewWindow?(type?: NewWindowType): Promise<NewWindow>;
709
+ /**
710
+ * Get the active element
711
+ * @see {@link https://w3c.github.io/webdriver/#get-active-element}
712
+ *
713
+ * @returns The JSON object encapsulating the active element reference
714
+ */
306
715
  active?(): Promise<Element>;
716
+ /**
717
+ * Get the shadow root of an element
718
+ * @see {@link https://w3c.github.io/webdriver/#get-element-shadow-root}
719
+ *
720
+ * @param elementId - the id of the element to retrieve the shadow root for
721
+ *
722
+ * @returns The shadow root for an element, as an element
723
+ */
724
+ elementShadowRoot?(elementId: string): Promise<Element>;
725
+ /**
726
+ * Determine if the reference element is selected or not
727
+ * @see {@link https://w3c.github.io/webdriver/#is-element-selected}
728
+ *
729
+ * @param elementId - the id of the element
730
+ *
731
+ * @returns True if the element is selected, False otherwise
732
+ */
307
733
  elementSelected?(elementId: string): Promise<boolean>;
734
+ /**
735
+ * Retrieve the value of an element's attribute
736
+ * @see {@link https://w3c.github.io/webdriver/#get-element-attribute}
737
+ *
738
+ * @param name - the attribute name
739
+ * @param elementId - the id of the element
740
+ *
741
+ * @returns The attribute value
742
+ */
308
743
  getAttribute?(name: string, elementId: string): Promise<string | null>;
744
+ /**
745
+ * Retrieve the value of a named property of an element's JS object
746
+ * @see {@link https://w3c.github.io/webdriver/#get-element-property}
747
+ *
748
+ * @param name - the object property name
749
+ * @param elementId - the id of the element
750
+ *
751
+ * @returns The property value
752
+ */
309
753
  getProperty?(name: string, elementId: string): Promise<string | null>;
754
+ /**
755
+ * Retrieve the value of a CSS property of an element
756
+ * @see {@link https://w3c.github.io/webdriver/#get-element-css-value}
757
+ *
758
+ * @param name - the CSS property name
759
+ * @param elementId - the id of the element
760
+ *
761
+ * @returns The property value
762
+ */
310
763
  getCssProperty?(name: string, elementId: string): Promise<string>;
764
+ /**
765
+ * Get the text of an element as rendered
766
+ * @see {@link https://w3c.github.io/webdriver/#get-element-text}
767
+ *
768
+ * @param elementId - the id of the element
769
+ *
770
+ * @returns The text rendered for the element
771
+ */
311
772
  getText?(elementId: string): Promise<string>;
773
+ /**
774
+ * Get the tag name of an element
775
+ * @see {@link https://w3c.github.io/webdriver/#get-element-tag-name}
776
+ *
777
+ * @param elementId - the id of the element
778
+ *
779
+ * @returns The tag name
780
+ */
312
781
  getName?(elementId: string): Promise<string>;
782
+ /**
783
+ * Get the dimensions and position of an element
784
+ * @see {@link https://w3c.github.io/webdriver/#get-element-rect}
785
+ *
786
+ * @param elementId - the id of the element
787
+ *
788
+ * @returns The Rect object containing x, y, width, and height properties
789
+ */
313
790
  getElementRect?(elementId: string): Promise<Rect>;
791
+ /**
792
+ * Determine whether an element is enabled
793
+ * @see {@link https://w3c.github.io/webdriver/#is-element-enabled}
794
+ *
795
+ * @param elementId - the id of the element
796
+ *
797
+ * @returns True if the element is enabled, False otherwise
798
+ */
314
799
  elementEnabled?(elementId: string): Promise<boolean>;
800
+ /**
801
+ * Get the WAI-ARIA role of an element
802
+ * @see {@link https://w3c.github.io/webdriver/#get-computed-role}
803
+ *
804
+ * @param elementId - the id of the element
805
+ *
806
+ * @returns The role
807
+ */
808
+ getComputedRole?(elementId: string): Promise<string | null>;
809
+ /**
810
+ * Get the accessible name/label of an element
811
+ * @see {@link https://w3c.github.io/webdriver/#get-computed-label}
812
+ *
813
+ * @param elementId - the id of the element
814
+ *
815
+ * @returns The accessible name
816
+ */
817
+ getComputedLabel?(elementId: string): Promise<string | null>;
818
+ /**
819
+ * Determine whether an element is displayed
820
+ * @see {@link https://w3c.github.io/webdriver/#element-displayedness}
821
+ *
822
+ * @param elementId - the id of the element
823
+ *
824
+ * @returns True if any part of the element is rendered within the viewport, False otherwise
825
+ */
315
826
  elementDisplayed?(elementId: string): Promise<boolean>;
827
+ /**
828
+ * Click/tap an element
829
+ * @see {@link https://w3c.github.io/webdriver/#element-click}
830
+ *
831
+ * @param elementId - the id of the element
832
+ */
316
833
  click?(elementId: string): Promise<void>;
834
+ /**
835
+ * Clear the text/value of an editable element
836
+ * @see {@link https://w3c.github.io/webdriver/#element-clear}
837
+ *
838
+ * @param elementId - the id of the element
839
+ */
317
840
  clear?(elementId: string): Promise<void>;
841
+ /**
842
+ * Send keystrokes to an element (or otherwise set its value)
843
+ * @see {@link https://w3c.github.io/webdriver/#element-send-keys}
844
+ *
845
+ * @param text - the text to send to the element
846
+ * @param elementId - the id of the element
847
+ */
318
848
  setValue?(text: string, elementId: string): Promise<void>;
849
+ /**
850
+ * Execute JavaScript (or some other kind of script) in the browser/app context
851
+ * @see {@link https://w3c.github.io/webdriver/#execute-script}
852
+ *
853
+ * @param script - the string to be evaluated as the script, which will be made the body of an
854
+ * anonymous function in the case of JS
855
+ * @param args - the list of arguments to be applied to the script as a function
856
+ *
857
+ * @returns The return value of the script execution
858
+ */
319
859
  execute?(script: string, args: unknown[]): Promise<unknown>;
860
+ /**
861
+ * Execute JavaScript (or some other kind of script) in the browser/app context, asynchronously
862
+ * @see {@link https://w3c.github.io/webdriver/#execute-async-script}
863
+ *
864
+ * @param script - the string to be evaluated as the script, which will be made the body of an
865
+ * anonymous function in the case of JS
866
+ * @param args - the list of arguments to be applied to the script as a function
867
+ *
868
+ * @returns The promise resolution of the return value of the script execution (or an error
869
+ * object if the promise is rejected)
870
+ */
320
871
  executeAsync?(script: string, args: unknown[]): Promise<unknown>;
872
+ /**
873
+ * Get all cookies known to the browsing context
874
+ * @see {@link https://w3c.github.io/webdriver/#get-all-cookies}
875
+ *
876
+ * @returns A list of serialized cookies
877
+ */
321
878
  getCookies?(): Promise<Cookie[]>;
879
+ /**
880
+ * Get a cookie by name
881
+ * @see {@link https://w3c.github.io/webdriver/#get-named-cookie}
882
+ *
883
+ * @param name - the name of the cookie
884
+ *
885
+ * @returns A serialized cookie
886
+ */
322
887
  getCookie?(name: string): Promise<Cookie>;
888
+ /**
889
+ * Add a cookie to the browsing context
890
+ * @see {@link https://w3c.github.io/webdriver/#add-cookie}
891
+ *
892
+ * @param cookie - the cookie data including properties like name, value, path, domain,
893
+ * secure, httpOnly, expiry, and samesite
894
+ */
323
895
  setCookie?(cookie: Cookie): Promise<void>;
896
+ /**
897
+ * Delete a named cookie
898
+ * @see {@link https://w3c.github.io/webdriver/#delete-cookie}
899
+ *
900
+ * @param name - the name of the cookie to delete
901
+ */
324
902
  deleteCookie?(name: string): Promise<void>;
903
+ /**
904
+ * Delete all cookies
905
+ * @see {@link https://w3c.github.io/webdriver/#delete-all-cookies}
906
+ */
325
907
  deleteCookies?(): Promise<void>;
908
+ /**
909
+ * Perform touch or keyboard actions
910
+ * @see {@link https://w3c.github.io/webdriver/#perform-actions}
911
+ *
912
+ * @param actions - the action sequence
913
+ */
326
914
  performActions?(actions: ActionSequence[]): Promise<void>;
915
+ /**
916
+ * Release all keys or buttons that are currently pressed
917
+ * @see {@link https://w3c.github.io/webdriver/#release-actions}
918
+ */
327
919
  releaseActions?(): Promise<void>;
920
+ /**
921
+ * Dismiss a simple dialog/alert
922
+ * @see {@link https://w3c.github.io/webdriver/#dismiss-alert}
923
+ */
328
924
  postDismissAlert?(): Promise<void>;
925
+ /**
926
+ * Accept a simple dialog/alert
927
+ * @see {@link https://w3c.github.io/webdriver/#accept-alert}
928
+ */
329
929
  postAcceptAlert?(): Promise<void>;
930
+ /**
931
+ * Get the text of the displayed alert
932
+ * @see {@link https://w3c.github.io/webdriver/#get-alert-text}
933
+ *
934
+ * @returns The text of the alert
935
+ */
330
936
  getAlertText?(): Promise<string | null>;
937
+ /**
938
+ * Set the text field of an alert prompt
939
+ * @see {@link https://w3c.github.io/webdriver/#send-alert-text}
940
+ *
941
+ * @param text - the text to send to the prompt
942
+ */
331
943
  setAlertText?(text: string): Promise<void>;
944
+ /**
945
+ * Get a screenshot of the current document as rendered
946
+ * @see {@link https://w3c.github.io/webdriver/#take-screenshot}
947
+ *
948
+ * @returns A base64-encoded string representing the PNG image data
949
+ */
332
950
  getScreenshot?(): Promise<string>;
951
+ /**
952
+ * Get an image of a single element as rendered on screen
953
+ * @see {@link https://w3c.github.io/webdriver/#take-element-screenshot}
954
+ *
955
+ * @param elementId - the id of the element
956
+ *
957
+ * @returns A base64-encoded string representing the PNG image data for the element rect
958
+ */
333
959
  getElementScreenshot?(elementId: string): Promise<string>;
334
- getComputedRole?(elementId: string): Promise<string | null>;
335
- getComputedLabel?(elementId: string): Promise<string | null>;
960
+ /**
961
+ * Shake the device
962
+ *
963
+ * @deprecated
964
+ */
336
965
  mobileShake?(): Promise<void>;
966
+ /**
967
+ * Get the current time on the device under timeouts
968
+ *
969
+ * @param format - the date/time format you would like the response into
970
+ *
971
+ * @returns The formatted time
972
+ */
337
973
  getDeviceTime?(format?: string): Promise<string>;
974
+ /**
975
+ * Lock the device, and optionally unlock the device after a certain amount of time
976
+ *
977
+ * @param seconds - the number of seconds after which to unlock the device. Set to zero or leave
978
+ * empty to not unlock the device automatically
979
+ *
980
+ * @deprecated
981
+ */
338
982
  lock?(seconds?: number): Promise<void>;
983
+ /**
984
+ * Unlock the device
985
+ *
986
+ * @deprecated
987
+ */
339
988
  unlock?(): Promise<void>;
989
+ /**
990
+ * Determine whether the device is locked
991
+ *
992
+ * @returns True if the device is locked, false otherwise
993
+ *
994
+ * @deprecated
995
+ */
340
996
  isLocked?(): Promise<boolean>;
341
- startRecordingScreen?(options?: ScreenRecordOptions): Promise<void>;
342
- stopRecordingScreen?(options?: ScreenRecordOptions): Promise<string>;
997
+ /**
998
+ * Direct Appium to start recording the device screen
999
+ *
1000
+ * @param options - parameters for screen recording
1001
+ *
1002
+ * @deprecated
1003
+ */
1004
+ startRecordingScreen?(options?: StartScreenRecordOptions): Promise<void>;
1005
+ /**
1006
+ * Direct Appium to stop screen recording and return the video
1007
+ *
1008
+ * @param options - parameters for stopping like video Uploading
1009
+ *
1010
+ * @returns The base64-encoded video data
1011
+ *
1012
+ * @deprecated
1013
+ */
1014
+ stopRecordingScreen?(options?: StopScreenRecordOptions): Promise<string>;
1015
+ /**
1016
+ * List the performance data types supported by this driver, which can be used in a call to get
1017
+ * the performance data by type.
1018
+ *
1019
+ * @returns The list of types
1020
+ *
1021
+ * @deprecated
1022
+ */
343
1023
  getPerformanceDataTypes?(): Promise<string[]>;
1024
+ /**
1025
+ * Get the list of performance data associated with a given type
1026
+ *
1027
+ * @param packageName - the package name / id of the app to retrieve data for
1028
+ * @param dataType - the performance data type; one of those retrieved in a call to
1029
+ * getPerformanceDataTypes
1030
+ * @param dataReadTimeout - how long to wait for data before timing out
1031
+ *
1032
+ * @returns A list of performance data strings
1033
+ *
1034
+ * @deprecated
1035
+ */
344
1036
  getPerformanceData?(packageName: string, dataType: string, dataReadTimeout?: number): Promise<string[]>;
1037
+ /**
1038
+ * Press a device hardware key by its code for the default duration
1039
+ *
1040
+ * @param keycode - the keycode
1041
+ * @param metastate - the code denoting the simultaneous pressing of any meta keys (shift etc)
1042
+ * @param flags - the code denoting the combination of extra flags
1043
+ *
1044
+ * @deprecated
1045
+ */
345
1046
  pressKeyCode?(keycode: number, metastate?: number, flags?: number): Promise<void>;
1047
+ /**
1048
+ * Press a device hardware key by its code for a longer duration
1049
+ *
1050
+ * @param keycode - the keycode
1051
+ * @param metastate - the code denoting the simultaneous pressing of any meta keys (shift etc)
1052
+ * @param flags - the code denoting the combination of extra flags
1053
+ *
1054
+ * @deprecated
1055
+ */
346
1056
  longPressKeyCode?(keycode: number, metastate?: number, flags?: number): Promise<void>;
1057
+ /**
1058
+ * Apply a synthetic fingerprint to the fingerprint detector of the device
1059
+ *
1060
+ * @param fingerprintId - the numeric ID of the fingerprint to use
1061
+ *
1062
+ * @deprecated
1063
+ */
347
1064
  fingerprint?(fingerprintId: number): Promise<void>;
1065
+ /**
1066
+ * Simulate sending an SMS message from a certain phone number to the device
1067
+ *
1068
+ * @param phoneNumber - the number to pretend the message is from
1069
+ * @param message - the SMS text
1070
+ *
1071
+ * @deprecated
1072
+ */
348
1073
  sendSMS?(phoneNumber: string, message: string): Promise<void>;
1074
+ /**
1075
+ * Simulate triggering a phone call from a phone number and having the device take an action in
1076
+ * response
1077
+ *
1078
+ * @param phoneNumber - the number to pretend the call is from
1079
+ * @param action - the action to take in response (accept, reject, etc...)
1080
+ *
1081
+ * @deprecated
1082
+ */
349
1083
  gsmCall?(phoneNumber: string, action: string): Promise<void>;
1084
+ /**
1085
+ * Simulate setting the GSM signal strength for a cell phone
1086
+ *
1087
+ * @param singalStrength - the strength in a driver-appropriate string
1088
+ *
1089
+ * @deprecated
1090
+ */
350
1091
  gsmSignal?(signalStrength: string): Promise<void>;
1092
+ /**
1093
+ * Do something with GSM voice (unclear; this should not be implemented anywhere)
1094
+ *
1095
+ * @param state - the state
1096
+ *
1097
+ * @deprecated
1098
+ */
351
1099
  gsmVoice?(state: string): Promise<void>;
1100
+ /**
1101
+ * Set the simulated power capacity of the device
1102
+ *
1103
+ * @param percent - how full the battery should become
1104
+ *
1105
+ * @deprecated
1106
+ */
352
1107
  powerCapacity?(percent: number): Promise<void>;
1108
+ /**
1109
+ * Set the AC-connected power state of the device
1110
+ *
1111
+ * @param state - whether the device is connected to power or not
1112
+ *
1113
+ * @deprecated
1114
+ */
353
1115
  powerAC?(state: string): Promise<void>;
1116
+ /**
1117
+ * Set the network speed of the device
1118
+ *
1119
+ * @param netspeed - the speed as a string, like '3G'
1120
+ *
1121
+ * @deprecated
1122
+ */
354
1123
  networkSpeed?(netspeed: string): Promise<void>;
1124
+ /**
1125
+ * Simulate a keyevent on the device
1126
+ *
1127
+ * @param keycode - the manufacturer defined keycode
1128
+ * @param metastate - the combination of meta startUnexpectedShutdown
1129
+ *
1130
+ * @deprecated
1131
+ */
355
1132
  keyevent?(keycode: string, metastate?: string): Promise<void>;
1133
+ /**
1134
+ * Construct a rotation gesture? Unclear what this command does and it does not appear to be used
1135
+ *
1136
+ * @param x - the x coordinate of the rotation center
1137
+ * @param y - the y coordinate of the rotation center
1138
+ * @param radius - the radius of the rotation circle
1139
+ * @param rotation - the rotation angle? idk
1140
+ * @param touchCount - how many fingers to rotate
1141
+ * @param elementId - if we're rotating around an element
1142
+ *
1143
+ * @deprecated Use setRotation instead
1144
+ */
356
1145
  mobileRotation?(x: number, y: number, radius: number, rotation: number, touchCount: number, duration: string, elementId?: string): Promise<void>;
1146
+ /**
1147
+ * Get the current activity name
1148
+ *
1149
+ * @returns The activity name
1150
+ *
1151
+ * @deprecated
1152
+ */
357
1153
  getCurrentActivity?(): Promise<string>;
1154
+ /**
1155
+ * Get the current active app package name/id
1156
+ *
1157
+ * @returns The package name
1158
+ *
1159
+ * @deprecated
1160
+ */
358
1161
  getCurrentPackage?(): Promise<string>;
1162
+ /**
1163
+ * Install an app on a device
1164
+ *
1165
+ * @param appPath - the absolute path to a local app or a URL of a downloadable app bundle
1166
+ * @param options - driver-specific install options
1167
+ */
359
1168
  installApp?(appPath: string, options?: unknown): Promise<void>;
1169
+ /**
1170
+ * Launch an app
1171
+ *
1172
+ * @param appId - the package or bundle ID of the application
1173
+ * @param options - driver-specific launch options
1174
+ */
360
1175
  activateApp?(appId: string, options?: unknown): Promise<void>;
1176
+ /**
1177
+ * Remove / uninstall an app
1178
+ *
1179
+ * @param appId - the package or bundle ID of the application
1180
+ * @param options - driver-specific launch options
1181
+ */
361
1182
  removeApp?(appId: string, options?: unknown): Promise<void>;
1183
+ /**
1184
+ * Quit / terminate / stop a running application
1185
+ *
1186
+ * @param appId - the package or bundle ID of the application
1187
+ * @param options - driver-specific launch options
1188
+ */
362
1189
  terminateApp?(appId: string, options?: unknown): Promise<void>;
1190
+ /**
1191
+ * Determine whether an app is installed
1192
+ *
1193
+ * @param appId - the package or bundle ID of the application
1194
+ */
363
1195
  isAppInstalled?(appId: string): Promise<boolean>;
364
- queryAppState?(appId: string): Promise<number>;
1196
+ /**
1197
+ * Get the running state of an app
1198
+ *
1199
+ * @param appId - the package or bundle ID of the application
1200
+ *
1201
+ * @returns A number representing the state. 0 means not installed, 1 means not running, 3 means
1202
+ * running in the background, and 4 means running in the foreground
1203
+ */
1204
+ queryAppState?(appId: string): Promise<0 | 1 | 3 | 4>;
1205
+ /**
1206
+ * Attempt to hide a virtual keyboard
1207
+ *
1208
+ * @param strategy - the driver-specific name of a hiding strategy to follow
1209
+ * @param key - the text of a key to use to hide the keyboard
1210
+ * @param keyCode - a key code to trigger to hide the keyboard
1211
+ * @param keyName - the name of a key to use to hide the keyboard
1212
+ */
365
1213
  hideKeyboard?(strategy?: string, key?: string, keyCode?: string, keyName?: string): Promise<void>;
1214
+ /**
1215
+ * Determine whether the keyboard is shown
1216
+ *
1217
+ * @returns Whether the keyboard is shown
1218
+ */
366
1219
  isKeyboardShown?(): Promise<boolean>;
1220
+ /**
1221
+ * Push data to a file at a remote path on the device
1222
+ *
1223
+ * @param path - the remote path on the device to create the file at
1224
+ * @param data - the base64-encoded data which will be decoded and written to `path`
1225
+ */
367
1226
  pushFile?(path: string, data: string): Promise<void>;
1227
+ /**
1228
+ * Retrieve the data from a file on the device at a given path
1229
+ *
1230
+ * @param path - the remote path on the device to pull file data from
1231
+ *
1232
+ * @returns The base64-encoded file data
1233
+ */
368
1234
  pullFile?(path: string): Promise<string>;
1235
+ /**
1236
+ * Retrieve the data from a folder on the device at a given path
1237
+ *
1238
+ * @param path - the remote path of a directory on the device
1239
+ *
1240
+ * @returns The base64-encoded zip file of the directory contents
1241
+ */
369
1242
  pullFolder?(path: string): Promise<string>;
1243
+ /**
1244
+ * Toggle airplane/flight mode for the device
1245
+ *
1246
+ * @deprecated
1247
+ */
370
1248
  toggleFlightMode?(): Promise<void>;
1249
+ /**
1250
+ * Toggle cell network data
1251
+ *
1252
+ * @deprecated
1253
+ */
371
1254
  toggleData?(): Promise<void>;
1255
+ /**
1256
+ * Toggle WiFi radio status
1257
+ *
1258
+ * @deprecated
1259
+ */
372
1260
  toggleWiFi?(): Promise<void>;
1261
+ /**
1262
+ * Toggle location services for the device
1263
+ *
1264
+ * @deprecated
1265
+ */
373
1266
  toggleLocationServices?(): Promise<void>;
1267
+ /**
1268
+ * Open the notifications shade/screen
1269
+ *
1270
+ * @deprecated
1271
+ */
374
1272
  openNotifications?(): Promise<void>;
1273
+ /**
1274
+ * Start an Android activity within an app
1275
+ *
1276
+ * @param appPackage - the app package id
1277
+ * @param appActivity - the activity name
1278
+ * @param appWaitPackage - the package id to wait for if different from the app package
1279
+ * @param appWaitActivity - the activity name to wait for being active if different from
1280
+ * appActivity
1281
+ * @param intentAction - the action for the intent to use to start the activity
1282
+ * @param intentCategory - the category for the intent
1283
+ * @param flags - the flags for the intent
1284
+ * @param optionalIntentArguments - additional arguments to be passed to launching the intent
1285
+ * @param dontStopAppOnReset - set to true to not stop the current app before launching the
1286
+ * activity
1287
+ *
1288
+ * @deprecated
1289
+ */
375
1290
  startActivity?(appPackage: string, appActivity: string, appWaitPackage?: string, appWaitActivity?: string, intentAction?: string, intentCategory?: string, intentFlags?: string, optionalIntentArguments?: string, dontStopAppOnReset?: boolean): Promise<void>;
1291
+ /**
1292
+ * Get information from the system bars of a device
1293
+ *
1294
+ * @returns An array of information objects of driver-specific shape
1295
+ *
1296
+ * @deprecated
1297
+ */
376
1298
  getSystemBars?(): Promise<unknown[]>;
1299
+ /**
1300
+ * Get the display's pixel density
1301
+ *
1302
+ * @returns The density
1303
+ *
1304
+ * @deprecated
1305
+ */
377
1306
  getDisplayDensity?(): Promise<number>;
1307
+ /**
1308
+ * Trigger a touch/fingerprint match or match failure
1309
+ *
1310
+ * @param match - whether the match should be a success or failure
1311
+ *
1312
+ * @deprecated
1313
+ */
378
1314
  touchId?(match: boolean): Promise<void>;
1315
+ /**
1316
+ * Toggle whether the device is enrolled in the touch ID program
1317
+ *
1318
+ * @param enabled - whether to enable or disable the touch ID program
1319
+ *
1320
+ * @deprecated
1321
+ */
379
1322
  toggleEnrollTouchId?(enabled: boolean): Promise<void>;
1323
+ /**
1324
+ * Start the session after it has been started.
1325
+ *
1326
+ * @deprecated Don't use this, it never made sense.
1327
+ */
380
1328
  launchApp?(): Promise<void>;
1329
+ /**
1330
+ * Stop the session without stopping the session
1331
+ *
1332
+ * @deprecated Don't use this, it never made sense.
1333
+ */
381
1334
  closeApp?(): Promise<void>;
1335
+ /**
1336
+ * Background (close) the app either permanently or for a certain amount of time
1337
+ *
1338
+ * @param seconds - the number of seconds to background the app for, or `null` for permanently
1339
+ *
1340
+ * @deprecated
1341
+ */
382
1342
  background?(seconds: null | number): Promise<void>;
1343
+ /**
1344
+ * End platform-specific code coverage tracing
1345
+ *
1346
+ * @param intent - the Android intent for the coverage activity
1347
+ * @param path - the path to place the results
1348
+ *
1349
+ * @deprecated
1350
+ */
383
1351
  endCoverage?(intent: string, path: string): Promise<void>;
1352
+ /**
1353
+ * Return the language-specific strings for an app
1354
+ *
1355
+ * @param language - the language to retrieve strings for
1356
+ * @param stringFile - the path to the localized strings file if not in the default location
1357
+ *
1358
+ * @returns A record of localized keys to localized text
1359
+ *
1360
+ * @deprecated
1361
+ */
384
1362
  getStrings?(language?: string, stringFile?: string): Promise<Record<string, unknown>>;
1363
+ /**
1364
+ * Set the value, but like, now? Don't use this.
1365
+ *
1366
+ * @param value - the value to set
1367
+ * @param elementId - the element to set the value of
1368
+ *
1369
+ * @deprecated
1370
+ */
385
1371
  setValueImmediate?(value: string, elementId: string): Promise<void>;
1372
+ /**
1373
+ * Set the value of a text field but ensure the current value is replace and not appended
1374
+ *
1375
+ * @param value - the text to set
1376
+ * @param elementId - the element to set it in
1377
+ *
1378
+ * @deprecated
1379
+ */
386
1380
  replaceValue?(value: string, elementId: string): Promise<void>;
1381
+ /**
1382
+ * Collect the response of an async script execution? It's unclear what this is for. Don't use
1383
+ * it.
1384
+ *
1385
+ * @param response - idk
1386
+ *
1387
+ * @deprecated
1388
+ */
387
1389
  receiveAsyncResponse?(response: unknown): Promise<void>;
1390
+ /**
1391
+ * Set the contents of the device clipboard
1392
+ *
1393
+ * @param content - the text to set
1394
+ * @param contentType - the media type if not text
1395
+ * @param label - the label if not text
1396
+ *
1397
+ * @deprecated
1398
+ */
388
1399
  setClipboard?(content: string, contentType?: string, label?: string): Promise<void>;
1400
+ /**
1401
+ * Get the contents of the device clipboard, converted into an appropriate media type
1402
+ *
1403
+ * @param contentType - the media type if not text
1404
+ *
1405
+ * @returns The text or media content (base64-encoded) of the clipboard
1406
+ *
1407
+ * @deprecated
1408
+ */
389
1409
  getClipboard?(contentType?: string): Promise<string>;
1410
+ /**
1411
+ * Set the async execute script timeout
1412
+ *
1413
+ * @param ms - the timeout
1414
+ *
1415
+ * @deprecated Use the W3C timeouts command instead
1416
+ */
390
1417
  asyncScriptTimeout?(ms: number): Promise<void>;
1418
+ /**
1419
+ * Get the window size
1420
+ *
1421
+ * @returns The size (width and height)
1422
+ *
1423
+ * @deprecated Use getWindowRect instead
1424
+ */
391
1425
  getWindowSize?(): Promise<Size>;
1426
+ /**
1427
+ * Get the position of an element on screen
1428
+ *
1429
+ * @param elementId - the element ID
1430
+ *
1431
+ * @returns The position of the element
1432
+ *
1433
+ * @deprecated Use getElementRect instead
1434
+ */
392
1435
  getLocation?(elementId: string): Promise<Position>;
1436
+ /**
1437
+ * Get the position of an element on screen within a certain other view
1438
+ *
1439
+ * @param elementId - the element ID
1440
+ *
1441
+ * @returns The position of the element
1442
+ *
1443
+ * @deprecated Use getElementRect instead
1444
+ */
393
1445
  getLocationInView?(elementId: string): Promise<Position>;
1446
+ /**
1447
+ * Get the size of an element
1448
+ *
1449
+ * @param elementId - the element ID
1450
+ *
1451
+ * @returns The size of the element
1452
+ *
1453
+ * @deprecated Use getElementRect instead
1454
+ */
394
1455
  getSize?(elementId: string): Promise<Size>;
395
- elementShadowRoot?(elementId: string): Promise<Element>;
396
- findElementFromShadowRoot?(strategy: string, selector: string, shadowId: string): Promise<Element>;
397
- findElementsFromShadowRoot?(strategy: string, selector: string, shadowId: string): Promise<Element[]>;
1456
+ /**
1457
+ * Check whether two elements are identical
1458
+ *
1459
+ * @param elementId - the first element's ID
1460
+ * @param otherElementId - the second element's ID
1461
+ *
1462
+ * @returns True if the elements are equal, false otherwise
1463
+ *
1464
+ * @deprecated
1465
+ */
398
1466
  equalsElement?(elementId: string, otherElementId: string): Promise<boolean>;
1467
+ /**
1468
+ * Submit the form an element is in
1469
+ *
1470
+ * @param elementId - the element ID
1471
+ *
1472
+ * @deprecated
1473
+ */
399
1474
  submit?(elementId: string): Promise<void>;
1475
+ /**
1476
+ * Send keys to the app
1477
+ *
1478
+ * @param value: the array of keys to send
1479
+ *
1480
+ * @deprecated Use the W3C send keys method instead
1481
+ */
400
1482
  keys?(value: string[]): Promise<void>;
1483
+ /**
1484
+ * Get the list of IME engines
1485
+ *
1486
+ * @returns The list of IME engines
1487
+ *
1488
+ * @deprecated
1489
+ */
401
1490
  availableIMEEngines?(): Promise<string[]>;
1491
+ /**
1492
+ * Get the active IME engine
1493
+ *
1494
+ * @returns The name of the active engine
1495
+ *
1496
+ * @deprecated
1497
+ */
402
1498
  getActiveIMEEngine?(): Promise<string>;
1499
+ /**
1500
+ * Determine whether an IME is active
1501
+ *
1502
+ * @returns True if the IME is activated
1503
+ *
1504
+ * @deprecated
1505
+ */
403
1506
  isIMEActivated?(): Promise<boolean>;
1507
+ /**
1508
+ * Deactivate an IME engine
1509
+ *
1510
+ * @deprecated
1511
+ */
404
1512
  deactivateIMEEngine?(): Promise<void>;
1513
+ /**
1514
+ * Activate an IME engine
1515
+ *
1516
+ * @param engine - the name of the engine
1517
+ *
1518
+ * @deprecated
1519
+ */
405
1520
  activateIMEEngine?(engine: string): Promise<void>;
1521
+ /**
1522
+ * Get the device orientation
1523
+ *
1524
+ * @returns The orientation string
1525
+ */
406
1526
  getOrientation?(): Promise<string>;
1527
+ /**
1528
+ * Set the device orientation
1529
+ *
1530
+ * @param orientation - the orientation string
1531
+ */
407
1532
  setOrientation?(orientation: string): Promise<void>;
1533
+ /**
1534
+ * Move the mouse pointer to a particular screen location
1535
+ *
1536
+ * @param element - the element ID if the move is relative to an element
1537
+ * @param xOffset - the x offset
1538
+ * @param yOffset - the y offset
1539
+ *
1540
+ * @deprecated Use the Actions API instead
1541
+ */
408
1542
  moveTo?(element?: null | string, xOffset?: number, yOffset?: number): Promise<void>;
1543
+ /**
1544
+ * Trigger a mouse button down
1545
+ *
1546
+ * @param button - the button ID
1547
+ *
1548
+ * @deprecated Use the Actions API instead
1549
+ */
409
1550
  buttonDown?(button?: number): Promise<void>;
1551
+ /**
1552
+ * Trigger a mouse button up
1553
+ *
1554
+ * @param button - the button ID
1555
+ *
1556
+ * @deprecated Use the Actions API instead
1557
+ */
410
1558
  buttonUp?(button?: number): Promise<void>;
1559
+ /**
1560
+ * Click the current mouse location
1561
+ *
1562
+ * @param button - the button ID
1563
+ *
1564
+ * @deprecated Use the Actions API instead
1565
+ */
411
1566
  clickCurrent?(button?: number): Promise<void>;
1567
+ /**
1568
+ * Double-click the current mouse location
1569
+ *
1570
+ * @deprecated Use the Actions API instead
1571
+ */
412
1572
  doubleClick?(): Promise<void>;
1573
+ /**
1574
+ * Perform a touch down event at the location specified
1575
+ *
1576
+ * @param x - the x coordinate
1577
+ * @param y - the y coordinate
1578
+ *
1579
+ * @deprecated Use the Actions API instead
1580
+ */
413
1581
  touchDown?(x: number, y: number): Promise<void>;
1582
+ /**
1583
+ * Perform a touch up event at the location specified
1584
+ *
1585
+ * @param x - the x coordinate
1586
+ * @param y - the y coordinate
1587
+ *
1588
+ * @deprecated Use the Actions API instead
1589
+ */
414
1590
  touchUp?(x: number, y: number): Promise<void>;
1591
+ /**
1592
+ * Perform a touch move event at the location specified
1593
+ *
1594
+ * @param x - the x coordinate
1595
+ * @param y - the y coordinate
1596
+ *
1597
+ * @deprecated Use the Actions API instead
1598
+ */
415
1599
  touchMove?(x: number, y: number): Promise<void>;
1600
+ /**
1601
+ * Perform a long touch down event at the location specified
1602
+ *
1603
+ * @param elementId - the id of the element to long touch
1604
+ *
1605
+ * @deprecated Use the Actions API instead
1606
+ */
416
1607
  touchLongClick?(elementId: string): Promise<void>;
1608
+ /**
1609
+ * Perform a flick event at the location specified
1610
+ *
1611
+ * @param element - the element to make coordinates relative to
1612
+ * @param xSpeed - the horizontal flick speed (in driver-specific units)
1613
+ * @param ySpeed - the vertical flick speed (in driver-specific units)
1614
+ * @param xOffset - the x coordinate
1615
+ * @param yOffset - the y coordinate
1616
+ * @param speed - the speed (unclear how this relates to xSpeed and ySpeed)
1617
+ *
1618
+ * @deprecated Use the Actions API instead
1619
+ */
417
1620
  flick?(element?: string, xSpeed?: number, ySpeed?: number, xOffset?: number, yOffset?: number, speed?: number): Promise<void>;
1621
+ /**
1622
+ * Get the virtual or real geographical location of a device
1623
+ *
1624
+ * @returns The location
1625
+ */
418
1626
  getGeoLocation?(): Promise<Location>;
1627
+ /**
1628
+ * Set the virtual geographical location of a device
1629
+ *
1630
+ * @param location - the location including latitude and longitude
1631
+ */
419
1632
  setGeoLocation?(location: Partial<Location>): Promise<void>;
1633
+ /**
1634
+ * Get the currently active context
1635
+ * @see {@link https://github.com/SeleniumHQ/mobile-spec/blob/master/spec-draft.md#webviews-and-other-contexts}
1636
+ *
1637
+ * @returns The context name
1638
+ */
420
1639
  getCurrentContext?(): Promise<string | null>;
1640
+ /**
1641
+ * Switch to a context by name
1642
+ * @see {@link https://github.com/SeleniumHQ/mobile-spec/blob/master/spec-draft.md#webviews-and-other-contexts}
1643
+ *
1644
+ * @param name - the context name
1645
+ */
421
1646
  setContext?(name: string): Promise<void>;
1647
+ /**
1648
+ * Get the list of available contexts
1649
+ * @see {@link https://github.com/SeleniumHQ/mobile-spec/blob/master/spec-draft.md#webviews-and-other-contexts}
1650
+ *
1651
+ * @returns The list of context names
1652
+ */
422
1653
  getContexts?(): Promise<string[]>;
1654
+ /**
1655
+ * Get the index of an element on the page
1656
+ *
1657
+ * @param elementId - the element id
1658
+ *
1659
+ * @returns The page index
1660
+ *
1661
+ * @deprecated
1662
+ */
423
1663
  getPageIndex?(elementId: string): Promise<string>;
1664
+ /**
1665
+ * Get the network connection state of a device
1666
+ * @see {@link https://github.com/SeleniumHQ/mobile-spec/blob/master/spec-draft.md#device-modes}
1667
+ *
1668
+ * @returns A number which is a bitmask representing categories like Data, Wifi, and Airplane
1669
+ * mode status
1670
+ */
424
1671
  getNetworkConnection?(): Promise<number>;
1672
+ /**
1673
+ * Set the network connection of the device
1674
+ * @see {@link https://github.com/SeleniumHQ/mobile-spec/blob/master/spec-draft.md#device-modes}
1675
+ *
1676
+ * @param type - the bitmask representing network state
1677
+ */
425
1678
  setNetworkConnection?(type: number): Promise<void>;
1679
+ /**
1680
+ * Perform a set of touch actions
1681
+ *
1682
+ * @param actions - the old MJSONWP style touch action objects
1683
+ *
1684
+ * @deprecated Use the W3C Actions API instead
1685
+ */
426
1686
  performTouch?(actions: unknown): Promise<void>;
1687
+ /**
1688
+ * Perform a set of touch actions
1689
+ *
1690
+ * @param actions - the old MJSONWP style touch action objects
1691
+ * @param elementId - the id of an element if actions are restricted to one element
1692
+ *
1693
+ * @deprecated Use the W3C Actions API instead
1694
+ */
427
1695
  performMultiAction?(actions: unknown, elementId: string): Promise<void>;
1696
+ /**
1697
+ * Get the current rotation state of the device
1698
+ * @see {@link https://github.com/SeleniumHQ/mobile-spec/blob/master/spec-draft.md#device-rotation}
1699
+ *
1700
+ * @returns The Rotation object consisting of x, y, and z rotation values (0 <= n <= 360)
1701
+ */
428
1702
  getRotation?(): Promise<Rotation>;
1703
+ /**
1704
+ * Set the device rotation state
1705
+ * @see {@link https://github.com/SeleniumHQ/mobile-spec/blob/master/spec-draft.md#device-rotation}
1706
+ *
1707
+ * @param x - the degree to which the device is rotated around the x axis (0 <= x <= 360)
1708
+ * @param y - the degree to which the device is rotated around the y axis (0 <= y <= 360)
1709
+ * @param z - the degree to which the device is rotated around the z axis (0 <= z <= 360)
1710
+ */
429
1711
  setRotation?(x: number, y: number, z: number): Promise<void>;
1712
+ /**
1713
+ * Execute a devtools command
1714
+ *
1715
+ * @param cmd - the command
1716
+ * @param params - any command-specific command parameters
1717
+ *
1718
+ * @returns The result of the command execution
1719
+ */
430
1720
  executeCdp?(cmd: string, params: unknown): Promise<unknown>;
431
- addVirtualAuthenticator?(protocol: string, transport: string, hasResidentKey?: boolean, hasUserVerification?: boolean, isUserConsenting?: boolean, isUserVerified?: boolean): Promise<void>;
432
- removeVirtualAuthenticator?(): Promise<void>;
433
- addAuthCredential?(credentialId: string, isResidentCredential: boolean, rpId: string, privateKey: string, userHandle?: string, signCount?: number): Promise<void>;
1721
+ /**
1722
+ * Add a virtual authenticator to a browser
1723
+ * @see {@link https://www.w3.org/TR/webauthn-2/#sctn-automation-add-virtual-authenticator}
1724
+ *
1725
+ * @param protocol - the protocol
1726
+ * @param transport - a valid AuthenticatorTransport value
1727
+ * @param hasResidentKey - whether there is a resident key
1728
+ * @param hasUserVerification - whether the authenticator has user verification
1729
+ * @param isUserConsenting - whether it is a user consenting authenticator
1730
+ * @param isUserVerified - whether the user is verified
1731
+ *
1732
+ * @returns The authenticator ID
1733
+ */
1734
+ addVirtualAuthenticator?(protocol: 'ctap/u2f' | 'ctap2' | 'ctap2_1', transport: string, hasResidentKey?: boolean, hasUserVerification?: boolean, isUserConsenting?: boolean, isUserVerified?: boolean): Promise<string>;
1735
+ /**
1736
+ * Remove a virtual authenticator
1737
+ * @see {@link https://www.w3.org/TR/webauthn-2/#sctn-automation-remove-virtual-authenticator}
1738
+ *
1739
+ * @param authenticatorId - the ID returned in the call to add the authenticator
1740
+ */
1741
+ removeVirtualAuthenticator?(authenticatorId: string): Promise<void>;
1742
+ /**
1743
+ * Inject a public key credential source into a virtual authenticator
1744
+ * @see {@link https://www.w3.org/TR/webauthn-2/#sctn-automation-add-credential}
1745
+ *
1746
+ * @param credentialId - the base64 encoded credential ID
1747
+ * @param isResidentCredential - if true, a client-side credential, otherwise a server-side
1748
+ * credential
1749
+ * @param rpId - the relying party ID the credential is scoped to
1750
+ * @param privateKey - the base64 encoded private key package
1751
+ * @param userHandle - the base64 encoded user handle
1752
+ * @param signCount - the initial value for a signature counter
1753
+ */
1754
+ addAuthCredential?(credentialId: string, isResidentCredential: boolean, rpId: string, privateKey: string, userHandle: string, signCount: number, authenticatorId: string): Promise<void>;
1755
+ /**
1756
+ * Get the list of public key credential sources
1757
+ * @see {@link https://www.w3.org/TR/webauthn-2/#sctn-automation-get-credentials}
1758
+ *
1759
+ * @returns The list of Credentials
1760
+ */
434
1761
  getAuthCredential?(): Promise<Credential[]>;
1762
+ /**
1763
+ * Remove all auth credentials
1764
+ * @see {@link https://www.w3.org/TR/webauthn-2/#sctn-automation-remove-all-credentials}
1765
+ */
435
1766
  removeAllAuthCredentials?(): Promise<void>;
436
- removeAuthCredential?(): Promise<void>;
437
- setUserAuthVerified?(isUserVerified: boolean): Promise<void>;
1767
+ /**
1768
+ * Remove a specific auth credential
1769
+ *
1770
+ * @param credentialId - the credential ID
1771
+ * @param authenticatorId - the authenticator ID
1772
+ */
1773
+ removeAuthCredential?(credentialId: string, authenticatorId: string): Promise<void>;
1774
+ /**
1775
+ * Set the isUserVerified property of an authenticator
1776
+ * @see {@link https://www.w3.org/TR/webauthn-2/#sctn-automation-set-user-verified}
1777
+ *
1778
+ * @param isUserVerified - the value of the isUserVerified property
1779
+ * @param authenticatorId - the authenticator id
1780
+ */
1781
+ setUserAuthVerified?(isUserVerified: boolean, authenticatorId: string): Promise<void>;
1782
+ /**
1783
+ * Proxy a command to a connected WebDriver server
1784
+ *
1785
+ * @typeParam T - the type of the return value
1786
+ * @param url - the incoming URL
1787
+ * @param method - the incoming HTTP method
1788
+ * @param body - the incoming HTTP body
1789
+ *
1790
+ * @returns The return value of the proxied command
1791
+ */
438
1792
  proxyCommand?<T = any>(url: string, method: HTTPMethod, body?: string): Promise<T>;
439
1793
  }
440
1794
  /**