@types/k6 0.44.1 → 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.
@@ -0,0 +1,1524 @@
1
+ import {
2
+ BrowserContext,
3
+ EvaluationArgument,
4
+ PageFunction,
5
+ SelectOptionsObject,
6
+ KeyboardModifier,
7
+ MouseButton,
8
+ ScreenshotOptions,
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';
20
+
21
+ /**
22
+ * Page provides methods to interact with a single tab in a running web browser
23
+ * instance. One instance of the browser can have many page instances.
24
+ */
25
+ export class Page {
26
+ /**
27
+ * Activates the browser tab so that it comes into focus and actions can be
28
+ * performed against it.
29
+ */
30
+ bringToFront(): void;
31
+
32
+ /**
33
+ * **NOTE** Use locator-based `locator.check([options])` instead.
34
+ *
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.
92
+ *
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.
188
+ *
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.
264
+ *
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.
338
+ *
339
+ * A string can also be passed in instead of a function.
340
+ *
341
+ * @param pageFunction Function to be evaluated in the page context.
342
+ * @param arg Optional argument to pass to `pageFunction`.
343
+ */
344
+ evaluate<R, Arg>(pageFunction: PageFunction<Arg, R>, arg?: Arg): R;
345
+
346
+ /**
347
+ * Returns the value of the `pageFunction` invocation as a [JSHandle].
348
+ *
349
+ * The only difference between page.evaluate(pageFunction[, arg]) and
350
+ * page.evaluateHandle(pageFunction[, arg]) is that
351
+ * page.evaluateHandle(pageFunction[, arg])returns [JSHandle].
352
+ *
353
+ * @param pageFunction Function to be evaluated in the page context.
354
+ * @param arg Optional argument to pass to `pageFunction`.
355
+ */
356
+ evaluateHandle<R, Arg>(pageFunction: PageFunction<Arg, R>, arg?: Arg): JSHandle<R>;
357
+
358
+ /**
359
+ * **NOTE** Use locator-based `locator.fill(value[, options])` instead.
360
+ *
361
+ * Fill an `input`, `textarea` or `[contenteditable]` element with the
362
+ * provided value.
363
+ *
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.
406
+ *
407
+ * This method fetches an element with `selector` and focuses it.
408
+ *
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.
441
+ *
442
+ * Returns the element attribute value for the given attribute name.
443
+ *
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.
473
+ *
474
+ * navigating to `about:blank` or navigation to the same URL with a different
475
+ * hash, will succeed and return `null`.
476
+ *
477
+ * @param url URL to navigate page to. The url should include scheme, e.g.
478
+ * `https://`.
479
+ * @param options
480
+ */
481
+ goto(url: string, options?: NavigationOptions): Promise<null | Response>;
482
+
483
+ /**
484
+ * **NOTE** Use locator-based locator.hover([options]) instead.
485
+ *
486
+ * This method hovers over an element matching `selector`.
487
+ *
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.
551
+ *
552
+ * Returns `element.innerHTML`.
553
+ *
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.
581
+ *
582
+ * Returns `element.innerText`.
583
+ *
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.
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.
837
+ */
838
+ locator(selector: string): Locator;
839
+
840
+ /**
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.
843
+ */
844
+ mainFrame(): Frame;
845
+
846
+ /**
847
+ * Returns the mouse instance to interact with a virtual mouse on the page.
848
+ */
849
+ mouse: Mouse;
850
+
851
+ /**
852
+ * Returns the page that opened the current page. The first page that is
853
+ * navigated to will have a null opener.
854
+ */
855
+ opener(): Page | null;
856
+
857
+ /**
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).
862
+ *
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
1085
+ */
1086
+ setDefaultNavigationTimeout(timeout: number): void;
1087
+
1088
+ /**
1089
+ * This setting will change the timeout for all the methods accepting a
1090
+ * `timeout` option.
1091
+ *
1092
+ * @param timeout in milliseconds
1093
+ */
1094
+ setDefaultTimeout(timeout: number): void;
1095
+
1096
+ /**
1097
+ * This sets extra HTTP headers which will be sent with subsequent
1098
+ * HTTP requests.
1099
+ *
1100
+ * @param headers An object containing the additional HTTP headers.
1101
+ * All header values must be strings.
1102
+ */
1103
+ setExtraHTTPHeaders(headers: { [key: string]: string }): void;
1104
+
1105
+ /**
1106
+ * This will update the page's width and height.
1107
+ *
1108
+ * @param viewportSize
1109
+ */
1110
+ setViewportSize(viewportSize: {
1111
+ /**
1112
+ * page width in pixels.
1113
+ */
1114
+ width: number;
1115
+
1116
+ /**
1117
+ * page height in pixels.
1118
+ */
1119
+ height: number;
1120
+ }): void;
1121
+
1122
+ /**
1123
+ * **NOTE** Use locator-based locator.tap([options]) instead.
1124
+ *
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
1196
+ */
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;
1206
+
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;
1217
+
1218
+ /**
1219
+ * Returns the page's title.
1220
+ */
1221
+ title(): string;
1222
+
1223
+ /**
1224
+ * Returns the touchscreen instance to interact with a virtual touchscreen on
1225
+ * the page.
1226
+ */
1227
+ touchscreen: Touchscreen;
1228
+
1229
+ /**
1230
+ * **NOTE** Use locator-based locator.type(text[, options]) instead.
1231
+ *
1232
+ * Type the `text` in the first element found that matches the selector.
1233
+ *
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.
1274
+ *
1275
+ * This method is used to unselect an input checkbox.
1276
+ *
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
+
1351
+ /**
1352
+ * Returns when the `pageFunction` returns a truthy value.
1353
+ *
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.
1384
+ *
1385
+ * @param state Optional load state to wait for, defaults to `load`:
1386
+ * - `'domcontentloaded'` - consider operation to be finished when the
1387
+ * `DOMContentLoaded` event is fired.
1388
+ * - `'load'` - consider operation to be finished when the `load` event is
1389
+ * fired.
1390
+ * - `'networkidle'` - **DISCOURAGED** consider operation to be finished
1391
+ * when there are no network connections for at least `500` ms. Don't use
1392
+ * this method for testing especially with chatty websites where the event
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
1498
+ */
1499
+ waitForTimeout(timeout: number): void;
1500
+
1501
+ /**
1502
+ * This method returns all of the dedicated WebWorkers associated with the page.
1503
+ */
1504
+ workers(): Worker[];
1505
+
1506
+ /**
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.
1513
+ */
1514
+ $(selector: string): ElementHandle;
1515
+
1516
+ /**
1517
+ * **NOTE** Use locator-based page.locator(selector[, options]) instead.
1518
+ *
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.
1522
+ */
1523
+ $$(selector: string): ElementHandle[];
1524
+ }