@appium/types 1.0.0-rc.1 → 1.0.1
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.
- package/build/lib/capabilities.d.ts +1 -2
- package/build/lib/capabilities.d.ts.map +1 -1
- package/build/lib/{command.d.ts → command-maps.d.ts} +1 -1
- package/build/lib/command-maps.d.ts.map +1 -0
- package/build/lib/command-maps.js +4 -0
- package/build/lib/command-maps.js.map +1 -0
- package/build/lib/commands/appium.d.ts +100 -0
- package/build/lib/commands/appium.d.ts.map +1 -0
- package/build/lib/{command.js → commands/appium.js} +1 -2
- package/build/lib/commands/appium.js.map +1 -0
- package/build/lib/commands/basedriver.d.ts +370 -0
- package/build/lib/commands/basedriver.d.ts.map +1 -0
- package/build/lib/commands/basedriver.js +3 -0
- package/build/lib/commands/basedriver.js.map +1 -0
- package/build/lib/commands/index.d.ts +7 -0
- package/build/lib/commands/index.d.ts.map +1 -0
- package/build/lib/commands/index.js +23 -0
- package/build/lib/commands/index.js.map +1 -0
- package/build/lib/commands/jsonwp.d.ts +37 -0
- package/build/lib/commands/jsonwp.d.ts.map +1 -0
- package/build/lib/commands/jsonwp.js +3 -0
- package/build/lib/commands/jsonwp.js.map +1 -0
- package/build/lib/commands/mjsonwp.d.ts +65 -0
- package/build/lib/commands/mjsonwp.d.ts.map +1 -0
- package/build/lib/commands/mjsonwp.js +3 -0
- package/build/lib/commands/mjsonwp.js.map +1 -0
- package/build/lib/commands/other-protocols.d.ts +85 -0
- package/build/lib/commands/other-protocols.d.ts.map +1 -0
- package/build/lib/commands/other-protocols.js +3 -0
- package/build/lib/commands/other-protocols.js.map +1 -0
- package/build/lib/commands/webdriver.d.ts +418 -0
- package/build/lib/commands/webdriver.d.ts.map +1 -0
- package/build/lib/commands/webdriver.js +3 -0
- package/build/lib/commands/webdriver.js.map +1 -0
- package/build/lib/constraints.d.ts +19 -0
- package/build/lib/constraints.d.ts.map +1 -1
- package/build/lib/constraints.js.map +1 -1
- package/build/lib/driver.d.ts +9 -1056
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/index.d.ts +2 -1
- package/build/lib/index.d.ts.map +1 -1
- package/build/lib/index.js +2 -1
- package/build/lib/index.js.map +1 -1
- package/build/lib/plugin.d.ts +1 -1
- package/build/lib/plugin.d.ts.map +1 -1
- package/lib/capabilities.ts +1 -2
- package/lib/commands/appium.ts +115 -0
- package/lib/commands/basedriver.ts +476 -0
- package/lib/commands/index.ts +6 -0
- package/lib/commands/jsonwp.ts +41 -0
- package/lib/commands/mjsonwp.ts +71 -0
- package/lib/commands/other-protocols.ts +113 -0
- package/lib/commands/webdriver.ts +475 -0
- package/lib/constraints.ts +18 -1
- package/lib/driver.ts +25 -1279
- package/lib/index.ts +2 -1
- package/lib/plugin.ts +1 -1
- package/package.json +6 -7
- package/build/lib/command.d.ts.map +0 -1
- package/build/lib/command.js.map +0 -1
- /package/lib/{command.ts → command-maps.ts} +0 -0
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
import type {ActionSequence} from '../action';
|
|
2
|
+
import type {Element} from '../util';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Interface for all standard WebDriver Classic commands proxied to the external driver.
|
|
6
|
+
*/
|
|
7
|
+
export interface IWDClassicCommands {
|
|
8
|
+
/**
|
|
9
|
+
* Navigate to a given url
|
|
10
|
+
* @see {@link https://w3c.github.io/webdriver/#navigate-to}
|
|
11
|
+
*
|
|
12
|
+
* @param url - the url
|
|
13
|
+
*/
|
|
14
|
+
setUrl?(url: string): Promise<void>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Get the current url
|
|
18
|
+
* @see {@link https://w3c.github.io/webdriver/#get-current-url}
|
|
19
|
+
*
|
|
20
|
+
* @returns The url
|
|
21
|
+
*/
|
|
22
|
+
getUrl?(): Promise<string>;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Navigate back in the page history
|
|
26
|
+
* @see {@link https://w3c.github.io/webdriver/#back}
|
|
27
|
+
*/
|
|
28
|
+
back?(): Promise<void>;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Navigate forward in the page history
|
|
32
|
+
* @see {@link https://w3c.github.io/webdriver/#forward}
|
|
33
|
+
*/
|
|
34
|
+
forward?(): Promise<void>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Refresh the page
|
|
38
|
+
* @see {@link https://w3c.github.io/webdriver/#refresh}
|
|
39
|
+
*/
|
|
40
|
+
refresh?(): Promise<void>;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Get the current page title
|
|
44
|
+
* @see {@link https://w3c.github.io/webdriver/#get-title}
|
|
45
|
+
*
|
|
46
|
+
* @returns The title
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```js
|
|
50
|
+
* await driver.getTitle()
|
|
51
|
+
* ```
|
|
52
|
+
* ```py
|
|
53
|
+
* driver.title
|
|
54
|
+
* ```
|
|
55
|
+
* ```java
|
|
56
|
+
* driver.getTitle();
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
title?(): Promise<string>;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Get the handle (id) associated with the current browser window
|
|
63
|
+
* @see {@link https://w3c.github.io/webdriver/#get-window-handle}
|
|
64
|
+
*
|
|
65
|
+
* @returns The handle string
|
|
66
|
+
*/
|
|
67
|
+
getWindowHandle?(): Promise<string>;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Close the current browsing context (window)
|
|
71
|
+
* @see {@link https://w3c.github.io/webdriver/#close-window}
|
|
72
|
+
*
|
|
73
|
+
* @returns An array of window handles representing currently-open windows
|
|
74
|
+
*/
|
|
75
|
+
closeWindow?(): Promise<string[]>;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Switch to a specified window
|
|
79
|
+
* @see {@link https://w3c.github.io/webdriver/#switch-to-window}
|
|
80
|
+
*
|
|
81
|
+
* @param handle - the window handle of the window to make active
|
|
82
|
+
*/
|
|
83
|
+
setWindow?(handle: string): Promise<void>;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Get a set of handles representing open browser windows
|
|
87
|
+
* @see {@link https://w3c.github.io/webdriver/#get-window-handles}
|
|
88
|
+
*
|
|
89
|
+
* @returns An array of window handles representing currently-open windows
|
|
90
|
+
*/
|
|
91
|
+
getWindowHandles?(): Promise<string[]>;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Create a new browser window
|
|
95
|
+
* @see {@link https://w3c.github.io/webdriver/#new-window}
|
|
96
|
+
*
|
|
97
|
+
* @param type - a hint to the driver whether to create a "tab" or "window"
|
|
98
|
+
*
|
|
99
|
+
* @returns An object containing the handle of the newly created window and its type
|
|
100
|
+
*/
|
|
101
|
+
createNewWindow?(type?: NewWindowType): Promise<NewWindow>;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Switch the current browsing context to a frame
|
|
105
|
+
* @see {@link https://w3c.github.io/webdriver/#switch-to-frame}
|
|
106
|
+
*
|
|
107
|
+
* @param id - the frame id, index, or `null` (indicating the top-level context)
|
|
108
|
+
*/
|
|
109
|
+
setFrame?(id: null | number | string): Promise<void>;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Set the current browsing context to the parent of the current context
|
|
113
|
+
* @see {@link https://w3c.github.io/webdriver/#switch-to-parent-frame}
|
|
114
|
+
*/
|
|
115
|
+
switchToParentFrame?(): Promise<void>;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Get the size and position of the current window
|
|
119
|
+
* @see {@link https://w3c.github.io/webdriver/#get-window-rect}
|
|
120
|
+
*
|
|
121
|
+
* @returns A `Rect` JSON object with x, y, width, and height properties
|
|
122
|
+
*/
|
|
123
|
+
getWindowRect?(): Promise<Rect>;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Set the current window's size and position
|
|
127
|
+
* @see {@link https://w3c.github.io/webdriver/#set-window-rect}
|
|
128
|
+
*
|
|
129
|
+
* @param x - the screen coordinate for the new left edge of the window
|
|
130
|
+
* @param y - the screen coordinate for the new top edge of the window
|
|
131
|
+
* @param width - the width in pixels to resize the window to
|
|
132
|
+
* @param height - the height in pixels to resize the window to
|
|
133
|
+
*
|
|
134
|
+
* @returns The actual `Rect` of the window after running the command
|
|
135
|
+
*/
|
|
136
|
+
setWindowRect?(x: number, y: number, width: number, height: number): Promise<Rect>;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Run the window-manager specific 'maximize' operation on the current window
|
|
140
|
+
* @see {@link https://w3c.github.io/webdriver/#maximize-window}
|
|
141
|
+
*
|
|
142
|
+
* @returns The actual `Rect` of the window after running the command
|
|
143
|
+
*/
|
|
144
|
+
maximizeWindow?(): Promise<Rect>;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Run the window-manager specific 'minimize' operation on the current window
|
|
148
|
+
* @see {@link https://w3c.github.io/webdriver/#minimize-window}
|
|
149
|
+
*
|
|
150
|
+
* @returns The actual `Rect` of the window after running the command
|
|
151
|
+
*/
|
|
152
|
+
minimizeWindow?(): Promise<Rect>;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Put the current window into full screen mode
|
|
156
|
+
* @see {@link https://w3c.github.io/webdriver/#fullscreen-window}
|
|
157
|
+
*
|
|
158
|
+
* @returns The actual `Rect` of the window after running the command
|
|
159
|
+
*/
|
|
160
|
+
fullScreenWindow?(): Promise<Rect>;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Get the active element
|
|
164
|
+
* @see {@link https://w3c.github.io/webdriver/#get-active-element}
|
|
165
|
+
*
|
|
166
|
+
* @returns The JSON object encapsulating the active element reference
|
|
167
|
+
*/
|
|
168
|
+
active?(): Promise<Element>;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Get the shadow root of an element
|
|
172
|
+
* @see {@link https://w3c.github.io/webdriver/#get-element-shadow-root}
|
|
173
|
+
*
|
|
174
|
+
* @param elementId - the id of the element to retrieve the shadow root for
|
|
175
|
+
*
|
|
176
|
+
* @returns The shadow root for an element, as an element
|
|
177
|
+
*/
|
|
178
|
+
elementShadowRoot?(elementId: string): Promise<Element>;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Determine if the reference element is selected or not
|
|
182
|
+
* @see {@link https://w3c.github.io/webdriver/#is-element-selected}
|
|
183
|
+
*
|
|
184
|
+
* @param elementId - the id of the element
|
|
185
|
+
*
|
|
186
|
+
* @returns True if the element is selected, False otherwise
|
|
187
|
+
*/
|
|
188
|
+
elementSelected?(elementId: string): Promise<boolean>;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Retrieve the value of an element's attribute
|
|
192
|
+
* @see {@link https://w3c.github.io/webdriver/#get-element-attribute}
|
|
193
|
+
*
|
|
194
|
+
* @param name - the attribute name
|
|
195
|
+
* @param elementId - the id of the element
|
|
196
|
+
*
|
|
197
|
+
* @returns The attribute value
|
|
198
|
+
*/
|
|
199
|
+
getAttribute?(name: string, elementId: string): Promise<string | null>;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Retrieve the value of a named property of an element's JS object
|
|
203
|
+
* @see {@link https://w3c.github.io/webdriver/#get-element-property}
|
|
204
|
+
*
|
|
205
|
+
* @param name - the object property name
|
|
206
|
+
* @param elementId - the id of the element
|
|
207
|
+
*
|
|
208
|
+
* @returns The property value
|
|
209
|
+
*/
|
|
210
|
+
getProperty?(name: string, elementId: string): Promise<string | null>;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Retrieve the value of a CSS property of an element
|
|
214
|
+
* @see {@link https://w3c.github.io/webdriver/#get-element-css-value}
|
|
215
|
+
*
|
|
216
|
+
* @param name - the CSS property name
|
|
217
|
+
* @param elementId - the id of the element
|
|
218
|
+
*
|
|
219
|
+
* @returns The property value
|
|
220
|
+
*/
|
|
221
|
+
getCssProperty?(name: string, elementId: string): Promise<string>;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Get the text of an element as rendered
|
|
225
|
+
* @see {@link https://w3c.github.io/webdriver/#get-element-text}
|
|
226
|
+
*
|
|
227
|
+
* @param elementId - the id of the element
|
|
228
|
+
*
|
|
229
|
+
* @returns The text rendered for the element
|
|
230
|
+
*/
|
|
231
|
+
getText?(elementId: string): Promise<string>;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Get the tag name of an element
|
|
235
|
+
* @see {@link https://w3c.github.io/webdriver/#get-element-tag-name}
|
|
236
|
+
*
|
|
237
|
+
* @param elementId - the id of the element
|
|
238
|
+
*
|
|
239
|
+
* @returns The tag name
|
|
240
|
+
*/
|
|
241
|
+
getName?(elementId: string): Promise<string>;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Get the dimensions and position of an element
|
|
245
|
+
* @see {@link https://w3c.github.io/webdriver/#get-element-rect}
|
|
246
|
+
*
|
|
247
|
+
* @param elementId - the id of the element
|
|
248
|
+
*
|
|
249
|
+
* @returns The Rect object containing x, y, width, and height properties
|
|
250
|
+
*/
|
|
251
|
+
getElementRect?(elementId: string): Promise<Rect>;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Determine whether an element is enabled
|
|
255
|
+
* @see {@link https://w3c.github.io/webdriver/#is-element-enabled}
|
|
256
|
+
*
|
|
257
|
+
* @param elementId - the id of the element
|
|
258
|
+
*
|
|
259
|
+
* @returns True if the element is enabled, False otherwise
|
|
260
|
+
*/
|
|
261
|
+
elementEnabled?(elementId: string): Promise<boolean>;
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Get the WAI-ARIA role of an element
|
|
265
|
+
* @see {@link https://w3c.github.io/webdriver/#get-computed-role}
|
|
266
|
+
*
|
|
267
|
+
* @param elementId - the id of the element
|
|
268
|
+
*
|
|
269
|
+
* @returns The role
|
|
270
|
+
*/
|
|
271
|
+
getComputedRole?(elementId: string): Promise<string | null>;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Get the accessible name/label of an element
|
|
275
|
+
* @see {@link https://w3c.github.io/webdriver/#get-computed-label}
|
|
276
|
+
*
|
|
277
|
+
* @param elementId - the id of the element
|
|
278
|
+
*
|
|
279
|
+
* @returns The accessible name
|
|
280
|
+
*/
|
|
281
|
+
getComputedLabel?(elementId: string): Promise<string | null>;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Determine whether an element is displayed
|
|
285
|
+
* @see {@link https://w3c.github.io/webdriver/#element-displayedness}
|
|
286
|
+
*
|
|
287
|
+
* @param elementId - the id of the element
|
|
288
|
+
*
|
|
289
|
+
* @returns True if any part of the element is rendered within the viewport, False otherwise
|
|
290
|
+
*/
|
|
291
|
+
elementDisplayed?(elementId: string): Promise<boolean>;
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Click/tap an element
|
|
295
|
+
* @see {@link https://w3c.github.io/webdriver/#element-click}
|
|
296
|
+
*
|
|
297
|
+
* @param elementId - the id of the element
|
|
298
|
+
*/
|
|
299
|
+
click?(elementId: string): Promise<void>;
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Clear the text/value of an editable element
|
|
303
|
+
* @see {@link https://w3c.github.io/webdriver/#element-clear}
|
|
304
|
+
*
|
|
305
|
+
* @param elementId - the id of the element
|
|
306
|
+
*/
|
|
307
|
+
clear?(elementId: string): Promise<void>;
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Send keystrokes to an element (or otherwise set its value)
|
|
311
|
+
* @see {@link https://w3c.github.io/webdriver/#element-send-keys}
|
|
312
|
+
*
|
|
313
|
+
* @param text - the text to send to the element
|
|
314
|
+
* @param elementId - the id of the element
|
|
315
|
+
*/
|
|
316
|
+
setValue?(text: string, elementId: string): Promise<void>;
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Execute JavaScript (or some other kind of script) in the browser/app context
|
|
320
|
+
* @see {@link https://w3c.github.io/webdriver/#execute-script}
|
|
321
|
+
*
|
|
322
|
+
* @param script - the string to be evaluated as the script, which will be made the body of an
|
|
323
|
+
* anonymous function in the case of JS
|
|
324
|
+
* @param args - the list of arguments to be applied to the script as a function
|
|
325
|
+
*
|
|
326
|
+
* @returns The return value of the script execution
|
|
327
|
+
*/
|
|
328
|
+
execute?(script: string, args: unknown[]): Promise<unknown>;
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Execute JavaScript (or some other kind of script) in the browser/app context, asynchronously
|
|
332
|
+
* @see {@link https://w3c.github.io/webdriver/#execute-async-script}
|
|
333
|
+
*
|
|
334
|
+
* @param script - the string to be evaluated as the script, which will be made the body of an
|
|
335
|
+
* anonymous function in the case of JS
|
|
336
|
+
* @param args - the list of arguments to be applied to the script as a function
|
|
337
|
+
*
|
|
338
|
+
* @returns The promise resolution of the return value of the script execution (or an error
|
|
339
|
+
* object if the promise is rejected)
|
|
340
|
+
*/
|
|
341
|
+
executeAsync?(script: string, args: unknown[]): Promise<unknown>;
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Get all cookies known to the browsing context
|
|
345
|
+
* @see {@link https://w3c.github.io/webdriver/#get-all-cookies}
|
|
346
|
+
*
|
|
347
|
+
* @returns A list of serialized cookies
|
|
348
|
+
*/
|
|
349
|
+
getCookies?(): Promise<Cookie[]>;
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Get a cookie by name
|
|
353
|
+
* @see {@link https://w3c.github.io/webdriver/#get-named-cookie}
|
|
354
|
+
*
|
|
355
|
+
* @param name - the name of the cookie
|
|
356
|
+
*
|
|
357
|
+
* @returns A serialized cookie
|
|
358
|
+
*/
|
|
359
|
+
getCookie?(name: string): Promise<Cookie>;
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Add a cookie to the browsing context
|
|
363
|
+
* @see {@link https://w3c.github.io/webdriver/#add-cookie}
|
|
364
|
+
*
|
|
365
|
+
* @param cookie - the cookie data including properties like name, value, path, domain,
|
|
366
|
+
* secure, httpOnly, expiry, and samesite
|
|
367
|
+
*/
|
|
368
|
+
setCookie?(cookie: Cookie): Promise<void>;
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Delete a named cookie
|
|
372
|
+
* @see {@link https://w3c.github.io/webdriver/#delete-cookie}
|
|
373
|
+
*
|
|
374
|
+
* @param name - the name of the cookie to delete
|
|
375
|
+
*/
|
|
376
|
+
deleteCookie?(name: string): Promise<void>;
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Delete all cookies
|
|
380
|
+
* @see {@link https://w3c.github.io/webdriver/#delete-all-cookies}
|
|
381
|
+
*/
|
|
382
|
+
deleteCookies?(): Promise<void>;
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Perform touch or keyboard actions
|
|
386
|
+
* @see {@link https://w3c.github.io/webdriver/#perform-actions}
|
|
387
|
+
*
|
|
388
|
+
* @param actions - the action sequence
|
|
389
|
+
*/
|
|
390
|
+
performActions?(actions: ActionSequence[]): Promise<void>;
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Release all keys or buttons that are currently pressed
|
|
394
|
+
* @see {@link https://w3c.github.io/webdriver/#release-actions}
|
|
395
|
+
*/
|
|
396
|
+
releaseActions?(): Promise<void>;
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Dismiss a simple dialog/alert
|
|
400
|
+
* @see {@link https://w3c.github.io/webdriver/#dismiss-alert}
|
|
401
|
+
*/
|
|
402
|
+
postDismissAlert?(): Promise<void>;
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* Accept a simple dialog/alert
|
|
406
|
+
* @see {@link https://w3c.github.io/webdriver/#accept-alert}
|
|
407
|
+
*/
|
|
408
|
+
postAcceptAlert?(): Promise<void>;
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Get the text of the displayed alert
|
|
412
|
+
* @see {@link https://w3c.github.io/webdriver/#get-alert-text}
|
|
413
|
+
*
|
|
414
|
+
* @returns The text of the alert
|
|
415
|
+
*/
|
|
416
|
+
getAlertText?(): Promise<string | null>;
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Set the text field of an alert prompt
|
|
420
|
+
* @see {@link https://w3c.github.io/webdriver/#send-alert-text}
|
|
421
|
+
*
|
|
422
|
+
* @param text - the text to send to the prompt
|
|
423
|
+
*/
|
|
424
|
+
setAlertText?(text: string): Promise<void>;
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Get a screenshot of the current document as rendered
|
|
428
|
+
* @see {@link https://w3c.github.io/webdriver/#take-screenshot}
|
|
429
|
+
*
|
|
430
|
+
* @returns A base64-encoded string representing the PNG image data
|
|
431
|
+
*/
|
|
432
|
+
getScreenshot?(): Promise<string>;
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Get an image of a single element as rendered on screen
|
|
436
|
+
* @see {@link https://w3c.github.io/webdriver/#take-element-screenshot}
|
|
437
|
+
*
|
|
438
|
+
* @param elementId - the id of the element
|
|
439
|
+
*
|
|
440
|
+
* @returns A base64-encoded string representing the PNG image data for the element rect
|
|
441
|
+
*/
|
|
442
|
+
getElementScreenshot?(elementId: string): Promise<string>;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
export type NewWindowType = 'tab' | 'window';
|
|
446
|
+
|
|
447
|
+
export interface NewWindow {
|
|
448
|
+
handle: string;
|
|
449
|
+
type: NewWindowType;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
// WebDriver
|
|
453
|
+
export interface Rect {
|
|
454
|
+
x: number;
|
|
455
|
+
y: number;
|
|
456
|
+
width: number;
|
|
457
|
+
height: number;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
// JSONWP
|
|
461
|
+
export type Size = Pick<Rect, 'width' | 'height'>;
|
|
462
|
+
|
|
463
|
+
// JSONWP
|
|
464
|
+
export type Position = Pick<Rect, 'x' | 'y'>;
|
|
465
|
+
|
|
466
|
+
export interface Cookie {
|
|
467
|
+
name: string;
|
|
468
|
+
value: string;
|
|
469
|
+
path?: string;
|
|
470
|
+
domain?: string;
|
|
471
|
+
secure?: boolean;
|
|
472
|
+
httpOnly?: boolean;
|
|
473
|
+
expiry?: number;
|
|
474
|
+
sameSite?: 'Lax' | 'Strict';
|
|
475
|
+
}
|
package/lib/constraints.ts
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* A collection of constraints describing the allowed capabilities for a driver.
|
|
3
|
+
*/
|
|
4
|
+
export type Constraints = {
|
|
5
|
+
readonly [name: string]: Constraint;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export interface Constraint {
|
|
9
|
+
readonly presence?: boolean | Readonly<{allowEmpty: boolean}>;
|
|
10
|
+
readonly isString?: boolean;
|
|
11
|
+
readonly isNumber?: boolean;
|
|
12
|
+
readonly isBoolean?: boolean;
|
|
13
|
+
readonly isObject?: boolean;
|
|
14
|
+
readonly isArray?: boolean;
|
|
15
|
+
readonly deprecated?: boolean;
|
|
16
|
+
readonly inclusion?: Readonly<[string, ...string[]]>;
|
|
17
|
+
readonly inclusionCaseInsensitive?: Readonly<[string, ...string[]]>;
|
|
18
|
+
}
|
|
2
19
|
|
|
3
20
|
export const BASE_DESIRED_CAP_CONSTRAINTS = {
|
|
4
21
|
platformName: {
|