@types/k6 0.44.2 → 0.44.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.
@@ -6,1345 +6,1383 @@ import {
6
6
  KeyboardModifier,
7
7
  MouseButton,
8
8
  ScreenshotOptions,
9
- NavigationOptions } from "./";
10
- import { Touchscreen } from "./touchscreen";
11
- import { Response } from "./response";
12
- import { Locator } from "./locator";
13
- import { JSHandle } from "./js_handle";
14
- import { Keyboard } from "./keyboard";
15
- import { Mouse } from "./mouse";
16
- import { ElementHandle } from "./element_handle";
17
- import { Frame } from "./frame";
18
- import { Worker } from "./worker";
9
+ NavigationOptions,
10
+ } from './';
11
+ import { Touchscreen } from './touchscreen';
12
+ import { Response } from './response';
13
+ import { Locator } from './locator';
14
+ import { JSHandle } from './js_handle';
15
+ import { Keyboard } from './keyboard';
16
+ import { Mouse } from './mouse';
17
+ import { ElementHandle } from './element_handle';
18
+ import { Frame } from './frame';
19
+ import { Worker } from './worker';
19
20
 
20
21
  /**
21
22
  * Page provides methods to interact with a single tab in a running web browser
22
23
  * instance. One instance of the browser can have many page instances.
23
24
  */
24
25
  export class Page {
25
- /**
26
- * Activates the browser tab so that it comes into focus and actions can be
27
- * performed against it.
28
- */
29
- bringToFront(): void;
30
-
31
- /**
32
- * **NOTE** Use locator-based `locator.check([options])` instead.
33
- *
34
- * This method is used to select an input checkbox.
35
- * @param selector A selector to search for an element. If there are multiple
36
- * elements satisfying the selector, the first will be used.
37
- * @param options
38
- */
39
- check(selector: string, options?: {
40
26
  /**
41
- * Setting this to `true` will bypass the actionability checks (visible,
42
- * stable, enabled). Defaults to `false`.
27
+ * Activates the browser tab so that it comes into focus and actions can be
28
+ * performed against it.
43
29
  */
44
- force?: boolean;
30
+ bringToFront(): void;
45
31
 
46
32
  /**
47
- * If set to `true` and a navigation occurs from performing this action, it
48
- * will not wait for it to complete. Defaults to `false`.
49
- */
50
- noWaitAfter?: boolean;
51
-
52
- /**
53
- * A point to use relative to the top left corner of the element. If not
54
- * supplied, a visible point of the element is used.
55
- */
56
- position?: {
57
- x: number;
58
-
59
- y: number;
60
- };
61
-
62
- /**
63
- * When `true`, the call requires selector to resolve to a single element.
64
- * If given selector resolves to more than one element, the call throws
65
- * an exception. Defaults to `false`.
66
- */
67
- strict?: boolean;
68
-
69
- /**
70
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
71
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
72
- * `page` methods.
33
+ * **NOTE** Use locator-based `locator.check([options])` instead.
73
34
  *
74
- * Setting the value to `0` will disable the timeout.
75
- */
76
- timeout?: number;
77
-
78
- /**
79
- * Setting this to `true` will perform the actionability checks without
80
- * performing the action. Useful to wait until the element is ready for the
81
- * action without performing it. Defaults to `false`.
82
- */
83
- trial?: boolean;
84
- }): void;
85
-
86
- /**
87
- * **NOTE** Use locator-based `locator.click([options])` instead.
88
- *
89
- * This method clicks an element matching `selector`.
90
- * @param selector A selector to search for an element. If there are multiple
91
- * elements satisfying the selector, the first will be used.
92
- * @param options
93
- */
94
- click(selector: string, options?: {
95
- /**
96
- * The mouse button (`left`, `middle` or `right`) to use during the action.
97
- * Defaults to `left`.
98
- */
99
- button?: MouseButton;
100
-
101
- /**
102
- * The number of times the action is performed. Defaults to `1`.
103
- */
104
- clickCount?: number;
105
-
106
- /**
107
- * Milliseconds to wait between `mousedown` and `mouseup`. Defaults to `0`.
108
- */
109
- delay?: number;
110
-
111
- /**
112
- * Setting this to `true` will bypass the actionability checks (`visible`,
113
- * `stable`, `enabled`). Defaults to `false`.
114
- */
115
- force?: boolean;
116
-
117
- /**
118
- * `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the
119
- * action. If not specified, currently pressed modifiers are used,
120
- * otherwise defaults to `null`.
121
- */
122
- modifiers?: KeyboardModifier[];
123
-
124
- /**
125
- * If set to `true` and a navigation occurs from performing this action, it
126
- * will not wait for it to complete. Defaults to `false`.
127
- */
128
- noWaitAfter?: boolean;
129
-
130
- /**
131
- * A point to use relative to the top left corner of the element. If not
132
- * supplied, a visible point of the element is used.
133
- */
134
- position?: {
135
- x: number;
136
-
137
- y: number;
138
- };
139
-
140
- /**
141
- * When `true`, the call requires selector to resolve to a single element.
142
- * If given selector resolves to more than one element, the call throws
143
- * an exception. Defaults to `false`.
144
- */
145
- strict?: boolean;
146
-
147
- /**
148
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
149
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
150
- * `page` methods.
35
+ * This method is used to select an input checkbox.
36
+ * @param selector A selector to search for an element. If there are multiple
37
+ * elements satisfying the selector, the first will be used.
38
+ * @param options
39
+ */
40
+ check(
41
+ selector: string,
42
+ options?: {
43
+ /**
44
+ * Setting this to `true` will bypass the actionability checks (visible,
45
+ * stable, enabled). Defaults to `false`.
46
+ */
47
+ force?: boolean;
48
+
49
+ /**
50
+ * If set to `true` and a navigation occurs from performing this action, it
51
+ * will not wait for it to complete. Defaults to `false`.
52
+ */
53
+ noWaitAfter?: boolean;
54
+
55
+ /**
56
+ * A point to use relative to the top left corner of the element. If not
57
+ * supplied, a visible point of the element is used.
58
+ */
59
+ position?: {
60
+ x: number;
61
+
62
+ y: number;
63
+ };
64
+
65
+ /**
66
+ * When `true`, the call requires selector to resolve to a single element.
67
+ * If given selector resolves to more than one element, the call throws
68
+ * an exception. Defaults to `false`.
69
+ */
70
+ strict?: boolean;
71
+
72
+ /**
73
+ * Maximum time in milliseconds. Defaults to `30` seconds. Default is
74
+ * overridden by the `setDefaultTimeout` option on `BrowserContext` or
75
+ * `page` methods.
76
+ *
77
+ * Setting the value to `0` will disable the timeout.
78
+ */
79
+ timeout?: number;
80
+
81
+ /**
82
+ * Setting this to `true` will perform the actionability checks without
83
+ * performing the action. Useful to wait until the element is ready for the
84
+ * action without performing it. Defaults to `false`.
85
+ */
86
+ trial?: boolean;
87
+ },
88
+ ): void;
89
+
90
+ /**
91
+ * **NOTE** Use locator-based `locator.click([options])` instead.
151
92
  *
152
- * Setting the value to `0` will disable the timeout.
153
- */
154
- timeout?: number;
155
-
156
- /**
157
- * Setting this to `true` will perform the actionability checks without
158
- * performing the action. Useful to wait until the element is ready for the
159
- * action without performing it. Defaults to `false`.
160
- */
161
- trial?: boolean;
162
- }): Promise<void>;
163
-
164
- /**
165
- * This will close the tab that this page is associated with.
166
- */
167
- close(): void;
168
-
169
- /**
170
- * Gets the HTML contents of the page.
171
- */
172
- content(): string;
173
-
174
- /**
175
- * Gets the `BrowserContext` that the page belongs to.
176
- */
177
- context(): BrowserContext;
178
-
179
- /**
180
- * **NOTE** Use locator-based `locator.dblclick([options])` instead.
181
- *
182
- * Mouse double clicks an element matching provided selector.
183
- * @param selector A selector to search for an element. If there are multiple
184
- * elements satisfying the selector, the first will be used.
185
- * @param options
186
- */
187
- dblclick(selector: string, options?: {
188
- /**
189
- * The mouse button (`left`, `middle` or `right`) to use during the action.
190
- * Defaults to `left`.
191
- */
192
- button?: MouseButton;
193
-
194
- /**
195
- * Milliseconds to wait between `mousedown` and `mouseup`. Defaults to `0`.
196
- */
197
- delay?: number;
198
-
199
- /**
200
- * Setting this to `true` will bypass the actionability checks (`visible`,
201
- * `stable`, `enabled`). Defaults to `false`.
202
- */
203
- force?: boolean;
204
-
205
- /**
206
- * `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the
207
- * action. If not specified, currently pressed modifiers are used,
208
- * otherwise defaults to `null`.
209
- */
210
- modifiers?: KeyboardModifier[];
211
-
212
- /**
213
- * If set to `true` and a navigation occurs from performing this action, it
214
- * will not wait for it to complete. Defaults to `false`.
215
- */
216
- noWaitAfter?: boolean;
217
-
218
- /**
219
- * A point to use relative to the top left corner of the element. If not
220
- * supplied, a visible point of the element is used.
221
- */
222
- position?: {
223
- x: number;
224
-
225
- y: number;
226
- };
227
-
228
- /**
229
- * When `true`, the call requires selector to resolve to a single element.
230
- * If given selector resolves to more than one element, the call throws
231
- * an exception. Defaults to `false`.
232
- */
233
- strict?: boolean;
234
-
235
- /**
236
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
237
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
238
- * `page` methods.
93
+ * This method clicks an element matching `selector`.
94
+ * @param selector A selector to search for an element. If there are multiple
95
+ * elements satisfying the selector, the first will be used.
96
+ * @param options
97
+ */
98
+ click(
99
+ selector: string,
100
+ options?: {
101
+ /**
102
+ * The mouse button (`left`, `middle` or `right`) to use during the action.
103
+ * Defaults to `left`.
104
+ */
105
+ button?: MouseButton;
106
+
107
+ /**
108
+ * The number of times the action is performed. Defaults to `1`.
109
+ */
110
+ clickCount?: number;
111
+
112
+ /**
113
+ * Milliseconds to wait between `mousedown` and `mouseup`. Defaults to `0`.
114
+ */
115
+ delay?: number;
116
+
117
+ /**
118
+ * Setting this to `true` will bypass the actionability checks (`visible`,
119
+ * `stable`, `enabled`). Defaults to `false`.
120
+ */
121
+ force?: boolean;
122
+
123
+ /**
124
+ * `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the
125
+ * action. If not specified, currently pressed modifiers are used,
126
+ * otherwise defaults to `null`.
127
+ */
128
+ modifiers?: KeyboardModifier[];
129
+
130
+ /**
131
+ * If set to `true` and a navigation occurs from performing this action, it
132
+ * will not wait for it to complete. Defaults to `false`.
133
+ */
134
+ noWaitAfter?: boolean;
135
+
136
+ /**
137
+ * A point to use relative to the top left corner of the element. If not
138
+ * supplied, a visible point of the element is used.
139
+ */
140
+ position?: {
141
+ x: number;
142
+
143
+ y: number;
144
+ };
145
+
146
+ /**
147
+ * When `true`, the call requires selector to resolve to a single element.
148
+ * If given selector resolves to more than one element, the call throws
149
+ * an exception. Defaults to `false`.
150
+ */
151
+ strict?: boolean;
152
+
153
+ /**
154
+ * Maximum time in milliseconds. Defaults to `30` seconds. Default is
155
+ * overridden by the `setDefaultTimeout` option on `BrowserContext` or
156
+ * `page` methods.
157
+ *
158
+ * Setting the value to `0` will disable the timeout.
159
+ */
160
+ timeout?: number;
161
+
162
+ /**
163
+ * Setting this to `true` will perform the actionability checks without
164
+ * performing the action. Useful to wait until the element is ready for the
165
+ * action without performing it. Defaults to `false`.
166
+ */
167
+ trial?: boolean;
168
+ },
169
+ ): Promise<void>;
170
+
171
+ /**
172
+ * This will close the tab that this page is associated with.
173
+ */
174
+ close(): void;
175
+
176
+ /**
177
+ * Gets the HTML contents of the page.
178
+ */
179
+ content(): string;
180
+
181
+ /**
182
+ * Gets the `BrowserContext` that the page belongs to.
183
+ */
184
+ context(): BrowserContext;
185
+
186
+ /**
187
+ * **NOTE** Use locator-based `locator.dblclick([options])` instead.
239
188
  *
240
- * Setting the value to `0` will disable the timeout.
241
- */
242
- timeout?: number;
243
-
244
- /**
245
- * Setting this to `true` will perform the actionability checks without
246
- * performing the action. Useful to wait until the element is ready for the
247
- * action without performing it. Defaults to `false`.
248
- */
249
- trial?: boolean;
250
- }): void;
251
-
252
- /**
253
- * **NOTE** Use locator-based locator.dispatchEvent([options]) instead.
254
- *
255
- * @param selector A selector to search for an element. If there are multiple
256
- * elements satisfying the selector, the first will be used.
257
- * @param type DOM event type: `"click"` etc.
258
- * @param eventInit Optional event-specific initialization properties.
259
- * @param options
260
- */
261
- dispatchEvent(selector: string, type: string, eventInit?: EvaluationArgument, options?: {
262
- /**
263
- * When `true`, the call requires selector to resolve to a single element.
264
- * If given selector resolves to more than one element, the call throws
265
- * an exception. Defaults to `false`.
266
- */
267
- strict?: boolean;
268
-
269
- /**
270
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
271
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
272
- * `page` methods.
189
+ * Mouse double clicks an element matching provided selector.
190
+ * @param selector A selector to search for an element. If there are multiple
191
+ * elements satisfying the selector, the first will be used.
192
+ * @param options
193
+ */
194
+ dblclick(
195
+ selector: string,
196
+ options?: {
197
+ /**
198
+ * The mouse button (`left`, `middle` or `right`) to use during the action.
199
+ * Defaults to `left`.
200
+ */
201
+ button?: MouseButton;
202
+
203
+ /**
204
+ * Milliseconds to wait between `mousedown` and `mouseup`. Defaults to `0`.
205
+ */
206
+ delay?: number;
207
+
208
+ /**
209
+ * Setting this to `true` will bypass the actionability checks (`visible`,
210
+ * `stable`, `enabled`). Defaults to `false`.
211
+ */
212
+ force?: boolean;
213
+
214
+ /**
215
+ * `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the
216
+ * action. If not specified, currently pressed modifiers are used,
217
+ * otherwise defaults to `null`.
218
+ */
219
+ modifiers?: KeyboardModifier[];
220
+
221
+ /**
222
+ * If set to `true` and a navigation occurs from performing this action, it
223
+ * will not wait for it to complete. Defaults to `false`.
224
+ */
225
+ noWaitAfter?: boolean;
226
+
227
+ /**
228
+ * A point to use relative to the top left corner of the element. If not
229
+ * supplied, a visible point of the element is used.
230
+ */
231
+ position?: {
232
+ x: number;
233
+
234
+ y: number;
235
+ };
236
+
237
+ /**
238
+ * When `true`, the call requires selector to resolve to a single element.
239
+ * If given selector resolves to more than one element, the call throws
240
+ * an exception. Defaults to `false`.
241
+ */
242
+ strict?: boolean;
243
+
244
+ /**
245
+ * Maximum time in milliseconds. Defaults to `30` seconds. Default is
246
+ * overridden by the `setDefaultTimeout` option on `BrowserContext` or
247
+ * `page` methods.
248
+ *
249
+ * Setting the value to `0` will disable the timeout.
250
+ */
251
+ timeout?: number;
252
+
253
+ /**
254
+ * Setting this to `true` will perform the actionability checks without
255
+ * performing the action. Useful to wait until the element is ready for the
256
+ * action without performing it. Defaults to `false`.
257
+ */
258
+ trial?: boolean;
259
+ },
260
+ ): void;
261
+
262
+ /**
263
+ * **NOTE** Use locator-based locator.dispatchEvent([options]) instead.
273
264
  *
274
- * Setting the value to `0` will disable the timeout.
275
- */
276
- timeout?: number;
277
- }): void;
278
-
279
- /**
280
- * This method changes the `CSS media type` through the `media` argument,
281
- * and/or the `'prefers-colors-scheme'` media feature, using the `colorScheme`
282
- * argument.
283
- * @param options
284
- */
285
- emulateMedia(options?: {
286
- /**
287
- * Emulates `'prefers-colors-scheme'` media feature, supported values are
288
- * `'light'`, `'dark'`, and `'no-preference'`.
289
- */
290
- colorScheme?: "light"|"dark"|"no-preference";
291
-
292
- /**
293
- * Changes the CSS media type of the page. The only allowed values are
294
- * `'screen'`, and `'print'`.
295
- */
296
- media?: "screen"|"print";
297
-
298
- /**
299
- * Emulates `'prefers-reduced-motion'` media feature, supported values are
300
- * `'reduce'`, `'no-preference'`.
301
- */
302
- reducedMotion?: "reduce"|"no-preference";
303
- }): void;
304
-
305
- /**
306
- * This emulates your website with the specified vision deficiency type.
307
- * The supported types are:
308
- * - none: default.
309
- * - blurredVision: where vision is less precise.
310
- * - protanopia: the inability to perceive any red light.
311
- * - deuteranopia: the inability to perceive any green light.
312
- * - tritanopia: the inability to perceive any blue light.
313
- * - achromatopsia: the inability to perceive any color except for shades of
314
- * grey (extremely rare).
315
- * @param type
316
- */
317
- emulateVisionDeficiency(
318
- type: "none"|"blurredVision"|"deuteranopia"|"protanopia"|"tritanopia"|"achromatopsia"
319
- ): void;
320
-
321
- /**
322
- * Returns the value of the `pageFunction` invocation.
323
- *
324
- * A string can also be passed in instead of a function.
325
- *
326
- * @param pageFunction Function to be evaluated in the page context.
327
- * @param arg Optional argument to pass to `pageFunction`.
328
- */
329
- evaluate<R, Arg>(pageFunction: PageFunction<Arg, R>, arg?: Arg): R;
330
-
331
- /**
332
- * Returns the value of the `pageFunction` invocation as a [JSHandle].
333
- *
334
- * The only difference between page.evaluate(pageFunction[, arg]) and
335
- * page.evaluateHandle(pageFunction[, arg]) is that
336
- * page.evaluateHandle(pageFunction[, arg])returns [JSHandle].
337
- *
338
- * @param pageFunction Function to be evaluated in the page context.
339
- * @param arg Optional argument to pass to `pageFunction`.
340
- */
341
- evaluateHandle<R, Arg>(pageFunction: PageFunction<Arg, R>, arg?: Arg): JSHandle<R>;
342
-
343
- /**
344
- * **NOTE** Use locator-based `locator.fill(value[, options])` instead.
345
- *
346
- * Fill an `input`, `textarea` or `[contenteditable]` element with the
347
- * provided value.
348
- *
349
- * @param selector A selector to search for an element. If there are multiple
350
- * elements satisfying the selector, the first will be used.
351
- * @param value Value to fill for the `<input>`, `<textarea>` or
352
- * `[contenteditable]` element.
353
- * @param options
354
- */
355
- fill(selector: string, value: string, options?: {
356
- /**
357
- * Setting this to `true` will bypass the actionability checks (`visible`,
358
- * `stable`, `enabled`). Defaults to `false`.
359
- */
360
- force?: boolean;
361
-
362
- /**
363
- * If set to `true` and a navigation occurs from performing this action, it
364
- * will not wait for it to complete. Defaults to `false`.
365
- */
366
- noWaitAfter?: boolean;
367
-
368
- /**
369
- * When `true`, the call requires selector to resolve to a single element.
370
- * If given selector resolves to more than one element, the call throws
371
- * an exception. Defaults to `false`.
372
- */
373
- strict?: boolean;
374
-
375
- /**
376
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
377
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
378
- * `page` methods.
265
+ * @param selector A selector to search for an element. If there are multiple
266
+ * elements satisfying the selector, the first will be used.
267
+ * @param type DOM event type: `"click"` etc.
268
+ * @param eventInit Optional event-specific initialization properties.
269
+ * @param options
270
+ */
271
+ dispatchEvent(
272
+ selector: string,
273
+ type: string,
274
+ eventInit?: EvaluationArgument,
275
+ options?: {
276
+ /**
277
+ * When `true`, the call requires selector to resolve to a single element.
278
+ * If given selector resolves to more than one element, the call throws
279
+ * an exception. Defaults to `false`.
280
+ */
281
+ strict?: boolean;
282
+
283
+ /**
284
+ * Maximum time in milliseconds. Defaults to `30` seconds. Default is
285
+ * overridden by the `setDefaultTimeout` option on `BrowserContext` or
286
+ * `page` methods.
287
+ *
288
+ * Setting the value to `0` will disable the timeout.
289
+ */
290
+ timeout?: number;
291
+ },
292
+ ): void;
293
+
294
+ /**
295
+ * This method changes the `CSS media type` through the `media` argument,
296
+ * and/or the `'prefers-colors-scheme'` media feature, using the `colorScheme`
297
+ * argument.
298
+ * @param options
299
+ */
300
+ emulateMedia(options?: {
301
+ /**
302
+ * Emulates `'prefers-colors-scheme'` media feature, supported values are
303
+ * `'light'`, `'dark'`, and `'no-preference'`.
304
+ */
305
+ colorScheme?: 'light' | 'dark' | 'no-preference';
306
+
307
+ /**
308
+ * Changes the CSS media type of the page. The only allowed values are
309
+ * `'screen'`, and `'print'`.
310
+ */
311
+ media?: 'screen' | 'print';
312
+
313
+ /**
314
+ * Emulates `'prefers-reduced-motion'` media feature, supported values are
315
+ * `'reduce'`, `'no-preference'`.
316
+ */
317
+ reducedMotion?: 'reduce' | 'no-preference';
318
+ }): void;
319
+
320
+ /**
321
+ * This emulates your website with the specified vision deficiency type.
322
+ * The supported types are:
323
+ * - none: default.
324
+ * - blurredVision: where vision is less precise.
325
+ * - protanopia: the inability to perceive any red light.
326
+ * - deuteranopia: the inability to perceive any green light.
327
+ * - tritanopia: the inability to perceive any blue light.
328
+ * - achromatopsia: the inability to perceive any color except for shades of
329
+ * grey (extremely rare).
330
+ * @param type
331
+ */
332
+ emulateVisionDeficiency(
333
+ type: 'none' | 'blurredVision' | 'deuteranopia' | 'protanopia' | 'tritanopia' | 'achromatopsia',
334
+ ): void;
335
+
336
+ /**
337
+ * Returns the value of the `pageFunction` invocation.
379
338
  *
380
- * Setting the value to `0` will disable the timeout.
381
- */
382
- timeout?: number;
383
- }): void;
384
-
385
- /**
386
- * **NOTE** Use locator-based `locator.focus([options])` instead.
387
- *
388
- * This method fetches an element with `selector` and focuses it.
389
- *
390
- * @param selector A selector to search for an element. If there are multiple
391
- * elements satisfying the selector, the first will be used.
392
- * @param options
393
- */
394
- focus(selector: string, options?: {
395
- /**
396
- * When `true`, the call requires selector to resolve to a single element.
397
- * If given selector resolves to more than one element, the call throws
398
- * an exception. Defaults to `false`.
399
- */
400
- strict?: boolean;
401
-
402
- /**
403
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
404
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
405
- * `page` methods.
339
+ * A string can also be passed in instead of a function.
406
340
  *
407
- * Setting the value to `0` will disable the timeout.
341
+ * @param pageFunction Function to be evaluated in the page context.
342
+ * @param arg Optional argument to pass to `pageFunction`.
408
343
  */
409
- timeout?: number;
410
- }): void;
411
-
412
- /**
413
- * Frames returns an array of frames on the page.
414
- */
415
- frames(): Frame[];
416
-
417
- /**
418
- * **NOTE** Use locator-based locator.getAttribute(name[, options]) instead.
419
- *
420
- * Returns the element attribute value for the given attribute name.
421
- *
422
- * @param selector A selector to search for an element. If there are multiple
423
- * elements satisfying the selector, the first will be used.
424
- * @param name Attribute name to get the value for.
425
- * @param options
426
- */
427
- getAttribute(selector: string, name: string, options?: {
428
- /**
429
- * When `true`, the call requires selector to resolve to a single element.
430
- * If given selector resolves to more than one element, the call throws
431
- * an exception. Defaults to `false`.
432
- */
433
- strict?: boolean;
344
+ evaluate<R, Arg>(pageFunction: PageFunction<Arg, R>, arg?: Arg): R;
434
345
 
435
346
  /**
436
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
437
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
438
- * `page` methods.
347
+ * Returns the value of the `pageFunction` invocation as a [JSHandle].
439
348
  *
440
- * Setting the value to `0` will disable the timeout.
441
- */
442
- timeout?: number;
443
- }): null|string;
444
-
445
- /**
446
- * Navigates to the specified url and returns the main resource response.
447
- *
448
- * navigating to `about:blank` or navigation to the same URL with a different
449
- * hash, will succeed and return `null`.
450
- *
451
- * @param url URL to navigate page to. The url should include scheme, e.g.
452
- * `https://`.
453
- * @param options
454
- */
455
- goto(url: string, options?: NavigationOptions): Promise<null|Response>;
456
-
457
- /**
458
- * **NOTE** Use locator-based locator.hover([options]) instead.
459
- *
460
- * This method hovers over an element matching `selector`.
461
- *
462
- * @param selector A selector to search for an element. If there are multiple
463
- * elements satisfying the selector, the first will be used.
464
- * @param options
465
- */
466
- hover(selector: string, options?: {
467
- /**
468
- * Setting this to `true` will bypass the actionability checks (`visible`,
469
- * `stable`, `enabled`). Defaults to `false`.
470
- */
471
- force?: boolean;
472
-
473
- /**
474
- * `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the
475
- * action. If not specified, currently pressed modifiers are used,
476
- * otherwise defaults to `null`.
477
- */
478
- modifiers?: KeyboardModifier[];
479
-
480
- /**
481
- * If set to `true` and a navigation occurs from performing this action, it
482
- * will not wait for it to complete. Defaults to `false`.
483
- */
484
- noWaitAfter?: boolean;
485
-
486
- /**
487
- * A point to use relative to the top left corner of the element. If not
488
- * supplied, a visible point of the element is used.
489
- */
490
- position?: {
491
- x: number;
492
-
493
- y: number;
494
- };
495
-
496
- /**
497
- * When `true`, the call requires selector to resolve to a single element.
498
- * If given selector resolves to more than one element, the call throws
499
- * an exception. Defaults to `false`.
500
- */
501
- strict?: boolean;
502
-
503
- /**
504
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
505
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
506
- * `page` methods.
349
+ * The only difference between page.evaluate(pageFunction[, arg]) and
350
+ * page.evaluateHandle(pageFunction[, arg]) is that
351
+ * page.evaluateHandle(pageFunction[, arg])returns [JSHandle].
507
352
  *
508
- * Setting the value to `0` will disable the timeout.
353
+ * @param pageFunction Function to be evaluated in the page context.
354
+ * @param arg Optional argument to pass to `pageFunction`.
509
355
  */
510
- timeout?: number;
356
+ evaluateHandle<R, Arg>(pageFunction: PageFunction<Arg, R>, arg?: Arg): JSHandle<R>;
511
357
 
512
358
  /**
513
- * Setting this to `true` will perform the actionability checks without
514
- * performing the action. Useful to wait until the element is ready for the
515
- * action without performing it. Defaults to `false`.
516
- */
517
- trial?: boolean;
518
- }): void;
519
-
520
- /**
521
- * **NOTE** Use locator-based locator.innerHTML([options]) instead.
522
- *
523
- * Returns `element.innerHTML`.
524
- *
525
- * @param selector A selector to search for an element. If there are multiple
526
- * elements satisfying the selector, the first will be used.
527
- * @param options
528
- */
529
- innerHTML(selector: string, options?: {
530
- /**
531
- * When `true`, the call requires selector to resolve to a single element.
532
- * If given selector resolves to more than one element, the call throws
533
- * an exception. Defaults to `false`.
534
- */
535
- strict?: boolean;
536
-
537
- /**
538
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
539
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
540
- * `page` methods.
359
+ * **NOTE** Use locator-based `locator.fill(value[, options])` instead.
541
360
  *
542
- * Setting the value to `0` will disable the timeout.
543
- */
544
- timeout?: number;
545
- }): string;
546
-
547
- /**
548
- * **NOTE** Use locator-based locator.innerText([options]) instead.
549
- *
550
- * Returns `element.innerText`.
551
- *
552
- * @param selector A selector to search for an element. If there are multiple
553
- * elements satisfying the selector, the first will be used.
554
- * @param options
555
- */
556
- innerText(selector: string, options?: {
557
- /**
558
- * When `true`, the call requires selector to resolve to a single element.
559
- * If given selector resolves to more than one element, the call throws
560
- * an exception. Defaults to `false`.
561
- */
562
- strict?: boolean;
563
-
564
- /**
565
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
566
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
567
- * `page` methods.
361
+ * Fill an `input`, `textarea` or `[contenteditable]` element with the
362
+ * provided value.
568
363
  *
569
- * Setting the value to `0` will disable the timeout.
570
- */
571
- timeout?: number;
572
- }): string;
573
-
574
- /**
575
- * **NOTE** Use locator-based locator.inputValue([options]) instead.
576
- *
577
- * Returns `input.value` for the selected `<input>` or `<textarea>` or
578
- * `<select>` element.
579
- *
580
- * @param selector A selector to search for an element. If there are multiple
581
- * elements satisfying the selector, the first will be used.
582
- * @param options
583
- */
584
- inputValue(selector: string, options?: {
585
- /**
586
- * When `true`, the call requires selector to resolve to a single element.
587
- * If given selector resolves to more than one element, the call throws
588
- * an exception. Defaults to `false`.
589
- */
590
- strict?: boolean;
591
-
592
- /**
593
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
594
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
595
- * `page` methods.
364
+ * @param selector A selector to search for an element. If there are multiple
365
+ * elements satisfying the selector, the first will be used.
366
+ * @param value Value to fill for the `<input>`, `<textarea>` or
367
+ * `[contenteditable]` element.
368
+ * @param options
369
+ */
370
+ fill(
371
+ selector: string,
372
+ value: string,
373
+ options?: {
374
+ /**
375
+ * Setting this to `true` will bypass the actionability checks (`visible`,
376
+ * `stable`, `enabled`). Defaults to `false`.
377
+ */
378
+ force?: boolean;
379
+
380
+ /**
381
+ * If set to `true` and a navigation occurs from performing this action, it
382
+ * will not wait for it to complete. Defaults to `false`.
383
+ */
384
+ noWaitAfter?: boolean;
385
+
386
+ /**
387
+ * When `true`, the call requires selector to resolve to a single element.
388
+ * If given selector resolves to more than one element, the call throws
389
+ * an exception. Defaults to `false`.
390
+ */
391
+ strict?: boolean;
392
+
393
+ /**
394
+ * Maximum time in milliseconds. Defaults to `30` seconds. Default is
395
+ * overridden by the `setDefaultTimeout` option on `BrowserContext` or
396
+ * `page` methods.
397
+ *
398
+ * Setting the value to `0` will disable the timeout.
399
+ */
400
+ timeout?: number;
401
+ },
402
+ ): void;
403
+
404
+ /**
405
+ * **NOTE** Use locator-based `locator.focus([options])` instead.
596
406
  *
597
- * Setting the value to `0` will disable the timeout.
598
- */
599
- timeout?: number;
600
- }): string;
601
-
602
- /**
603
- * **NOTE** Use locator-based locator.isChecked([options]) instead.
604
- *
605
- * Checks to see if the `checkbox` `input` type is selected or not.
606
- *
607
- * @param selector A selector to search for an element. If there are multiple
608
- * elements satisfying the selector, the first will be used.
609
- * @param options
610
- */
611
- isChecked(selector: string, options?: {
612
- /**
613
- * When `true`, the call requires selector to resolve to a single element.
614
- * If given selector resolves to more than one element, the call throws
615
- * an exception. Defaults to `false`.
616
- */
617
- strict?: boolean;
618
-
619
- /**
620
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
621
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
622
- * `page` methods.
407
+ * This method fetches an element with `selector` and focuses it.
623
408
  *
624
- * Setting the value to `0` will disable the timeout.
625
- */
626
- timeout?: number;
627
- }): boolean;
628
-
629
- /**
630
- * Indicates that the page has been closed.
631
- */
632
- isClosed(): boolean;
633
-
634
- /**
635
- * **NOTE** Use locator-based locator.isDisabled([options]) instead.
636
- *
637
- * Returns whether the element is disabled.
638
- *
639
- * @param selector A selector to search for an element. If there are multiple
640
- * elements satisfying the selector, the first will be used.
641
- * @param options
642
- */
643
- isDisabled(selector: string, options?: {
644
- /**
645
- * When `true`, the call requires selector to resolve to a single element.
646
- * If given selector resolves to more than one element, the call throws
647
- * an exception. Defaults to `false`.
648
- */
649
- strict?: boolean;
650
-
651
- /**
652
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
653
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
654
- * `page` methods.
409
+ * @param selector A selector to search for an element. If there are multiple
410
+ * elements satisfying the selector, the first will be used.
411
+ * @param options
412
+ */
413
+ focus(
414
+ selector: string,
415
+ options?: {
416
+ /**
417
+ * When `true`, the call requires selector to resolve to a single element.
418
+ * If given selector resolves to more than one element, the call throws
419
+ * an exception. Defaults to `false`.
420
+ */
421
+ strict?: boolean;
422
+
423
+ /**
424
+ * Maximum time in milliseconds. Defaults to `30` seconds. Default is
425
+ * overridden by the `setDefaultTimeout` option on `BrowserContext` or
426
+ * `page` methods.
427
+ *
428
+ * Setting the value to `0` will disable the timeout.
429
+ */
430
+ timeout?: number;
431
+ },
432
+ ): void;
433
+
434
+ /**
435
+ * Frames returns an array of frames on the page.
436
+ */
437
+ frames(): Frame[];
438
+
439
+ /**
440
+ * **NOTE** Use locator-based locator.getAttribute(name[, options]) instead.
655
441
  *
656
- * Setting the value to `0` will disable the timeout.
657
- */
658
- timeout?: number;
659
- }): boolean;
660
-
661
- /**
662
- * **NOTE** Use locator-based locator.isEditable([options]) instead.
663
- *
664
- * Returns whether the element is editable.
665
- *
666
- * @param selector A selector to search for an element. If there are multiple
667
- * elements satisfying the selector, the first will be used.
668
- * @param options
669
- */
670
- isEditable(selector: string, options?: {
671
- /**
672
- * When `true`, the call requires selector to resolve to a single element.
673
- * If given selector resolves to more than one element, the call throws
674
- * an exception. Defaults to `false`.
675
- */
676
- strict?: boolean;
677
-
678
- /**
679
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
680
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
681
- * `page` methods.
442
+ * Returns the element attribute value for the given attribute name.
682
443
  *
683
- * Setting the value to `0` will disable the timeout.
684
- */
685
- timeout?: number;
686
- }): boolean;
687
-
688
- /**
689
- * **NOTE** Use locator-based locator.isEnabled([options]) instead.
690
- *
691
- * Returns whether the element is enabled.
692
- *
693
- * @param selector A selector to search for an element. If there are multiple
694
- * elements satisfying the selector, the first will be used.
695
- * @param options
696
- */
697
- isEnabled(selector: string, options?: {
698
- /**
699
- * When `true`, the call requires selector to resolve to a single element.
700
- * If given selector resolves to more than one element, the call throws
701
- * an exception. Defaults to `false`.
702
- */
703
- strict?: boolean;
704
-
705
- /**
706
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
707
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
708
- * `page` methods.
444
+ * @param selector A selector to search for an element. If there are multiple
445
+ * elements satisfying the selector, the first will be used.
446
+ * @param name Attribute name to get the value for.
447
+ * @param options
448
+ */
449
+ getAttribute(
450
+ selector: string,
451
+ name: string,
452
+ options?: {
453
+ /**
454
+ * When `true`, the call requires selector to resolve to a single element.
455
+ * If given selector resolves to more than one element, the call throws
456
+ * an exception. Defaults to `false`.
457
+ */
458
+ strict?: boolean;
459
+
460
+ /**
461
+ * Maximum time in milliseconds. Defaults to `30` seconds. Default is
462
+ * overridden by the `setDefaultTimeout` option on `BrowserContext` or
463
+ * `page` methods.
464
+ *
465
+ * Setting the value to `0` will disable the timeout.
466
+ */
467
+ timeout?: number;
468
+ },
469
+ ): null | string;
470
+
471
+ /**
472
+ * Navigates to the specified url and returns the main resource response.
709
473
  *
710
- * Setting the value to `0` will disable the timeout.
711
- */
712
- timeout?: number;
713
- }): boolean;
714
-
715
- /**
716
- * **NOTE** Use locator-based locator.isHidden([options]) instead.
717
- *
718
- * Returns whether the element is hidden.
719
- *
720
- * @param selector A selector to search for an element. If there are multiple
721
- * elements satisfying the selector, the first will be used.
722
- * @param options
723
- */
724
- isHidden(selector: string, options?: {
725
- /**
726
- * When `true`, the call requires selector to resolve to a single element.
727
- * If given selector resolves to more than one element, the call throws
728
- * an exception. Defaults to `false`.
729
- */
730
- strict?: boolean;
731
-
732
- /**
733
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
734
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
735
- * `page` methods.
474
+ * navigating to `about:blank` or navigation to the same URL with a different
475
+ * hash, will succeed and return `null`.
736
476
  *
737
- * Setting the value to `0` will disable the timeout.
477
+ * @param url URL to navigate page to. The url should include scheme, e.g.
478
+ * `https://`.
479
+ * @param options
738
480
  */
739
- timeout?: number;
740
- }): boolean;
741
-
742
- /**
743
- * **NOTE** Use locator-based locator.isVisible([options]) instead.
744
- *
745
- * Returns whether the element is visible.
746
- *
747
- * @param selector A selector to search for an element. If there are multiple
748
- * elements satisfying the selector, the first will be used.
749
- * @param options
750
- */
751
- isVisible(selector: string, options?: {
752
- /**
753
- * When `true`, the call requires selector to resolve to a single element.
754
- * If given selector resolves to more than one element, the call throws
755
- * an exception. Defaults to `false`.
756
- */
757
- strict?: boolean;
481
+ goto(url: string, options?: NavigationOptions): Promise<null | Response>;
758
482
 
759
483
  /**
760
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
761
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
762
- * `page` methods.
484
+ * **NOTE** Use locator-based locator.hover([options]) instead.
763
485
  *
764
- * Setting the value to `0` will disable the timeout.
765
- */
766
- timeout?: number;
767
- }): boolean;
768
-
769
- /**
770
- * Returns the keyboard instance to interact with a virtual keyboard on the
771
- * page.
772
- */
773
- keyboard: Keyboard;
774
-
775
- /**
776
- * The method returns an element locator. Locators resolve to the element
777
- * when the action takes place, which means locators can span over navigations
778
- * where the underlying dom changes.
779
- *
780
- * @param selector A selector to use when resolving DOM element.
781
- */
782
- locator(selector: string): Locator;
783
-
784
- /**
785
- * The page's main frame. Page is made up of frames in a hierarchical. At the
786
- * top is mainFrame. A page is guaranteed to have a mainFrame.
787
- */
788
- mainFrame(): Frame;
789
-
790
- /**
791
- * Returns the mouse instance to interact with a virtual mouse on the page.
792
- */
793
- mouse: Mouse;
794
-
795
- /**
796
- * Returns the page that opened the current page. The first page that is
797
- * navigated to will have a null opener.
798
- */
799
- opener(): Page | null;
800
-
801
- /**
802
- * **NOTE** Use locator-based locator.press(key[, options]) instead.
803
- *
804
- * Focuses the element, and then uses keyboard.down(key) and
805
- * keyboard.up(key).
806
- *
807
- * A superset of the `key` values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values).
808
- *
809
- * Following modification shortcuts are also supported: `Shift`, `Control`,
810
- * `Alt`, `Meta`, `ShiftLeft`.
811
- *
812
- * Holding down `Shift` will type the text that corresponds to the `key` in
813
- * the upper case.
814
- *
815
- * If `key` is a single character, it is case-sensitive, so the values `a`
816
- * and `A` will generate different respective texts.
817
- *
818
- * Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are
819
- * supported as well. When specified with the modifier, modifier is pressed
820
- * and being held while the subsequent key is being pressed.
821
- *
822
- * @param selector A selector to search for an element. If there are multiple
823
- * elements satisfying the selector, the first will be used.
824
- * @param key Name of the key to press or a character to generate, such as
825
- * `ArrowLeft` or `a`.
826
- * @param options
827
- */
828
- press(selector: string, key: string, options?: {
829
- /**
830
- * Milliseconds to wait between `mousedown` and `mouseup`. Defaults to `0`.
831
- */
832
- delay?: number;
833
-
834
- /**
835
- * If set to `true` and a navigation occurs from performing this action, it
836
- * will not wait for it to complete. Defaults to `false`.
837
- */
838
- noWaitAfter?: boolean;
839
-
840
- /**
841
- * When `true`, the call requires selector to resolve to a single element.
842
- * If given selector resolves to more than one element, the call throws
843
- * an exception. Defaults to `false`.
844
- */
845
- strict?: boolean;
846
-
847
- /**
848
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
849
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
850
- * `page` methods.
486
+ * This method hovers over an element matching `selector`.
851
487
  *
852
- * Setting the value to `0` will disable the timeout.
853
- */
854
- timeout?: number;
855
- }): void;
856
-
857
- /**
858
- * This reloads the current page Returns the main resource response.
859
- *
860
- * @param options
861
- */
862
- reload(options?: {
863
- /**
864
- * Maximum operation time in milliseconds. Defaults to `30` seconds. The
865
- * default value can be changed via the
866
- * browserContext.setDefaultNavigationTimeout(timeout),
867
- * browserContext.setDefaultTimeout(timeout),
868
- * page.setDefaultNavigationTimeout(timeout) or
869
- * page.setDefaultTimeout(timeout) methods.
488
+ * @param selector A selector to search for an element. If there are multiple
489
+ * elements satisfying the selector, the first will be used.
490
+ * @param options
491
+ */
492
+ hover(
493
+ selector: string,
494
+ options?: {
495
+ /**
496
+ * Setting this to `true` will bypass the actionability checks (`visible`,
497
+ * `stable`, `enabled`). Defaults to `false`.
498
+ */
499
+ force?: boolean;
500
+
501
+ /**
502
+ * `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the
503
+ * action. If not specified, currently pressed modifiers are used,
504
+ * otherwise defaults to `null`.
505
+ */
506
+ modifiers?: KeyboardModifier[];
507
+
508
+ /**
509
+ * If set to `true` and a navigation occurs from performing this action, it
510
+ * will not wait for it to complete. Defaults to `false`.
511
+ */
512
+ noWaitAfter?: boolean;
513
+
514
+ /**
515
+ * A point to use relative to the top left corner of the element. If not
516
+ * supplied, a visible point of the element is used.
517
+ */
518
+ position?: {
519
+ x: number;
520
+
521
+ y: number;
522
+ };
523
+
524
+ /**
525
+ * When `true`, the call requires selector to resolve to a single element.
526
+ * If given selector resolves to more than one element, the call throws
527
+ * an exception. Defaults to `false`.
528
+ */
529
+ strict?: boolean;
530
+
531
+ /**
532
+ * Maximum time in milliseconds. Defaults to `30` seconds. Default is
533
+ * overridden by the `setDefaultTimeout` option on `BrowserContext` or
534
+ * `page` methods.
535
+ *
536
+ * Setting the value to `0` will disable the timeout.
537
+ */
538
+ timeout?: number;
539
+
540
+ /**
541
+ * Setting this to `true` will perform the actionability checks without
542
+ * performing the action. Useful to wait until the element is ready for the
543
+ * action without performing it. Defaults to `false`.
544
+ */
545
+ trial?: boolean;
546
+ },
547
+ ): void;
548
+
549
+ /**
550
+ * **NOTE** Use locator-based locator.innerHTML([options]) instead.
870
551
  *
871
- * Setting the value to `0` will disable the timeout.
552
+ * Returns `element.innerHTML`.
872
553
  *
873
- */
874
- timeout?: number;
875
-
876
- /**
877
- * When to consider operation succeeded, defaults to `load`. Events can be
878
- * either:
879
- * - `'domcontentloaded'` - consider operation to be finished when the
880
- * `DOMContentLoaded` event is fired.
881
- * - `'load'` - consider operation to be finished when the `load` event is
882
- * fired.
883
- * - `'networkidle'` - **DISCOURAGED** consider operation to be finished
884
- * when there are no network connections for at least `500` ms. Don't use
885
- * this method for testing especially with chatty websites where the event
886
- * may never fire, rely on web assertions to assess readiness instead.
887
- */
888
- waitUntil?: "load"|"domcontentloaded"|"networkidle";
889
- }): null | Response;
890
-
891
- /**
892
- * Returns the buffer with the captured screenshot from the browser.
893
- *
894
- * @param options
895
- */
896
- screenshot(options?: {
897
- /**
898
- * An object which specifies clipping of the resulting image.
899
- */
900
- clip?: {
901
- /**
902
- * x-coordinate of top-left corner of clip area
903
- */
904
- x: number;
905
-
906
- /**
907
- * y-coordinate of top-left corner of clip area
908
- */
909
- y: number;
910
-
911
- /**
912
- * width of clipping area
913
- */
914
- width: number;
915
-
916
- /**
917
- * height of clipping area
918
- */
919
- height: number;
920
- };
921
-
922
- /**
923
- * When true, takes a screenshot of the full scrollable page, instead of
924
- * the currently visible viewport. Defaults to `false`.
925
- */
926
- fullPage?: boolean;
927
- } & ScreenshotOptions): ArrayBuffer;
928
-
929
- /**
930
- * **NOTE** Use locator-based locator.selectOption(values[, options]) instead.
931
- *
932
- * This select one or more options which match the values from a <select>
933
- * element.
934
- *
935
- * @param selector A selector to search for an element. If there are multiple
936
- * elements satisfying the selector, the first will be used.
937
- * @param values Options to select. If the select has multiple attribute, all
938
- * matching options are selected, otherwise only the first option matching
939
- * one of the passed options is selected. Object can be made up of keys with
940
- * value, label or index.
941
- * @param options
942
- */
943
- selectOption(selector: string, values: string|ElementHandle|SelectOptionsObject|string[]|ElementHandle[]|SelectOptionsObject[], options?: {
944
- /**
945
- * Setting this to `true` will bypass the actionability checks (visible,
946
- * stable, enabled). Defaults to `false`.
947
- */
948
- force?: boolean;
949
-
950
- /**
951
- * If set to `true` and a navigation occurs from performing this action, it
952
- * will not wait for it to complete. Defaults to `false`.
953
- */
954
- noWaitAfter?: boolean;
955
-
956
- /**
957
- * When `true`, the call requires selector to resolve to a single element.
958
- * If given selector resolves to more than one element, the call throws
959
- * an exception. Defaults to `false`.
960
- */
961
- strict?: boolean;
962
-
963
- /**
964
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
965
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
966
- * `page` methods.
554
+ * @param selector A selector to search for an element. If there are multiple
555
+ * elements satisfying the selector, the first will be used.
556
+ * @param options
557
+ */
558
+ innerHTML(
559
+ selector: string,
560
+ options?: {
561
+ /**
562
+ * When `true`, the call requires selector to resolve to a single element.
563
+ * If given selector resolves to more than one element, the call throws
564
+ * an exception. Defaults to `false`.
565
+ */
566
+ strict?: boolean;
567
+
568
+ /**
569
+ * Maximum time in milliseconds. Defaults to `30` seconds. Default is
570
+ * overridden by the `setDefaultTimeout` option on `BrowserContext` or
571
+ * `page` methods.
572
+ *
573
+ * Setting the value to `0` will disable the timeout.
574
+ */
575
+ timeout?: number;
576
+ },
577
+ ): string;
578
+
579
+ /**
580
+ * **NOTE** Use locator-based locator.innerText([options]) instead.
967
581
  *
968
- * Setting the value to `0` will disable the timeout.
969
- */
970
- timeout?: number;
971
- }): string[];
972
-
973
- /**
974
- * Set the supplied html string to the current page.
975
- *
976
- * @param html HTML markup to assign to the page.
977
- * @param options
978
- */
979
- setContent(html: string, options?: {
980
- /**
981
- * Maximum operation time in milliseconds. Defaults to `30` seconds. The
982
- * default value can be changed via the
983
- * browserContext.setDefaultNavigationTimeout(timeout),
984
- * browserContext.setDefaultTimeout(timeout),
985
- * page.setDefaultNavigationTimeout(timeout) or
986
- * page.setDefaultTimeout(timeout) methods.
582
+ * Returns `element.innerText`.
987
583
  *
988
- * Setting the value to `0` will disable the timeout.
584
+ * @param selector A selector to search for an element. If there are multiple
585
+ * elements satisfying the selector, the first will be used.
586
+ * @param options
587
+ */
588
+ innerText(
589
+ selector: string,
590
+ options?: {
591
+ /**
592
+ * When `true`, the call requires selector to resolve to a single element.
593
+ * If given selector resolves to more than one element, the call throws
594
+ * an exception. Defaults to `false`.
595
+ */
596
+ strict?: boolean;
597
+
598
+ /**
599
+ * Maximum time in milliseconds. Defaults to `30` seconds. Default is
600
+ * overridden by the `setDefaultTimeout` option on `BrowserContext` or
601
+ * `page` methods.
602
+ *
603
+ * Setting the value to `0` will disable the timeout.
604
+ */
605
+ timeout?: number;
606
+ },
607
+ ): string;
608
+
609
+ /**
610
+ * **NOTE** Use locator-based locator.inputValue([options]) instead.
989
611
  *
612
+ * Returns `input.value` for the selected `<input>` or `<textarea>` or
613
+ * `<select>` element.
614
+ *
615
+ * @param selector A selector to search for an element. If there are multiple
616
+ * elements satisfying the selector, the first will be used.
617
+ * @param options
618
+ */
619
+ inputValue(
620
+ selector: string,
621
+ options?: {
622
+ /**
623
+ * When `true`, the call requires selector to resolve to a single element.
624
+ * If given selector resolves to more than one element, the call throws
625
+ * an exception. Defaults to `false`.
626
+ */
627
+ strict?: boolean;
628
+
629
+ /**
630
+ * Maximum time in milliseconds. Defaults to `30` seconds. Default is
631
+ * overridden by the `setDefaultTimeout` option on `BrowserContext` or
632
+ * `page` methods.
633
+ *
634
+ * Setting the value to `0` will disable the timeout.
635
+ */
636
+ timeout?: number;
637
+ },
638
+ ): string;
639
+
640
+ /**
641
+ * **NOTE** Use locator-based locator.isChecked([options]) instead.
642
+ *
643
+ * Checks to see if the `checkbox` `input` type is selected or not.
644
+ *
645
+ * @param selector A selector to search for an element. If there are multiple
646
+ * elements satisfying the selector, the first will be used.
647
+ * @param options
648
+ */
649
+ isChecked(
650
+ selector: string,
651
+ options?: {
652
+ /**
653
+ * When `true`, the call requires selector to resolve to a single element.
654
+ * If given selector resolves to more than one element, the call throws
655
+ * an exception. Defaults to `false`.
656
+ */
657
+ strict?: boolean;
658
+
659
+ /**
660
+ * Maximum time in milliseconds. Defaults to `30` seconds. Default is
661
+ * overridden by the `setDefaultTimeout` option on `BrowserContext` or
662
+ * `page` methods.
663
+ *
664
+ * Setting the value to `0` will disable the timeout.
665
+ */
666
+ timeout?: number;
667
+ },
668
+ ): boolean;
669
+
670
+ /**
671
+ * Indicates that the page has been closed.
672
+ */
673
+ isClosed(): boolean;
674
+
675
+ /**
676
+ * **NOTE** Use locator-based locator.isDisabled([options]) instead.
677
+ *
678
+ * Returns whether the element is disabled.
679
+ *
680
+ * @param selector A selector to search for an element. If there are multiple
681
+ * elements satisfying the selector, the first will be used.
682
+ * @param options
683
+ */
684
+ isDisabled(
685
+ selector: string,
686
+ options?: {
687
+ /**
688
+ * When `true`, the call requires selector to resolve to a single element.
689
+ * If given selector resolves to more than one element, the call throws
690
+ * an exception. Defaults to `false`.
691
+ */
692
+ strict?: boolean;
693
+
694
+ /**
695
+ * Maximum time in milliseconds. Defaults to `30` seconds. Default is
696
+ * overridden by the `setDefaultTimeout` option on `BrowserContext` or
697
+ * `page` methods.
698
+ *
699
+ * Setting the value to `0` will disable the timeout.
700
+ */
701
+ timeout?: number;
702
+ },
703
+ ): boolean;
704
+
705
+ /**
706
+ * **NOTE** Use locator-based locator.isEditable([options]) instead.
707
+ *
708
+ * Returns whether the element is editable.
709
+ *
710
+ * @param selector A selector to search for an element. If there are multiple
711
+ * elements satisfying the selector, the first will be used.
712
+ * @param options
713
+ */
714
+ isEditable(
715
+ selector: string,
716
+ options?: {
717
+ /**
718
+ * When `true`, the call requires selector to resolve to a single element.
719
+ * If given selector resolves to more than one element, the call throws
720
+ * an exception. Defaults to `false`.
721
+ */
722
+ strict?: boolean;
723
+
724
+ /**
725
+ * Maximum time in milliseconds. Defaults to `30` seconds. Default is
726
+ * overridden by the `setDefaultTimeout` option on `BrowserContext` or
727
+ * `page` methods.
728
+ *
729
+ * Setting the value to `0` will disable the timeout.
730
+ */
731
+ timeout?: number;
732
+ },
733
+ ): boolean;
734
+
735
+ /**
736
+ * **NOTE** Use locator-based locator.isEnabled([options]) instead.
737
+ *
738
+ * Returns whether the element is enabled.
739
+ *
740
+ * @param selector A selector to search for an element. If there are multiple
741
+ * elements satisfying the selector, the first will be used.
742
+ * @param options
743
+ */
744
+ isEnabled(
745
+ selector: string,
746
+ options?: {
747
+ /**
748
+ * When `true`, the call requires selector to resolve to a single element.
749
+ * If given selector resolves to more than one element, the call throws
750
+ * an exception. Defaults to `false`.
751
+ */
752
+ strict?: boolean;
753
+
754
+ /**
755
+ * Maximum time in milliseconds. Defaults to `30` seconds. Default is
756
+ * overridden by the `setDefaultTimeout` option on `BrowserContext` or
757
+ * `page` methods.
758
+ *
759
+ * Setting the value to `0` will disable the timeout.
760
+ */
761
+ timeout?: number;
762
+ },
763
+ ): boolean;
764
+
765
+ /**
766
+ * **NOTE** Use locator-based locator.isHidden([options]) instead.
767
+ *
768
+ * Returns whether the element is hidden.
769
+ *
770
+ * @param selector A selector to search for an element. If there are multiple
771
+ * elements satisfying the selector, the first will be used.
772
+ * @param options
773
+ */
774
+ isHidden(
775
+ selector: string,
776
+ options?: {
777
+ /**
778
+ * When `true`, the call requires selector to resolve to a single element.
779
+ * If given selector resolves to more than one element, the call throws
780
+ * an exception. Defaults to `false`.
781
+ */
782
+ strict?: boolean;
783
+
784
+ /**
785
+ * Maximum time in milliseconds. Defaults to `30` seconds. Default is
786
+ * overridden by the `setDefaultTimeout` option on `BrowserContext` or
787
+ * `page` methods.
788
+ *
789
+ * Setting the value to `0` will disable the timeout.
790
+ */
791
+ timeout?: number;
792
+ },
793
+ ): boolean;
794
+
795
+ /**
796
+ * **NOTE** Use locator-based locator.isVisible([options]) instead.
797
+ *
798
+ * Returns whether the element is visible.
799
+ *
800
+ * @param selector A selector to search for an element. If there are multiple
801
+ * elements satisfying the selector, the first will be used.
802
+ * @param options
803
+ */
804
+ isVisible(
805
+ selector: string,
806
+ options?: {
807
+ /**
808
+ * When `true`, the call requires selector to resolve to a single element.
809
+ * If given selector resolves to more than one element, the call throws
810
+ * an exception. Defaults to `false`.
811
+ */
812
+ strict?: boolean;
813
+
814
+ /**
815
+ * Maximum time in milliseconds. Defaults to `30` seconds. Default is
816
+ * overridden by the `setDefaultTimeout` option on `BrowserContext` or
817
+ * `page` methods.
818
+ *
819
+ * Setting the value to `0` will disable the timeout.
820
+ */
821
+ timeout?: number;
822
+ },
823
+ ): boolean;
824
+
825
+ /**
826
+ * Returns the keyboard instance to interact with a virtual keyboard on the
827
+ * page.
828
+ */
829
+ keyboard: Keyboard;
830
+
831
+ /**
832
+ * The method returns an element locator. Locators resolve to the element
833
+ * when the action takes place, which means locators can span over navigations
834
+ * where the underlying dom changes.
835
+ *
836
+ * @param selector A selector to use when resolving DOM element.
990
837
  */
991
- timeout?: number;
992
-
993
- /**
994
- * When to consider operation succeeded, defaults to `load`. Events can be
995
- * either:
996
- * - `'domcontentloaded'` - consider operation to be finished when the
997
- * `DOMContentLoaded` event is fired.
998
- * - `'load'` - consider operation to be finished when the `load` event is
999
- * fired.
1000
- * - `'networkidle'` - **DISCOURAGED** consider operation to be finished
1001
- * when there are no network connections for at least `500` ms. Don't use
1002
- * this method for testing especially with chatty websites where the event
1003
- * may never fire, rely on web assertions to assess readiness instead.
1004
- */
1005
- waitUntil?: "load"|"domcontentloaded"|"networkidle";
1006
- }): void;
1007
-
1008
- /**
1009
- * This setting will change the navigation timeout for the following methods:
1010
- * - page.goto(url[, options])
1011
- * - page.reload([options])
1012
- * - page.setContent(html[, options])
1013
- * - page.waitForNavigation([options])
1014
- *
1015
- * @param timeout in milliseconds
1016
- */
1017
- setDefaultNavigationTimeout(timeout: number): void;
1018
-
1019
- /**
1020
- * This setting will change the timeout for all the methods accepting a
1021
- * `timeout` option.
1022
- *
1023
- * @param timeout in milliseconds
1024
- */
1025
- setDefaultTimeout(timeout: number): void;
1026
-
1027
- /**
1028
- * This sets extra HTTP headers which will be sent with subsequent
1029
- * HTTP requests.
1030
- *
1031
- * @param headers An object containing the additional HTTP headers.
1032
- * All header values must be strings.
1033
- */
1034
- setExtraHTTPHeaders(headers: { [key: string]: string; }): void;
1035
-
1036
- /**
1037
- * This will update the page's width and height.
1038
- *
1039
- * @param viewportSize
1040
- */
1041
- setViewportSize(viewportSize: {
1042
- /**
1043
- * page width in pixels.
1044
- */
1045
- width: number;
1046
-
1047
- /**
1048
- * page height in pixels.
1049
- */
1050
- height: number;
1051
- }): void;
1052
-
1053
- /**
1054
- * **NOTE** Use locator-based locator.tap([options]) instead.
1055
- *
1056
- * Tap the first element that matches the selector.
1057
- *
1058
- * @param selector A selector to search for an element. If there are multiple
1059
- * elements satisfying the selector, the first will be used.
1060
- * @param options
1061
- */
1062
- tap(selector: string, options?: {
1063
- /**
1064
- * Setting this to `true` will bypass the actionability checks (visible,
1065
- * stable, enabled). Defaults to `false`.
1066
- */
1067
- force?: boolean;
1068
-
1069
- /**
1070
- * `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the
1071
- * action. If not specified, currently pressed modifiers are used,
1072
- * otherwise defaults to `null`.
1073
- */
1074
- modifiers?: KeyboardModifier[];
838
+ locator(selector: string): Locator;
1075
839
 
1076
840
  /**
1077
- * If set to `true` and a navigation occurs from performing this action, it
1078
- * will not wait for it to complete. Defaults to `false`.
841
+ * The page's main frame. Page is made up of frames in a hierarchical. At the
842
+ * top is mainFrame. A page is guaranteed to have a mainFrame.
1079
843
  */
1080
- noWaitAfter?: boolean;
844
+ mainFrame(): Frame;
1081
845
 
1082
846
  /**
1083
- * A point to use relative to the top left corner of the element. If not
1084
- * supplied, a visible point of the element is used.
847
+ * Returns the mouse instance to interact with a virtual mouse on the page.
1085
848
  */
1086
- position?: {
1087
- x: number;
1088
-
1089
- y: number;
1090
- };
849
+ mouse: Mouse;
1091
850
 
1092
851
  /**
1093
- * When `true`, the call requires selector to resolve to a single element.
1094
- * If given selector resolves to more than one element, the call throws
1095
- * an exception. Defaults to `false`.
852
+ * Returns the page that opened the current page. The first page that is
853
+ * navigated to will have a null opener.
1096
854
  */
1097
- strict?: boolean;
855
+ opener(): Page | null;
1098
856
 
1099
857
  /**
1100
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
1101
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
1102
- * `page` methods.
858
+ * **NOTE** Use locator-based locator.press(key[, options]) instead.
859
+ *
860
+ * Focuses the element, and then uses keyboard.down(key) and
861
+ * keyboard.up(key).
1103
862
  *
1104
- * Setting the value to `0` will disable the timeout.
863
+ * A superset of the `key` values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values).
864
+ *
865
+ * Following modification shortcuts are also supported: `Shift`, `Control`,
866
+ * `Alt`, `Meta`, `ShiftLeft`.
867
+ *
868
+ * Holding down `Shift` will type the text that corresponds to the `key` in
869
+ * the upper case.
870
+ *
871
+ * If `key` is a single character, it is case-sensitive, so the values `a`
872
+ * and `A` will generate different respective texts.
873
+ *
874
+ * Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are
875
+ * supported as well. When specified with the modifier, modifier is pressed
876
+ * and being held while the subsequent key is being pressed.
877
+ *
878
+ * @param selector A selector to search for an element. If there are multiple
879
+ * elements satisfying the selector, the first will be used.
880
+ * @param key Name of the key to press or a character to generate, such as
881
+ * `ArrowLeft` or `a`.
882
+ * @param options
883
+ */
884
+ press(
885
+ selector: string,
886
+ key: string,
887
+ options?: {
888
+ /**
889
+ * Milliseconds to wait between `mousedown` and `mouseup`. Defaults to `0`.
890
+ */
891
+ delay?: number;
892
+
893
+ /**
894
+ * If set to `true` and a navigation occurs from performing this action, it
895
+ * will not wait for it to complete. Defaults to `false`.
896
+ */
897
+ noWaitAfter?: boolean;
898
+
899
+ /**
900
+ * When `true`, the call requires selector to resolve to a single element.
901
+ * If given selector resolves to more than one element, the call throws
902
+ * an exception. Defaults to `false`.
903
+ */
904
+ strict?: boolean;
905
+
906
+ /**
907
+ * Maximum time in milliseconds. Defaults to `30` seconds. Default is
908
+ * overridden by the `setDefaultTimeout` option on `BrowserContext` or
909
+ * `page` methods.
910
+ *
911
+ * Setting the value to `0` will disable the timeout.
912
+ */
913
+ timeout?: number;
914
+ },
915
+ ): void;
916
+
917
+ /**
918
+ * This reloads the current page Returns the main resource response.
919
+ *
920
+ * @param options
921
+ */
922
+ reload(options?: {
923
+ /**
924
+ * Maximum operation time in milliseconds. Defaults to `30` seconds. The
925
+ * default value can be changed via the
926
+ * browserContext.setDefaultNavigationTimeout(timeout),
927
+ * browserContext.setDefaultTimeout(timeout),
928
+ * page.setDefaultNavigationTimeout(timeout) or
929
+ * page.setDefaultTimeout(timeout) methods.
930
+ *
931
+ * Setting the value to `0` will disable the timeout.
932
+ *
933
+ */
934
+ timeout?: number;
935
+
936
+ /**
937
+ * When to consider operation succeeded, defaults to `load`. Events can be
938
+ * either:
939
+ * - `'domcontentloaded'` - consider operation to be finished when the
940
+ * `DOMContentLoaded` event is fired.
941
+ * - `'load'` - consider operation to be finished when the `load` event is
942
+ * fired.
943
+ * - `'networkidle'` - **DISCOURAGED** consider operation to be finished
944
+ * when there are no network connections for at least `500` ms. Don't use
945
+ * this method for testing especially with chatty websites where the event
946
+ * may never fire, rely on web assertions to assess readiness instead.
947
+ */
948
+ waitUntil?: 'load' | 'domcontentloaded' | 'networkidle';
949
+ }): null | Response;
950
+
951
+ /**
952
+ * Returns the buffer with the captured screenshot from the browser.
953
+ *
954
+ * @param options
955
+ */
956
+ screenshot(
957
+ options?: {
958
+ /**
959
+ * An object which specifies clipping of the resulting image.
960
+ */
961
+ clip?: {
962
+ /**
963
+ * x-coordinate of top-left corner of clip area
964
+ */
965
+ x: number;
966
+
967
+ /**
968
+ * y-coordinate of top-left corner of clip area
969
+ */
970
+ y: number;
971
+
972
+ /**
973
+ * width of clipping area
974
+ */
975
+ width: number;
976
+
977
+ /**
978
+ * height of clipping area
979
+ */
980
+ height: number;
981
+ };
982
+
983
+ /**
984
+ * When true, takes a screenshot of the full scrollable page, instead of
985
+ * the currently visible viewport. Defaults to `false`.
986
+ */
987
+ fullPage?: boolean;
988
+ } & ScreenshotOptions,
989
+ ): ArrayBuffer;
990
+
991
+ /**
992
+ * **NOTE** Use locator-based locator.selectOption(values[, options]) instead.
993
+ *
994
+ * This select one or more options which match the values from a <select>
995
+ * element.
996
+ *
997
+ * @param selector A selector to search for an element. If there are multiple
998
+ * elements satisfying the selector, the first will be used.
999
+ * @param values Options to select. If the select has multiple attribute, all
1000
+ * matching options are selected, otherwise only the first option matching
1001
+ * one of the passed options is selected. Object can be made up of keys with
1002
+ * value, label or index.
1003
+ * @param options
1004
+ */
1005
+ selectOption(
1006
+ selector: string,
1007
+ values: string | ElementHandle | SelectOptionsObject | string[] | ElementHandle[] | SelectOptionsObject[],
1008
+ options?: {
1009
+ /**
1010
+ * Setting this to `true` will bypass the actionability checks (visible,
1011
+ * stable, enabled). Defaults to `false`.
1012
+ */
1013
+ force?: boolean;
1014
+
1015
+ /**
1016
+ * If set to `true` and a navigation occurs from performing this action, it
1017
+ * will not wait for it to complete. Defaults to `false`.
1018
+ */
1019
+ noWaitAfter?: boolean;
1020
+
1021
+ /**
1022
+ * When `true`, the call requires selector to resolve to a single element.
1023
+ * If given selector resolves to more than one element, the call throws
1024
+ * an exception. Defaults to `false`.
1025
+ */
1026
+ strict?: boolean;
1027
+
1028
+ /**
1029
+ * Maximum time in milliseconds. Defaults to `30` seconds. Default is
1030
+ * overridden by the `setDefaultTimeout` option on `BrowserContext` or
1031
+ * `page` methods.
1032
+ *
1033
+ * Setting the value to `0` will disable the timeout.
1034
+ */
1035
+ timeout?: number;
1036
+ },
1037
+ ): string[];
1038
+
1039
+ /**
1040
+ * Set the supplied html string to the current page.
1041
+ *
1042
+ * @param html HTML markup to assign to the page.
1043
+ * @param options
1044
+ */
1045
+ setContent(
1046
+ html: string,
1047
+ options?: {
1048
+ /**
1049
+ * Maximum operation time in milliseconds. Defaults to `30` seconds. The
1050
+ * default value can be changed via the
1051
+ * browserContext.setDefaultNavigationTimeout(timeout),
1052
+ * browserContext.setDefaultTimeout(timeout),
1053
+ * page.setDefaultNavigationTimeout(timeout) or
1054
+ * page.setDefaultTimeout(timeout) methods.
1055
+ *
1056
+ * Setting the value to `0` will disable the timeout.
1057
+ *
1058
+ */
1059
+ timeout?: number;
1060
+
1061
+ /**
1062
+ * When to consider operation succeeded, defaults to `load`. Events can be
1063
+ * either:
1064
+ * - `'domcontentloaded'` - consider operation to be finished when the
1065
+ * `DOMContentLoaded` event is fired.
1066
+ * - `'load'` - consider operation to be finished when the `load` event is
1067
+ * fired.
1068
+ * - `'networkidle'` - **DISCOURAGED** consider operation to be finished
1069
+ * when there are no network connections for at least `500` ms. Don't use
1070
+ * this method for testing especially with chatty websites where the event
1071
+ * may never fire, rely on web assertions to assess readiness instead.
1072
+ */
1073
+ waitUntil?: 'load' | 'domcontentloaded' | 'networkidle';
1074
+ },
1075
+ ): void;
1076
+
1077
+ /**
1078
+ * This setting will change the navigation timeout for the following methods:
1079
+ * - page.goto(url[, options])
1080
+ * - page.reload([options])
1081
+ * - page.setContent(html[, options])
1082
+ * - page.waitForNavigation([options])
1083
+ *
1084
+ * @param timeout in milliseconds
1105
1085
  */
1106
- timeout?: number;
1086
+ setDefaultNavigationTimeout(timeout: number): void;
1107
1087
 
1108
1088
  /**
1109
- * Setting this to `true` will perform the actionability checks without
1110
- * performing the action. Useful to wait until the element is ready for the
1111
- * action without performing it. Defaults to `false`.
1112
- */
1113
- trial?: boolean;
1114
- }): void;
1115
-
1116
- /**
1117
- * **NOTE** Use locator-based locator.textContent([options]) instead.
1118
- *
1119
- * Returns `element.textContent`.
1120
- *
1121
- * @param selector A selector to search for an element. If there are multiple
1122
- * elements satisfying the selector, the first will be used.
1123
- * @param options
1124
- */
1125
- textContent(selector: string, options?: {
1126
- /**
1127
- * When `true`, the call requires selector to resolve to a single element.
1128
- * If given selector resolves to more than one element, the call throws
1129
- * an exception. Defaults to `false`.
1089
+ * This setting will change the timeout for all the methods accepting a
1090
+ * `timeout` option.
1091
+ *
1092
+ * @param timeout in milliseconds
1130
1093
  */
1131
- strict?: boolean;
1094
+ setDefaultTimeout(timeout: number): void;
1132
1095
 
1133
1096
  /**
1134
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
1135
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
1136
- * `page` methods.
1097
+ * This sets extra HTTP headers which will be sent with subsequent
1098
+ * HTTP requests.
1137
1099
  *
1138
- * Setting the value to `0` will disable the timeout.
1100
+ * @param headers An object containing the additional HTTP headers.
1101
+ * All header values must be strings.
1139
1102
  */
1140
- timeout?: number;
1141
- }): string;
1142
-
1143
- /**
1144
- * Returns the page's title.
1145
- */
1146
- title(): string;
1147
-
1148
- /**
1149
- * Returns the touchscreen instance to interact with a virtual touchscreen on
1150
- * the page.
1151
- */
1152
- touchscreen: Touchscreen;
1153
-
1154
- /**
1155
- * **NOTE** Use locator-based locator.type(text[, options]) instead.
1156
- *
1157
- * Type the `text` in the first element found that matches the selector.
1158
- *
1159
- * @param selector A selector to search for an element. If there are multiple
1160
- * elements satisfying the selector, the first will be used.
1161
- * @param text The text to type into the element.
1162
- * @param options
1163
- */
1164
- type(selector: string, text: string, options?: {
1165
- /**
1166
- * Milliseconds to wait between `mousedown` and `mouseup`. Defaults to `0`.
1167
- */
1168
- delay?: number;
1103
+ setExtraHTTPHeaders(headers: { [key: string]: string }): void;
1169
1104
 
1170
1105
  /**
1171
- * If set to `true` and a navigation occurs from performing this action, it
1172
- * will not wait for it to complete. Defaults to `false`.
1106
+ * This will update the page's width and height.
1107
+ *
1108
+ * @param viewportSize
1173
1109
  */
1174
- noWaitAfter?: boolean;
1110
+ setViewportSize(viewportSize: {
1111
+ /**
1112
+ * page width in pixels.
1113
+ */
1114
+ width: number;
1175
1115
 
1176
- /**
1177
- * When `true`, the call requires selector to resolve to a single element.
1178
- * If given selector resolves to more than one element, the call throws
1179
- * an exception. Defaults to `false`.
1180
- */
1181
- strict?: boolean;
1116
+ /**
1117
+ * page height in pixels.
1118
+ */
1119
+ height: number;
1120
+ }): void;
1182
1121
 
1183
1122
  /**
1184
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
1185
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
1186
- * `page` methods.
1123
+ * **NOTE** Use locator-based locator.tap([options]) instead.
1187
1124
  *
1188
- * Setting the value to `0` will disable the timeout.
1189
- */
1190
- timeout?: number;
1191
- }): void;
1192
-
1193
- /**
1194
- * **NOTE** Use locator-based `locator.uncheck([options])` instead.
1195
- *
1196
- * This method is used to unselect an input checkbox.
1197
- *
1198
- * @param selector A selector to search for an element. If there are multiple
1199
- * elements satisfying the selector, the first will be used.
1200
- * @param options
1201
- */
1202
- uncheck(selector: string, options?: {
1203
- /**
1204
- * Setting this to `true` will bypass the actionability checks (visible,
1205
- * stable, enabled). Defaults to `false`.
1125
+ * Tap the first element that matches the selector.
1126
+ *
1127
+ * @param selector A selector to search for an element. If there are multiple
1128
+ * elements satisfying the selector, the first will be used.
1129
+ * @param options
1130
+ */
1131
+ tap(
1132
+ selector: string,
1133
+ options?: {
1134
+ /**
1135
+ * Setting this to `true` will bypass the actionability checks (visible,
1136
+ * stable, enabled). Defaults to `false`.
1137
+ */
1138
+ force?: boolean;
1139
+
1140
+ /**
1141
+ * `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the
1142
+ * action. If not specified, currently pressed modifiers are used,
1143
+ * otherwise defaults to `null`.
1144
+ */
1145
+ modifiers?: KeyboardModifier[];
1146
+
1147
+ /**
1148
+ * If set to `true` and a navigation occurs from performing this action, it
1149
+ * will not wait for it to complete. Defaults to `false`.
1150
+ */
1151
+ noWaitAfter?: boolean;
1152
+
1153
+ /**
1154
+ * A point to use relative to the top left corner of the element. If not
1155
+ * supplied, a visible point of the element is used.
1156
+ */
1157
+ position?: {
1158
+ x: number;
1159
+
1160
+ y: number;
1161
+ };
1162
+
1163
+ /**
1164
+ * When `true`, the call requires selector to resolve to a single element.
1165
+ * If given selector resolves to more than one element, the call throws
1166
+ * an exception. Defaults to `false`.
1167
+ */
1168
+ strict?: boolean;
1169
+
1170
+ /**
1171
+ * Maximum time in milliseconds. Defaults to `30` seconds. Default is
1172
+ * overridden by the `setDefaultTimeout` option on `BrowserContext` or
1173
+ * `page` methods.
1174
+ *
1175
+ * Setting the value to `0` will disable the timeout.
1176
+ */
1177
+ timeout?: number;
1178
+
1179
+ /**
1180
+ * Setting this to `true` will perform the actionability checks without
1181
+ * performing the action. Useful to wait until the element is ready for the
1182
+ * action without performing it. Defaults to `false`.
1183
+ */
1184
+ trial?: boolean;
1185
+ },
1186
+ ): void;
1187
+
1188
+ /**
1189
+ * **NOTE** Use locator-based locator.textContent([options]) instead.
1190
+ *
1191
+ * Returns `element.textContent`.
1192
+ *
1193
+ * @param selector A selector to search for an element. If there are multiple
1194
+ * elements satisfying the selector, the first will be used.
1195
+ * @param options
1206
1196
  */
1207
- force?: boolean;
1197
+ textContent(
1198
+ selector: string,
1199
+ options?: {
1200
+ /**
1201
+ * When `true`, the call requires selector to resolve to a single element.
1202
+ * If given selector resolves to more than one element, the call throws
1203
+ * an exception. Defaults to `false`.
1204
+ */
1205
+ strict?: boolean;
1208
1206
 
1209
- /**
1210
- * If set to `true` and a navigation occurs from performing this action, it
1211
- * will not wait for it to complete. Defaults to `false`.
1212
- */
1213
- noWaitAfter?: boolean;
1207
+ /**
1208
+ * Maximum time in milliseconds. Defaults to `30` seconds. Default is
1209
+ * overridden by the `setDefaultTimeout` option on `BrowserContext` or
1210
+ * `page` methods.
1211
+ *
1212
+ * Setting the value to `0` will disable the timeout.
1213
+ */
1214
+ timeout?: number;
1215
+ },
1216
+ ): string;
1214
1217
 
1215
1218
  /**
1216
- * A point to use relative to the top left corner of the element. If not
1217
- * supplied, a visible point of the element is used.
1219
+ * Returns the page's title.
1218
1220
  */
1219
- position?: {
1220
- x: number;
1221
-
1222
- y: number;
1223
- };
1221
+ title(): string;
1224
1222
 
1225
1223
  /**
1226
- * When `true`, the call requires selector to resolve to a single element.
1227
- * If given selector resolves to more than one element, the call throws
1228
- * an exception. Defaults to `false`.
1224
+ * Returns the touchscreen instance to interact with a virtual touchscreen on
1225
+ * the page.
1229
1226
  */
1230
- strict?: boolean;
1227
+ touchscreen: Touchscreen;
1231
1228
 
1232
1229
  /**
1233
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
1234
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
1235
- * `page` methods.
1230
+ * **NOTE** Use locator-based locator.type(text[, options]) instead.
1236
1231
  *
1237
- * Setting the value to `0` will disable the timeout.
1238
- */
1239
- timeout?: number;
1240
-
1241
- /**
1242
- * Setting this to `true` will perform the actionability checks without
1243
- * performing the action. Useful to wait until the element is ready for the
1244
- * action without performing it. Defaults to `false`.
1245
- */
1246
- trial?: boolean;
1247
- }): void;
1248
-
1249
- /**
1250
- * Returns the page's URL.
1251
- */
1252
- url(): string;
1253
-
1254
- /**
1255
- * Returns the page's size (width and height).
1256
- */
1257
- viewportSize(): {
1258
- /**
1259
- * page width in pixels.
1260
- */
1261
- width: number;
1262
-
1263
- /**
1264
- * page height in pixels.
1265
- */
1266
- height: number;
1267
- };
1268
-
1269
- /**
1270
- * Returns when the `pageFunction` returns a truthy value.
1271
- *
1272
- * @param pageFunction Function to be evaluated in the page context.
1273
- * @param arg Optional argument to pass to `pageFunction`.
1274
- * @param options
1275
- */
1276
- waitForFunction<R, Arg>(pageFunction: PageFunction<Arg, R>, options?: {
1277
- /**
1278
- * If `polling` is `'raf'`, then `pageFunction` is constantly executed in
1279
- * `requestAnimationFrame` callback. If `polling` is a number, then it is
1280
- * treated as an interval in milliseconds at which the function would be
1281
- * executed. Defaults to `raf`.
1282
- */
1283
- polling?: number|"raf";
1284
-
1285
- /**
1286
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
1287
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
1288
- * `page` methods.
1232
+ * Type the `text` in the first element found that matches the selector.
1289
1233
  *
1290
- * Setting the value to `0` will disable the timeout.
1291
- */
1292
- timeout?: number;
1293
- }, arg?: Arg): Promise<JSHandle<R>>;
1294
-
1295
- /**
1296
- * This waits for the given load state to be reached. It will immediately
1297
- * unblock if that lifecycle event has already been received.
1298
- *
1299
- * @param state Optional load state to wait for, defaults to `load`:
1300
- * - `'domcontentloaded'` - consider operation to be finished when the
1301
- * `DOMContentLoaded` event is fired.
1302
- * - `'load'` - consider operation to be finished when the `load` event is
1303
- * fired.
1304
- * - `'networkidle'` - **DISCOURAGED** consider operation to be finished
1305
- * when there are no network connections for at least `500` ms. Don't use
1306
- * this method for testing especially with chatty websites where the event
1307
- * may never fire, rely on web assertions to assess readiness instead.
1308
- * @param options
1309
- */
1310
- waitForLoadState(state?: "load"|"domcontentloaded"|"networkidle", options?: {
1311
- /**
1312
- * Maximum operation time in milliseconds. Defaults to `30` seconds. The
1313
- * default value can be changed via the
1314
- * browserContext.setDefaultNavigationTimeout(timeout),
1315
- * browserContext.setDefaultTimeout(timeout),
1316
- * page.setDefaultNavigationTimeout(timeout) or
1317
- * page.setDefaultTimeout(timeout) methods.
1234
+ * @param selector A selector to search for an element. If there are multiple
1235
+ * elements satisfying the selector, the first will be used.
1236
+ * @param text The text to type into the element.
1237
+ * @param options
1238
+ */
1239
+ type(
1240
+ selector: string,
1241
+ text: string,
1242
+ options?: {
1243
+ /**
1244
+ * Milliseconds to wait between `mousedown` and `mouseup`. Defaults to `0`.
1245
+ */
1246
+ delay?: number;
1247
+
1248
+ /**
1249
+ * If set to `true` and a navigation occurs from performing this action, it
1250
+ * will not wait for it to complete. Defaults to `false`.
1251
+ */
1252
+ noWaitAfter?: boolean;
1253
+
1254
+ /**
1255
+ * When `true`, the call requires selector to resolve to a single element.
1256
+ * If given selector resolves to more than one element, the call throws
1257
+ * an exception. Defaults to `false`.
1258
+ */
1259
+ strict?: boolean;
1260
+
1261
+ /**
1262
+ * Maximum time in milliseconds. Defaults to `30` seconds. Default is
1263
+ * overridden by the `setDefaultTimeout` option on `BrowserContext` or
1264
+ * `page` methods.
1265
+ *
1266
+ * Setting the value to `0` will disable the timeout.
1267
+ */
1268
+ timeout?: number;
1269
+ },
1270
+ ): void;
1271
+
1272
+ /**
1273
+ * **NOTE** Use locator-based `locator.uncheck([options])` instead.
1318
1274
  *
1319
- * Setting the value to `0` will disable the timeout.
1275
+ * This method is used to unselect an input checkbox.
1320
1276
  *
1321
- */
1322
- timeout?: number;
1323
- }): void;
1324
-
1325
- /**
1326
- * Waits for the given navigation lifecycle event to occur and returns the main
1327
- * resource response.
1328
- *
1329
- * @param options
1330
- */
1331
- waitForNavigation(options?: {
1277
+ * @param selector A selector to search for an element. If there are multiple
1278
+ * elements satisfying the selector, the first will be used.
1279
+ * @param options
1280
+ */
1281
+ uncheck(
1282
+ selector: string,
1283
+ options?: {
1284
+ /**
1285
+ * Setting this to `true` will bypass the actionability checks (visible,
1286
+ * stable, enabled). Defaults to `false`.
1287
+ */
1288
+ force?: boolean;
1289
+
1290
+ /**
1291
+ * If set to `true` and a navigation occurs from performing this action, it
1292
+ * will not wait for it to complete. Defaults to `false`.
1293
+ */
1294
+ noWaitAfter?: boolean;
1295
+
1296
+ /**
1297
+ * A point to use relative to the top left corner of the element. If not
1298
+ * supplied, a visible point of the element is used.
1299
+ */
1300
+ position?: {
1301
+ x: number;
1302
+
1303
+ y: number;
1304
+ };
1305
+
1306
+ /**
1307
+ * When `true`, the call requires selector to resolve to a single element.
1308
+ * If given selector resolves to more than one element, the call throws
1309
+ * an exception. Defaults to `false`.
1310
+ */
1311
+ strict?: boolean;
1312
+
1313
+ /**
1314
+ * Maximum time in milliseconds. Defaults to `30` seconds. Default is
1315
+ * overridden by the `setDefaultTimeout` option on `BrowserContext` or
1316
+ * `page` methods.
1317
+ *
1318
+ * Setting the value to `0` will disable the timeout.
1319
+ */
1320
+ timeout?: number;
1321
+
1322
+ /**
1323
+ * Setting this to `true` will perform the actionability checks without
1324
+ * performing the action. Useful to wait until the element is ready for the
1325
+ * action without performing it. Defaults to `false`.
1326
+ */
1327
+ trial?: boolean;
1328
+ },
1329
+ ): void;
1330
+
1331
+ /**
1332
+ * Returns the page's URL.
1333
+ */
1334
+ url(): string;
1335
+
1336
+ /**
1337
+ * Returns the page's size (width and height).
1338
+ */
1339
+ viewportSize(): {
1340
+ /**
1341
+ * page width in pixels.
1342
+ */
1343
+ width: number;
1344
+
1345
+ /**
1346
+ * page height in pixels.
1347
+ */
1348
+ height: number;
1349
+ };
1350
+
1332
1351
  /**
1333
- * Maximum operation time in milliseconds. Defaults to `30` seconds. The
1334
- * default value can be changed via the
1335
- * browserContext.setDefaultNavigationTimeout(timeout),
1336
- * browserContext.setDefaultTimeout(timeout),
1337
- * page.setDefaultNavigationTimeout(timeout) or
1338
- * page.setDefaultTimeout(timeout) methods.
1352
+ * Returns when the `pageFunction` returns a truthy value.
1339
1353
  *
1340
- * Setting the value to `0` will disable the timeout.
1354
+ * @param pageFunction Function to be evaluated in the page context.
1355
+ * @param arg Optional argument to pass to `pageFunction`.
1356
+ * @param options
1357
+ */
1358
+ waitForFunction<R, Arg>(
1359
+ pageFunction: PageFunction<Arg, R>,
1360
+ options?: {
1361
+ /**
1362
+ * If `polling` is `'raf'`, then `pageFunction` is constantly executed in
1363
+ * `requestAnimationFrame` callback. If `polling` is a number, then it is
1364
+ * treated as an interval in milliseconds at which the function would be
1365
+ * executed. Defaults to `raf`.
1366
+ */
1367
+ polling?: number | 'raf';
1368
+
1369
+ /**
1370
+ * Maximum time in milliseconds. Defaults to `30` seconds. Default is
1371
+ * overridden by the `setDefaultTimeout` option on `BrowserContext` or
1372
+ * `page` methods.
1373
+ *
1374
+ * Setting the value to `0` will disable the timeout.
1375
+ */
1376
+ timeout?: number;
1377
+ },
1378
+ arg?: Arg,
1379
+ ): Promise<JSHandle<R>>;
1380
+
1381
+ /**
1382
+ * This waits for the given load state to be reached. It will immediately
1383
+ * unblock if that lifecycle event has already been received.
1341
1384
  *
1342
- */
1343
- timeout?: number;
1344
-
1345
- /**
1346
- * When to consider operation succeeded, defaults to `load`. Events can be
1347
- * either:
1385
+ * @param state Optional load state to wait for, defaults to `load`:
1348
1386
  * - `'domcontentloaded'` - consider operation to be finished when the
1349
1387
  * `DOMContentLoaded` event is fired.
1350
1388
  * - `'load'` - consider operation to be finished when the `load` event is
@@ -1353,80 +1391,134 @@ export class Page {
1353
1391
  * when there are no network connections for at least `500` ms. Don't use
1354
1392
  * this method for testing especially with chatty websites where the event
1355
1393
  * may never fire, rely on web assertions to assess readiness instead.
1394
+ * @param options
1395
+ */
1396
+ waitForLoadState(
1397
+ state?: 'load' | 'domcontentloaded' | 'networkidle',
1398
+ options?: {
1399
+ /**
1400
+ * Maximum operation time in milliseconds. Defaults to `30` seconds. The
1401
+ * default value can be changed via the
1402
+ * browserContext.setDefaultNavigationTimeout(timeout),
1403
+ * browserContext.setDefaultTimeout(timeout),
1404
+ * page.setDefaultNavigationTimeout(timeout) or
1405
+ * page.setDefaultTimeout(timeout) methods.
1406
+ *
1407
+ * Setting the value to `0` will disable the timeout.
1408
+ *
1409
+ */
1410
+ timeout?: number;
1411
+ },
1412
+ ): void;
1413
+
1414
+ /**
1415
+ * Waits for the given navigation lifecycle event to occur and returns the main
1416
+ * resource response.
1417
+ *
1418
+ * @param options
1419
+ */
1420
+ waitForNavigation(options?: {
1421
+ /**
1422
+ * Maximum operation time in milliseconds. Defaults to `30` seconds. The
1423
+ * default value can be changed via the
1424
+ * browserContext.setDefaultNavigationTimeout(timeout),
1425
+ * browserContext.setDefaultTimeout(timeout),
1426
+ * page.setDefaultNavigationTimeout(timeout) or
1427
+ * page.setDefaultTimeout(timeout) methods.
1428
+ *
1429
+ * Setting the value to `0` will disable the timeout.
1430
+ *
1431
+ */
1432
+ timeout?: number;
1433
+
1434
+ /**
1435
+ * When to consider operation succeeded, defaults to `load`. Events can be
1436
+ * either:
1437
+ * - `'domcontentloaded'` - consider operation to be finished when the
1438
+ * `DOMContentLoaded` event is fired.
1439
+ * - `'load'` - consider operation to be finished when the `load` event is
1440
+ * fired.
1441
+ * - `'networkidle'` - **DISCOURAGED** consider operation to be finished
1442
+ * when there are no network connections for at least `500` ms. Don't use
1443
+ * this method for testing especially with chatty websites where the event
1444
+ * may never fire, rely on web assertions to assess readiness instead.
1445
+ */
1446
+ waitUntil?: 'load' | 'domcontentloaded' | 'networkidle';
1447
+ }): Promise<null | Response>;
1448
+
1449
+ /**
1450
+ * **NOTE** Use web assertions that assert visibility or a locator-based
1451
+ * locator.waitFor([options]) instead.
1452
+ *
1453
+ * Returns when element specified by selector satisfies `state` option.
1454
+ *
1455
+ * @param selector A selector to query for.
1456
+ * @param options
1457
+ */
1458
+ waitForSelector(
1459
+ selector: string,
1460
+ options?: {
1461
+ /**
1462
+ * Defaults to `'visible'`. Can be either:
1463
+ * - `'attached'` - wait for element to be present in DOM.
1464
+ * - `'detached'` - wait for element to not be present in DOM.
1465
+ * - `'visible'` - wait for element to have non-empty bounding box and no
1466
+ * `visibility:hidden`.
1467
+ * - `'hidden'` - wait for element to be either detached from DOM, or have
1468
+ * an empty bounding box or `visibility:hidden`.
1469
+ */
1470
+ state?: 'attached' | 'detached' | 'visible' | 'hidden';
1471
+
1472
+ /**
1473
+ * When `true`, the call requires selector to resolve to a single element.
1474
+ * If given selector resolves to more than one element, the call throws
1475
+ * an exception. Defaults to `false`.
1476
+ */
1477
+ strict?: boolean;
1478
+
1479
+ /**
1480
+ * Maximum time in milliseconds. Defaults to `30` seconds. Default is
1481
+ * overridden by the `setDefaultTimeout` option on `BrowserContext` or
1482
+ * `page` methods.
1483
+ *
1484
+ * Setting the value to `0` will disable the timeout.
1485
+ */
1486
+ timeout?: number;
1487
+ },
1488
+ ): ElementHandle;
1489
+
1490
+ /**
1491
+ * **NOTE** Never wait for timeout in production, use this only for debugging.
1492
+ * Tests that wait for time are inherently flaky. Use `Locator` actions and
1493
+ * web assertions that wait automatically.
1494
+ *
1495
+ * Waits for the given `timeout` in milliseconds.
1496
+ *
1497
+ * @param timeout A timeout to wait for
1356
1498
  */
1357
- waitUntil?: "load"|"domcontentloaded"|"networkidle";
1358
- }): Promise<null|Response>;
1359
-
1360
- /**
1361
- * **NOTE** Use web assertions that assert visibility or a locator-based
1362
- * locator.waitFor([options]) instead.
1363
- *
1364
- * Returns when element specified by selector satisfies `state` option.
1365
- *
1366
- * @param selector A selector to query for.
1367
- * @param options
1368
- */
1369
- waitForSelector(selector: string, options?: {
1499
+ waitForTimeout(timeout: number): void;
1500
+
1370
1501
  /**
1371
- * Defaults to `'visible'`. Can be either:
1372
- * - `'attached'` - wait for element to be present in DOM.
1373
- * - `'detached'` - wait for element to not be present in DOM.
1374
- * - `'visible'` - wait for element to have non-empty bounding box and no
1375
- * `visibility:hidden`.
1376
- * - `'hidden'` - wait for element to be either detached from DOM, or have
1377
- * an empty bounding box or `visibility:hidden`.
1502
+ * This method returns all of the dedicated WebWorkers associated with the page.
1378
1503
  */
1379
- state?: "attached"|"detached"|"visible"|"hidden";
1504
+ workers(): Worker[];
1380
1505
 
1381
1506
  /**
1382
- * When `true`, the call requires selector to resolve to a single element.
1383
- * If given selector resolves to more than one element, the call throws
1384
- * an exception. Defaults to `false`.
1507
+ * **NOTE** Use locator-based page.locator(selector[, options]) instead.
1508
+ *
1509
+ * The method finds an element matching the specified selector within the page.
1510
+ * If no elements match the selector, the return value resolves to `null`.
1511
+ * To wait for an element on the page, use locator.waitFor([options]).
1512
+ * @param selector A selector to query for.
1385
1513
  */
1386
- strict?: boolean;
1514
+ $(selector: string): ElementHandle;
1387
1515
 
1388
1516
  /**
1389
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
1390
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
1391
- * `page` methods.
1517
+ * **NOTE** Use locator-based page.locator(selector[, options]) instead.
1392
1518
  *
1393
- * Setting the value to `0` will disable the timeout.
1519
+ * The method finds all elements matching the specified selector within the
1520
+ * page. If no elements match the selector, the return value resolves to `[]`.
1521
+ * @param selector A selector to query for.
1394
1522
  */
1395
- timeout?: number;
1396
- }): ElementHandle;
1397
-
1398
- /**
1399
- * **NOTE** Never wait for timeout in production, use this only for debugging.
1400
- * Tests that wait for time are inherently flaky. Use `Locator` actions and
1401
- * web assertions that wait automatically.
1402
- *
1403
- * Waits for the given `timeout` in milliseconds.
1404
- *
1405
- * @param timeout A timeout to wait for
1406
- */
1407
- waitForTimeout(timeout: number): void;
1408
-
1409
- /**
1410
- * This method returns all of the dedicated WebWorkers associated with the page.
1411
- */
1412
- workers(): Worker[];
1413
-
1414
- /**
1415
- * **NOTE** Use locator-based page.locator(selector[, options]) instead.
1416
- *
1417
- * The method finds an element matching the specified selector within the page.
1418
- * If no elements match the selector, the return value resolves to `null`.
1419
- * To wait for an element on the page, use locator.waitFor([options]).
1420
- * @param selector A selector to query for.
1421
- */
1422
- $(selector: string): ElementHandle;
1423
-
1424
- /**
1425
- * **NOTE** Use locator-based page.locator(selector[, options]) instead.
1426
- *
1427
- * The method finds all elements matching the specified selector within the
1428
- * page. If no elements match the selector, the return value resolves to `[]`.
1429
- * @param selector A selector to query for.
1430
- */
1431
- $$(selector: string): ElementHandle[];
1523
+ $$(selector: string): ElementHandle[];
1432
1524
  }