@appium/types 0.6.0 → 0.8.3

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