@types/k6 0.43.3 → 0.44.1

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