@types/k6 0.54.2 → 0.57.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.
@@ -1,4888 +0,0 @@
1
- /**
2
- * Represents event-specific properties. Refer to the events documentation for
3
- * the lists of initial properties:
4
- * - [DragEvent](https://developer.mozilla.org/en-US/docs/Web/API/DragEvent/DragEvent)
5
- * - [FocusEvent](https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent)
6
- * - [KeyboardEvent](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent)
7
- * - [MouseEvent](https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent)
8
- * - [PointerEvent](https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/PointerEvent)
9
- * - [TouchEvent](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/TouchEvent)
10
- * - [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event/Event)
11
- *
12
- * @deprecated Use "k6/browser" module instead.
13
- */
14
- export type EvaluationArgument = object;
15
-
16
- export type PageFunction<Arg, R> = string | ((arg: Unboxed<Arg>) => R);
17
-
18
- export type Unboxed<Arg> = Arg extends [infer A0, infer A1] ? [Unboxed<A0>, Unboxed<A1>]
19
- : Arg extends [infer A0, infer A1, infer A2] ? [Unboxed<A0>, Unboxed<A1>, Unboxed<A2>]
20
- : Arg extends [infer A0, infer A1, infer A2, infer A3] ? [Unboxed<A0>, Unboxed<A1>, Unboxed<A2>, Unboxed<A3>]
21
- : Arg extends Array<infer T> ? Array<Unboxed<T>>
22
- : Arg extends object ? { [Key in keyof Arg]: Unboxed<Arg[Key]> }
23
- : Arg;
24
-
25
- /**
26
- * CPUProfile is the mandatory input to be passed into {@link Page}'s
27
- * `throttleCPU` method.
28
- *
29
- * @deprecated Use "k6/browser" module instead.
30
- */
31
- export interface CPUProfile {
32
- /**
33
- * rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).
34
- *
35
- * @deprecated Use "k6/browser" module instead.
36
- */
37
- rate: number;
38
- }
39
-
40
- /**
41
- * NetworkProfile is the mandatory input to be passed into {@link Page}'s
42
- * `throttleNetwork` method.
43
- *
44
- * @deprecated Use "k6/browser" module instead.
45
- */
46
- export interface NetworkProfile {
47
- /**
48
- * Minimum latency from request sent to response headers received (ms).
49
- *
50
- * @deprecated Use "k6/browser" module instead.
51
- */
52
- latency: number;
53
-
54
- /**
55
- * Maximal aggregated download throughput (bytes/sec). -1 disables download
56
- * throttling.
57
- *
58
- * @deprecated Use "k6/browser" module instead.
59
- */
60
- download: number;
61
-
62
- /**
63
- * Maximal aggregated upload throughput (bytes/sec). -1 disables upload
64
- * throttling.
65
- *
66
- * @deprecated Use "k6/browser" module instead.
67
- */
68
- upload: number;
69
- }
70
-
71
- export interface SelectOptionsObject {
72
- /**
73
- * Matches by `option.value`.
74
- *
75
- * @deprecated Use "k6/browser" module instead.
76
- */
77
- value?: string;
78
-
79
- /**
80
- * Matches by `option.label`.
81
- *
82
- * @deprecated Use "k6/browser" module instead.
83
- */
84
- label?: string;
85
-
86
- /**
87
- * Matches by the index.
88
- *
89
- * @deprecated Use "k6/browser" module instead.
90
- */
91
- index?: number;
92
- }
93
-
94
- export type ResourceType =
95
- | "document"
96
- | "stylesheet"
97
- | "image"
98
- | "media"
99
- | "font"
100
- | "script"
101
- | "texttrack"
102
- | "xhr"
103
- | "fetch"
104
- | "eventsource"
105
- | "websocket"
106
- | "manifest"
107
- | "other";
108
- export type MouseButton = "left" | "right" | "middle";
109
- export type KeyboardModifier = "Alt" | "Control" | "Meta" | "Shift";
110
- export type ElementState = "attached" | "detached" | "visible" | "hidden";
111
- export type InputElementState = ElementState | "enabled" | "disabled" | "editable";
112
- export type LifecycleEvent = "load" | "domcontentloaded" | "networkidle";
113
-
114
- export interface TimeoutOptions {
115
- /**
116
- * Maximum time in milliseconds. Pass 0 to disable the timeout. Default is overridden by the setDefaultTimeout option on `BrowserContext` or `Page`.
117
- * Defaults to 30000.
118
- *
119
- * @deprecated Use "k6/browser" module instead.
120
- */
121
- timeout?: number;
122
- }
123
-
124
- export interface StrictnessOptions {
125
- /**
126
- * When `true`, the call requires selector to resolve to a single element.
127
- * If given selector resolves to more than one element, the call throws
128
- * an exception. Defaults to `false`.
129
- *
130
- * @deprecated Use "k6/browser" module instead.
131
- */
132
- strict?: boolean;
133
- }
134
-
135
- export interface EventSequenceOptions {
136
- /**
137
- * Delay between events in milliseconds. Defaults to 0.
138
- *
139
- * @deprecated Use "k6/browser" module instead.
140
- */
141
- delay?: number;
142
- }
143
-
144
- export interface File {
145
- /**
146
- * File name
147
- *
148
- * @deprecated Use "k6/browser" module instead.
149
- */
150
- name: string;
151
-
152
- /**
153
- * File type
154
- *
155
- * @deprecated Use "k6/browser" module instead.
156
- */
157
- mimeType: string;
158
-
159
- /**
160
- * File content
161
- *
162
- * @deprecated Use "k6/browser" module instead.
163
- */
164
- buffer: ArrayBuffer;
165
- }
166
-
167
- export type ElementHandleOptions = {
168
- /**
169
- * Setting this to `true` will bypass the actionability checks (visible,
170
- * stable, enabled). Defaults to `false`.
171
- *
172
- * @deprecated Use "k6/browser" module instead.
173
- */
174
- force?: boolean;
175
-
176
- /**
177
- * If set to `true` and a navigation occurs from performing this action, it will not wait for it to complete.
178
- * Defaults to `false`.
179
- *
180
- * @deprecated Use "k6/browser" module instead.
181
- */
182
- noWaitAfter?: boolean;
183
- } & TimeoutOptions;
184
-
185
- export type ElementHandlePointerOptions = ElementHandleOptions & {
186
- /**
187
- * Setting this to `true` will perform the actionability checks without
188
- * performing the action. Useful to wait until the element is ready for the
189
- * action without performing it. Defaults to `false`.
190
- *
191
- * @deprecated Use "k6/browser" module instead.
192
- */
193
- trial?: boolean;
194
- };
195
-
196
- export type ElementClickOptions = ElementHandlePointerOptions & {
197
- /**
198
- * A point to use relative to the top left corner of the element. If not supplied,
199
- * a visible point of the element is used.
200
- *
201
- * @deprecated Use "k6/browser" module instead.
202
- */
203
- position?: { x: number; y: number };
204
- };
205
-
206
- export interface KeyboardModifierOptions {
207
- /**
208
- * `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the action.
209
- * If not specified, currently pressed modifiers are used.
210
- *
211
- * @deprecated Use "k6/browser" module instead.
212
- */
213
- modifiers?: KeyboardModifier[];
214
- }
215
-
216
- export type KeyboardPressOptions =
217
- & {
218
- /**
219
- * If set to `true` and a navigation occurs from performing this action, it
220
- * will not wait for it to complete. Defaults to `false`.
221
- *
222
- * @deprecated Use "k6/browser" module instead.
223
- */
224
- noWaitAfter?: boolean;
225
- }
226
- & EventSequenceOptions
227
- & TimeoutOptions;
228
-
229
- export type MouseMoveOptions = ElementClickOptions & KeyboardModifierOptions;
230
-
231
- export type MouseClickOptions = {
232
- /**
233
- * The mouse button to use during the action.
234
- * Defaults to `left`.
235
- *
236
- * @deprecated Use "k6/browser" module instead.
237
- */
238
- button?: MouseButton;
239
- } & EventSequenceOptions;
240
-
241
- export type MouseMultiClickOptions = MouseClickOptions & {
242
- /**
243
- * The number of times the action is performed.
244
- * Defaults to 1.
245
- *
246
- * @deprecated Use "k6/browser" module instead.
247
- */
248
- clickCount?: number;
249
- };
250
-
251
- export interface MouseDownUpOptions {
252
- /**
253
- * The mouse button to use during the action.
254
- * Defaults to `left`.
255
- *
256
- * @deprecated Use "k6/browser" module instead.
257
- */
258
- button?: MouseButton;
259
-
260
- /**
261
- * Defaults to 1.
262
- *
263
- * @deprecated Use "k6/browser" module instead.
264
- */
265
- clickCount?: number;
266
- }
267
-
268
- export type ContentLoadOptions = {
269
- /**
270
- * When to consider operation succeeded, defaults to `load`. Events can be
271
- * either:
272
- * - `'domcontentloaded'` - consider operation to be finished when the
273
- * `DOMContentLoaded` event is fired.
274
- * - `'load'` - consider operation to be finished when the `load` event is
275
- * fired.
276
- * - `'networkidle'` - **DISCOURAGED** consider operation to be finished
277
- * when there are no network connections for at least `500` ms. Don't use
278
- * this method for testing especially with chatty websites where the event
279
- * may never fire, rely on web assertions to assess readiness instead.
280
- *
281
- * @deprecated Use "k6/browser" module instead.
282
- */
283
- waitUntil?: LifecycleEvent;
284
- } & TimeoutOptions;
285
-
286
- export type NavigationOptions = {
287
- /**
288
- * Referer header value.
289
- *
290
- * @deprecated Use "k6/browser" module instead.
291
- */
292
- referer?: string;
293
- } & ContentLoadOptions;
294
-
295
- export interface ResourceTiming {
296
- /**
297
- * Request start time in milliseconds elapsed since January 1, 1970 00:00:00 UTC
298
- *
299
- * @deprecated Use "k6/browser" module instead.
300
- */
301
- startTime: number;
302
-
303
- /**
304
- * Time immediately before the browser starts the domain name lookup for the resource.
305
- * The value is given in milliseconds relative to `startTime`, -1 if not available.
306
- *
307
- * @deprecated Use "k6/browser" module instead.
308
- */
309
- domainLookupStart: number;
310
-
311
- /**
312
- * Time immediately after the browser ends the domain name lookup for the resource.
313
- * The value is given in milliseconds relative to `startTime`, -1 if not available.
314
- *
315
- * @deprecated Use "k6/browser" module instead.
316
- */
317
- domainLookupEnd: number;
318
-
319
- /**
320
- * Time immediately before the user agent starts establishing the connection to the server
321
- * to retrieve the resource. The value is given in milliseconds relative to `startTime`,
322
- * -1 if not available.
323
- *
324
- * @deprecated Use "k6/browser" module instead.
325
- */
326
- connectStart: number;
327
-
328
- /**
329
- * Time immediately before the browser starts the handshake process to secure the current
330
- * connection. The value is given in milliseconds relative to `startTime`, -1 if not available.
331
- *
332
- * @deprecated Use "k6/browser" module instead.
333
- */
334
- secureConnectionStart: number;
335
-
336
- /**
337
- * Time immediately after the user agent establishes the connection to the server
338
- * to retrieve the resource. The value is given in milliseconds relative to `startTime`,
339
- * -1 if not available.
340
- *
341
- * @deprecated Use "k6/browser" module instead.
342
- */
343
- connectEnd: number;
344
-
345
- /**
346
- * Time immediately before the browser starts requesting the resource from the server,
347
- * cache, or local resource. The value is given in milliseconds relative to `startTime`,
348
- * -1 if not available.
349
- *
350
- * @deprecated Use "k6/browser" module instead.
351
- */
352
- requestStart: number;
353
-
354
- /**
355
- * Time immediately after the browser receives the first byte of the response from the server,
356
- * cache, or local resource. The value is given in milliseconds relative to `startTime`,
357
- * -1 if not available.
358
- *
359
- * @deprecated Use "k6/browser" module instead.
360
- */
361
- responseStart: number;
362
-
363
- /**
364
- * Time immediately after the browser receives the last byte of the resource or immediately
365
- * before the transport connection is closed, whichever comes first. The value is given
366
- * in milliseconds relative to `startTime`, -1 if not available.
367
- *
368
- * @deprecated Use "k6/browser" module instead.
369
- */
370
- responseEnd: number;
371
- }
372
-
373
- export interface SecurityDetailsObject {
374
- /**
375
- * Common Name component of the Issuer field. The value is extracted from the
376
- * certificate. This should only be used for informational purposes.
377
- *
378
- * @deprecated Use "k6/browser" module instead.
379
- */
380
- issuer?: string;
381
-
382
- /**
383
- * The specific TLS protocol used. For example `TLS 1.3`.
384
- *
385
- * @deprecated Use "k6/browser" module instead.
386
- */
387
- protocol?: string;
388
-
389
- /**
390
- * Common Name component of the Subject field. The value is extracted from the
391
- * certificate. This should only be used for informational purposes.
392
- *
393
- * @deprecated Use "k6/browser" module instead.
394
- */
395
- subjectName?: string;
396
-
397
- /**
398
- * Unix timestamp (in seconds) specifying the exact date/time when this cert
399
- * becomes valid.
400
- *
401
- * @deprecated Use "k6/browser" module instead.
402
- */
403
- validFrom?: number;
404
-
405
- /**
406
- * Unix timestamp (in seconds) specifying the exact date/time when this cert
407
- * becomes invalid.
408
- *
409
- * @deprecated Use "k6/browser" module instead.
410
- */
411
- validTo?: number;
412
-
413
- /**
414
- * String with hex encoded SHA256 fingerprint of the certificate. The value is
415
- * extracted from the certificate.
416
- *
417
- * @deprecated Use "k6/browser" module instead.
418
- */
419
- sanList?: string[];
420
- }
421
-
422
- export interface Rect {
423
- /**
424
- * The x coordinate of the element in pixels.
425
- * (0, 0) is the top left corner of the viewport.
426
- *
427
- * @deprecated Use "k6/browser" module instead.
428
- */
429
- x: number;
430
-
431
- /**
432
- * The y coordinate of the element in pixels.
433
- * (0, 0) is the top left corner of the viewport.
434
- *
435
- * @deprecated Use "k6/browser" module instead.
436
- */
437
- y: number;
438
-
439
- /**
440
- * The width of the element in pixels.
441
- *
442
- * @deprecated Use "k6/browser" module instead.
443
- */
444
- width: number;
445
-
446
- /**
447
- * The height of the element in pixels.
448
- *
449
- * @deprecated Use "k6/browser" module instead.
450
- */
451
- height: number;
452
- }
453
-
454
- export type ImageFormat = "jpeg" | "png";
455
-
456
- export interface ScreenshotOptions {
457
- /**
458
- * The file path to save the image to. The screenshot type will be inferred from file extension.
459
- *
460
- * @deprecated Use "k6/browser" module instead.
461
- */
462
- path?: string;
463
-
464
- /**
465
- * The screenshot format.
466
- * @default 'png'
467
- *
468
- * @deprecated Use "k6/browser" module instead.
469
- */
470
- type?: ImageFormat;
471
-
472
- /**
473
- * Hide default white background and allow capturing screenshots with transparency.
474
- * Not applicable to `jpeg` images.
475
- * @default false
476
- *
477
- * @deprecated Use "k6/browser" module instead.
478
- */
479
- omitBackground?: boolean;
480
-
481
- /**
482
- * The quality of the image, between 0-100. Not applicable to `png` images.
483
- * @default 100
484
- *
485
- * @deprecated Use "k6/browser" module instead.
486
- */
487
- quality?: number;
488
- }
489
-
490
- /**
491
- * Methods to periodically check for a value.
492
- * - `raf` - use `requestAnimationFrame` callback to poll
493
- * - `mutation` - use a mutation observer
494
- * - `interval` - use a polling interval
495
- *
496
- * @deprecated Use "k6/browser" module instead.
497
- */
498
- export type PollingMethod = "raf" | "mutation" | "interval";
499
-
500
- export interface PollingOptions {
501
- /**
502
- * Polling method to use.
503
- * @default 'raf'
504
- *
505
- * @deprecated Use "k6/browser" module instead.
506
- */
507
- polling?: "raf" | "mutation" | "interval";
508
-
509
- /**
510
- * Polling interval in milliseconds if `polling` is set to `interval`.
511
- *
512
- * @deprecated Use "k6/browser" module instead.
513
- */
514
- interval?: number;
515
- }
516
-
517
- export interface ElementStateFilter {
518
- /**
519
- * The element state to filter for.
520
- * @default 'visible'
521
- *
522
- * @deprecated Use "k6/browser" module instead.
523
- */
524
- state?: ElementState;
525
- }
526
-
527
- /**
528
- * BrowserPermissions defines all the possible permissions that can be granted
529
- * to the browser application.
530
- *
531
- * @deprecated Use "k6/browser" module instead.
532
- */
533
- export type BrowserPermissions =
534
- | "geolocation"
535
- | "midi"
536
- | "midi-sysex"
537
- | "notifications"
538
- | "camera"
539
- | "microphone"
540
- | "background-sync"
541
- | "ambient-light-sensor"
542
- | "accelerometer"
543
- | "gyroscope"
544
- | "magnetometer"
545
- | "accessibility-events"
546
- | "clipboard-read"
547
- | "clipboard-write"
548
- | "payment-handler";
549
-
550
- export interface NewBrowserContextOptions {
551
- /**
552
- * Setting this to `true` will bypass a page's Content-Security-Policy.
553
- * Defaults to `false`.
554
- *
555
- * @deprecated Use "k6/browser" module instead.
556
- */
557
- bypassCSP?: boolean;
558
-
559
- /**
560
- * Emulates `'prefers-colors-scheme'` media feature, supported values
561
- * are `'light'`, `'dark'`, and `'no-preference'`. Default to
562
- * `'light'`.
563
- *
564
- * @deprecated Use "k6/browser" module instead.
565
- */
566
- colorScheme?: "light" | "dark" | "no-preference";
567
-
568
- /**
569
- * Sets the resolution ratio in physical pixels to the resolution in
570
- * CSS pixels i.e. if set higher than 1, then images will look
571
- * sharper on high pixel density screens. Defaults to 1.
572
- *
573
- * @deprecated Use "k6/browser" module instead.
574
- */
575
- deviceScaleFactor?: number;
576
-
577
- /**
578
- * Contains additional HTTP headers to be sent with every request,
579
- * where the keys are HTTP headers and values are HTTP header
580
- * values. Defaults to null.
581
- *
582
- * @deprecated Use "k6/browser" module instead.
583
- */
584
- extraHTTPHeaders?: { [key: string]: string };
585
-
586
- /**
587
- * Sets the user's geographical location. Defaults to null.
588
- *
589
- * @deprecated Use "k6/browser" module instead.
590
- */
591
- geolocation?: {
592
- /**
593
- * latitude should be between -90 and 90.
594
- *
595
- * @deprecated Use "k6/browser" module instead.
596
- */
597
- latitude: number;
598
-
599
- /**
600
- * longitude should be between -180 and 180.
601
- *
602
- * @deprecated Use "k6/browser" module instead.
603
- */
604
- longitude: number;
605
-
606
- /**
607
- * accuracy should only be a non-negative number. Defaults to 0.
608
- *
609
- * @deprecated Use "k6/browser" module instead.
610
- */
611
- accuracy: number;
612
- };
613
-
614
- /**
615
- * Whether to simulate a device with touch events. Defaults to
616
- * `false`.
617
- *
618
- * @deprecated Use "k6/browser" module instead.
619
- */
620
- hasTouch?: boolean;
621
-
622
- /**
623
- * Sets the credentials for HTTP authentication using Basic Auth.
624
- *
625
- * @deprecated Use "k6/browser" module instead.
626
- */
627
- httpCredentials?: {
628
- username: string;
629
-
630
- password: string;
631
- };
632
-
633
- /**
634
- * Whether to ignore HTTPS errors that may be caused by invalid
635
- * certificates. Defaults to `false`.
636
- *
637
- * @deprecated Use "k6/browser" module instead.
638
- */
639
- ignoreHTTPSErrors?: boolean;
640
-
641
- /**
642
- * Whether to simulate a mobile device. Defaults to `false`.
643
- *
644
- * @deprecated Use "k6/browser" module instead.
645
- */
646
- isMobile?: boolean;
647
-
648
- /**
649
- * Whether to activate JavaScript support for the context. Defaults
650
- * to `false`.
651
- *
652
- * @deprecated Use "k6/browser" module instead.
653
- */
654
- javaScriptEnabled?: boolean;
655
-
656
- /**
657
- * Specifies the user's locale following ICU locale (e.g. 'en_US').
658
- * Defaults to host system locale.
659
- *
660
- * @deprecated Use "k6/browser" module instead.
661
- */
662
- locale?: string;
663
-
664
- /**
665
- * Whether to emulate an offline network. Defaults to `false`.
666
- *
667
- * @deprecated Use "k6/browser" module instead.
668
- */
669
- offline?: boolean;
670
-
671
- /**
672
- * Permissions to grant for the context's pages. Defaults to
673
- * null.
674
- *
675
- * @deprecated Use "k6/browser" module instead.
676
- */
677
- permissions?: BrowserPermissions[];
678
-
679
- /**
680
- * Minimizes the amount of motion by emulating the
681
- * 'prefers-reduced-motion' media feature. Defaults to
682
- * `'no-preference'`.
683
- *
684
- * @deprecated Use "k6/browser" module instead.
685
- */
686
- reducedMotion?: "reduce" | "no-preference";
687
-
688
- /**
689
- * Sets a window screen size for all pages in the context. It can
690
- * only be used when the viewport is set. Defaults to
691
- * `{'width': 1280, 'height': 720}`.
692
- *
693
- * @deprecated Use "k6/browser" module instead.
694
- */
695
- screen?: {
696
- /**
697
- * Page width in pixels.
698
- *
699
- * @deprecated Use "k6/browser" module instead.
700
- */
701
- width: number;
702
-
703
- /**
704
- * Page height in pixels.
705
- *
706
- * @deprecated Use "k6/browser" module instead.
707
- */
708
- height: number;
709
- };
710
-
711
- /**
712
- * Changes the context's timezone. See ICU's metaZones.txt for a
713
- * list of supported timezone IDs. Defaults to what is set on the
714
- * system.
715
- *
716
- * @deprecated Use "k6/browser" module instead.
717
- */
718
- timezoneID?: string;
719
-
720
- /**
721
- * Specifies the user agent to use in the context. Defaults to what
722
- * is set on the by the browser.
723
- *
724
- * @deprecated Use "k6/browser" module instead.
725
- */
726
- userAgent?: string;
727
-
728
- /**
729
- * Sets a viewport size for all pages in the context. null disables
730
- * the default viewport. Defaults to `{'width': 1280, 'height': 720}`.
731
- *
732
- * @deprecated Use "k6/browser" module instead.
733
- */
734
- viewport?: {
735
- /**
736
- * Page width in pixels.
737
- *
738
- * @deprecated Use "k6/browser" module instead.
739
- */
740
- width: number;
741
-
742
- /**
743
- * Page height in pixels.
744
- *
745
- * @deprecated Use "k6/browser" module instead.
746
- */
747
- height: number;
748
- };
749
- }
750
-
751
- /**
752
- * The `browser` named export is the entry point for all your tests,
753
- * it interacts with the actual web browser via Chrome DevTools Protocol (CDP).
754
- *
755
- * @deprecated Use "k6/browser" module instead.
756
- */
757
- export const browser: Browser;
758
-
759
- /**
760
- * `Browser` represents the main web browser instance.
761
- *
762
- * @deprecated Use "k6/browser" module instead.
763
- */
764
- export interface Browser {
765
- /**
766
- * Closes the current `BrowserContext`. If there is no active
767
- * `BrowserContext`, this method will throw an error.
768
- *
769
- * @deprecated Use "k6/browser" module instead.
770
- */
771
- closeContext(): void;
772
-
773
- /**
774
- * Returns the current `BrowserContext`. There is a 1-to-1 mapping between
775
- * `Browser` and `BrowserContext`. If no `BrowserContext` has been
776
- * initialized, it will return null.
777
- *
778
- * @deprecated Use "k6/browser" module instead.
779
- */
780
- context(): BrowserContext;
781
-
782
- /**
783
- * Indicates whether the CDP connection to the browser process is active or
784
- * not.
785
- *
786
- * @deprecated Use "k6/browser" module instead.
787
- */
788
- isConnected(): boolean;
789
-
790
- /**
791
- * Creates and returns a new `BrowserContext` if one hasn't already been
792
- * initialized for the `Browser`. If one has already been initialized an
793
- * error is thrown.
794
- *
795
- * There is a 1-to-1 mapping between `Browser` and `BrowserContext`. Due to
796
- * this restriction, if one already exists, it must be closed first before
797
- * creating a new one.
798
- * @param options
799
- *
800
- * @deprecated Use "k6/browser" module instead.
801
- */
802
- newContext(
803
- options?: NewBrowserContextOptions,
804
- ): BrowserContext;
805
-
806
- /**
807
- * Creates and returns a new `Page` in a new `BrowserContext` if a
808
- * `BrowserContext` hasn't already been initialized for the `Browser`. If a
809
- * `BrowserContext` has already been initialized an error is thrown.
810
- *
811
- * There is a 1-to-1 mapping between `Browser` and `BrowserContext`. Due to
812
- * this restriction, if one already exists, it must be closed first before
813
- * creating a new one.
814
- * @param options
815
- *
816
- * @deprecated Use "k6/browser" module instead.
817
- */
818
- newPage(
819
- options?: NewBrowserContextOptions,
820
- ): Page;
821
-
822
- /**
823
- * Returns the browser application's user agent.
824
- *
825
- * @deprecated Use "k6/browser" module instead.
826
- */
827
- userAgent(): string;
828
-
829
- /**
830
- * Returns the browser application's version.
831
- *
832
- * @deprecated Use "k6/browser" module instead.
833
- */
834
- version(): string;
835
- }
836
-
837
- /**
838
- * `BrowserContext` provides a way to operate multiple independent sessions, with
839
- * separate pages, cache, and cookies.
840
- *
841
- * @deprecated Use "k6/browser" module instead.
842
- */
843
- export interface BrowserContext {
844
- /**
845
- * Adds a script which will be evaluated in one of the following scenarios:
846
- * - Whenever a page is created in the browser context or is navigated.
847
- * - Whenever a child frame is attached or navigated in any page in the
848
- * browser context. In this case, the script is evaluated in the context
849
- * of the newly attached frame.
850
- *
851
- * The script is evaluated after the document is created but before any of
852
- * its scripts were run. This is useful to amend the JavaScript environment,
853
- * e.g. to override `Math.random`.
854
- *
855
- * **Usage**
856
- *
857
- * An example of overriding `Math.random` before the page loads:
858
- *
859
- * ```js
860
- * const browserContext = browser.newContext();
861
- * browserContext.addInitScript("Math.random = function(){return 0}");
862
- *
863
- * const page = browserContext.newPage();
864
- * await page.goto(url);
865
- * ```
866
- *
867
- * @param script Script to be evaluated in all pages in the browser context.
868
- *
869
- * @deprecated Use "k6/browser" module instead.
870
- */
871
- addInitScript(script: string | { content?: string }): void;
872
-
873
- /**
874
- * Returns the `Browser` instance that this `BrowserContext` belongs to.
875
- *
876
- * @deprecated Use "k6/browser" module instead.
877
- */
878
- browser(): Browser;
879
-
880
- /**
881
- * Adds {@link Cookie | cookies} into this {@link BrowserContext}.
882
- *
883
- * @param cookies The {@link Cookie | cookies} to add to this {@link BrowserContext}.
884
- * @example
885
- * ```js
886
- * context.addCookies([
887
- * { name: 'foo', value: 'foovalue', sameSite: 'Lax', url: 'https://k6.io' },
888
- * { name: 'bar', value: 'barvalue', sameSite: 'Strict', domain: 'test.k6.io', path: '/bar' },
889
- * ]);
890
- * ```
891
- *
892
- * @deprecated Use "k6/browser" module instead.
893
- */
894
- addCookies(cookies: Cookie[]): void;
895
-
896
- /**
897
- * Clears the {@link Cookie | cookies} in this {@link BrowserContext}.
898
- *
899
- * @example
900
- * ```js
901
- * context.addCookies([{ name: 'foo', value: 'bar', url: 'https://k6.io' }]);
902
- * context.cookies().length; // 1
903
- * context.clearCookies();
904
- * context.cookies().length; // 0
905
- * ```
906
- *
907
- * @deprecated Use "k6/browser" module instead.
908
- */
909
- clearCookies(): void;
910
-
911
- /**
912
- * Retrieves the {@link Cookie | cookies} in this {@link BrowserContext} filtered by provided URLs,
913
- * or all {@link Cookie | cookies} if no URLs are provided.
914
- *
915
- * @param urls URLs to filter {@link Cookie | cookies} by.
916
- * @returns An array of {@link Cookie | cookies}.
917
- * @example
918
- * ```js
919
- * // Get all cookies in the browser context
920
- * const cookies = context.cookies();
921
- *
922
- * // Get all cookies for the specified URLs
923
- * const cookies = context.cookies('https://k6.io', 'https://test.k6.io');
924
- *
925
- * // Get all cookies for the specified URLs and filter by name
926
- * const cookies = context.cookies('https://k6.io', 'https://test.k6.io').filter(c => c.name === 'foo');
927
- * ```
928
- *
929
- * @deprecated Use "k6/browser" module instead.
930
- */
931
- cookies(...urls: string[]): Cookie[];
932
-
933
- /**
934
- * Clears all permission overrides for the {@link BrowserContext}.
935
- * ```js
936
- * context.clearPermissions();
937
- * ```
938
- *
939
- * @deprecated Use "k6/browser" module instead.
940
- */
941
- clearPermissions(): void;
942
-
943
- /**
944
- * Close the `BrowserContext` and all its `Page`s.
945
- *
946
- * @deprecated Use "k6/browser" module instead.
947
- */
948
- close(): void;
949
-
950
- /**
951
- * Grants specified permissions to the {@link BrowserContext}.
952
- * ```js
953
- * context.grantPermissions(['geolocation']);
954
- * ```
955
- *
956
- * @deprecated Use "k6/browser" module instead.
957
- */
958
- grantPermissions(
959
- /**
960
- * A string array of permissions to grant.
961
- *
962
- * @deprecated Use "k6/browser" module instead.
963
- */
964
- permissions: BrowserPermissions[],
965
- options?: {
966
- /**
967
- * The origin to grant permissions to, e.g. 'https://test.k6.com'.
968
- *
969
- * @deprecated Use "k6/browser" module instead.
970
- */
971
- origin: string;
972
- },
973
- ): void;
974
-
975
- /**
976
- * Creates a new `Page` in the `BrowserContext`.
977
- *
978
- * @deprecated Use "k6/browser" module instead.
979
- */
980
- newPage(): Page;
981
-
982
- /**
983
- * Returns a list of `Page`s that belongs to the `BrowserContext`.
984
- *
985
- * @deprecated Use "k6/browser" module instead.
986
- */
987
- pages(): Page[];
988
-
989
- /**
990
- * Sets the default navigation timeout in milliseconds.
991
- *
992
- * @deprecated Use "k6/browser" module instead.
993
- */
994
- setDefaultNavigationTimeout(
995
- /**
996
- * The timeout in milliseconds.
997
- *
998
- * @deprecated Use "k6/browser" module instead.
999
- */
1000
- timeout: number,
1001
- ): void;
1002
-
1003
- /**
1004
- * Sets the default maximum timeout for all methods accepting a timeout
1005
- * option in milliseconds.
1006
- *
1007
- * @deprecated Use "k6/browser" module instead.
1008
- */
1009
- setDefaultTimeout(
1010
- /**
1011
- * The timeout in milliseconds.
1012
- *
1013
- * @deprecated Use "k6/browser" module instead.
1014
- */
1015
- timeout: number,
1016
- ): void;
1017
-
1018
- /**
1019
- * Sets the `BrowserContext`'s geolocation.
1020
- *
1021
- * @deprecated Use "k6/browser" module instead.
1022
- */
1023
- setGeolocation(
1024
- geolocation?: {
1025
- /**
1026
- * latitude should be between -90 and 90.
1027
- *
1028
- * @deprecated Use "k6/browser" module instead.
1029
- */
1030
- latitude: number;
1031
-
1032
- /**
1033
- * longitude should be between -180 and 180.
1034
- *
1035
- * @deprecated Use "k6/browser" module instead.
1036
- */
1037
- longitude: number;
1038
-
1039
- /**
1040
- * accuracy should only be a non-negative number. Defaults to 0.
1041
- *
1042
- * @deprecated Use "k6/browser" module instead.
1043
- */
1044
- accuracy: number;
1045
- },
1046
- ): void;
1047
-
1048
- /**
1049
- * Toggles the `BrowserContext`'s connectivity on/off.
1050
- *
1051
- * @deprecated Use "k6/browser" module instead.
1052
- */
1053
- setOffline(
1054
- /**
1055
- * Whether to emulate the BrowserContext being disconnected (`true`)
1056
- * or connected (`false`). Defaults to `false`.
1057
- *
1058
- * @deprecated Use "k6/browser" module instead.
1059
- */
1060
- offline: boolean,
1061
- ): void;
1062
-
1063
- /**
1064
- * Waits for the event to fire and passes its value into the predicate
1065
- * function. Currently the only supported event is 'page' which when used will
1066
- * return the new {@link Page} that was created after `waitForEvent` was called.
1067
- *
1068
- * @example
1069
- * ```js
1070
- * // Call waitForEvent with a predicate which will return true once at least
1071
- * // one page has been created.
1072
- * const promise = context.waitForEvent("page", { predicate: page => {
1073
- * if (++counter >= 1) {
1074
- * return true
1075
- * }
1076
- * return false
1077
- * } })
1078
- *
1079
- * // Now we create a page.
1080
- * const page = context.newPage()
1081
- *
1082
- * // Wait for the predicate to pass.
1083
- * await promise
1084
- * ```
1085
- *
1086
- * @deprecated Use "k6/browser" module instead.
1087
- */
1088
- waitForEvent(
1089
- /**
1090
- * Name of event to wait for. The only supported event is 'page'. If any
1091
- * other value is used an error will be thrown.
1092
- *
1093
- * @deprecated Use "k6/browser" module instead.
1094
- */
1095
- event: "page",
1096
- /**
1097
- * This is an optional argument. It can either be a predicate function or
1098
- * an options object.
1099
- *
1100
- * @deprecated Use "k6/browser" module instead.
1101
- */
1102
- optionsOrPredicate?: {
1103
- /**
1104
- * Optional function that will be called when the {@link Page} event is
1105
- * emitted. The event data will be passed to it and it must return true
1106
- * to continue.
1107
- *
1108
- * If {@link Page} is passed to predicate, this signals that a new page
1109
- * has been created.
1110
- *
1111
- * @deprecated Use "k6/browser" module instead.
1112
- */
1113
- predicate?: (page: Page) => boolean;
1114
-
1115
- /**
1116
- * Maximum time to wait in milliseconds. Defaults to 30000 milliseconds or
1117
- * the timeout set by setDefaultTimeout on the {@link BrowserContext}.
1118
- *
1119
- * @deprecated Use "k6/browser" module instead.
1120
- */
1121
- timeout?: number;
1122
- } | ((page: Page) => boolean),
1123
- ): Promise<Page>;
1124
- }
1125
-
1126
- /**
1127
- * {@link ConsoleMessage} objects are dispatched by page via the
1128
- * `page.on('console')` event. For each console message logged in the page,
1129
- * k6 browser delivers it to the registered handlers.
1130
- *
1131
- * ```js
1132
- * // Listen for all console log messages in the browser page and output them
1133
- * // in the test logs
1134
- * page.on('console', msg => console.log(msg.text()));
1135
- *
1136
- * // Listen for all console events and handle errors
1137
- * page.on('console', msg => {
1138
- * if (msg.type() === 'error')
1139
- * console.log(`Error text: "${msg.text()}"`);
1140
- * });
1141
- *
1142
- * // Deconstruct console log arguments
1143
- * await msg.args()[0].jsonValue(); // hello
1144
- * await msg.args()[1].jsonValue(); // 42
1145
- * ```
1146
- *
1147
- * @deprecated Use "k6/browser" module instead.
1148
- */
1149
- export interface ConsoleMessage {
1150
- /**
1151
- * List of arguments passed to a `console` function call. See also
1152
- * `page.on('console')`.
1153
- *
1154
- * @deprecated Use "k6/browser" module instead.
1155
- */
1156
- args(): JSHandle[];
1157
-
1158
- /**
1159
- * The page that produced this console message, if any.
1160
- *
1161
- * @deprecated Use "k6/browser" module instead.
1162
- */
1163
- page(): null | Page;
1164
-
1165
- /**
1166
- * The text of the console message.
1167
- *
1168
- * @deprecated Use "k6/browser" module instead.
1169
- */
1170
- text(): string;
1171
-
1172
- /**
1173
- * One of the following values: `'log'`, `'debug'`, `'info'`, `'error'`,
1174
- * `'warning'`, `'dir'`, `'dirxml'`, `'table'`, `'trace'`, `'clear'`,
1175
- * `'startGroup'`, `'startGroupCollapsed'`, `'endGroup'`, `'assert'`,
1176
- * `'profile'`, `'profileEnd'`, `'count'`, `'timeEnd'`.
1177
- *
1178
- * @deprecated Use "k6/browser" module instead.
1179
- */
1180
- type(): string;
1181
- }
1182
-
1183
- /**
1184
- * {@link Cookie} represents a cookie in a {@link BrowserContext}.
1185
- *
1186
- * @see
1187
- * {@link BrowserContext} has methods to {@link BrowserContext.addCookies | add}, {@link BrowserContext.cookies | query} and {@link BrowserContext.clearCookies | clear} cookies.
1188
- *
1189
- * @deprecated Use "k6/browser" module instead.
1190
- */
1191
- export interface Cookie {
1192
- /**
1193
- * The {@link Cookie | cookie}'s name.
1194
- *
1195
- * @defaultValue
1196
- * The default is `''`.
1197
- *
1198
- * @deprecated Use "k6/browser" module instead.
1199
- */
1200
- name: string;
1201
-
1202
- /**
1203
- * The {@link Cookie | cookie}'s value.
1204
- *
1205
- * @defaultValue
1206
- * The default is `''`.
1207
- *
1208
- * @deprecated Use "k6/browser" module instead.
1209
- */
1210
- value: string;
1211
-
1212
- /**
1213
- * The {@link Cookie | cookie}'s URL.
1214
- *
1215
- * Required unless one of {@link Cookie.domain | domain} or {@link Cookie.path | path} are specified.
1216
- *
1217
- * @deprecated Use "k6/browser" module instead.
1218
- */
1219
- url?: string;
1220
-
1221
- /**
1222
- * The {@link Cookie | cookie}'s domain.
1223
- *
1224
- * Required unless one of {@link Cookie.url | url} or {@link Cookie.path | path} are specified.
1225
- *
1226
- * @deprecated Use "k6/browser" module instead.
1227
- */
1228
- domain?: string;
1229
-
1230
- /**
1231
- * The {@link Cookie | cookie}'s path.
1232
- *
1233
- * Required unless one of {@link Cookie.url | url} or {@link Cookie.domain | domain} are specified.
1234
- *
1235
- * @defaultValue
1236
- * The default is `'/'`.
1237
- *
1238
- * @deprecated Use "k6/browser" module instead.
1239
- */
1240
- path?: string;
1241
-
1242
- /**
1243
- * The {@link Cookie | cookie}'s expiration date as the number of seconds since the UNIX epoch.
1244
- *
1245
- * If omitted, the {@link Cookie | cookie} becomes a session cookie.
1246
- *
1247
- * @defaultValue
1248
- * The default is `-1`, meaning a session cookie.
1249
- *
1250
- * @deprecated Use "k6/browser" module instead.
1251
- */
1252
- expires?: number;
1253
-
1254
- /**
1255
- * Whether the {@link Cookie | cookie} is http-only.
1256
- *
1257
- * @defaultValue
1258
- * The default is `false`.
1259
- *
1260
- * @deprecated Use "k6/browser" module instead.
1261
- */
1262
- httpOnly?: boolean;
1263
-
1264
- /**
1265
- * Whether the {@link Cookie | cookie} is secure.
1266
- *
1267
- * @defaultValue
1268
- * The default is `false`.
1269
- *
1270
- * @deprecated Use "k6/browser" module instead.
1271
- */
1272
- secure?: boolean;
1273
-
1274
- /**
1275
- * The {@link Cookie | cookie}'s same-site status.
1276
- *
1277
- * It can be one of `'Strict'`, `'Lax'`, or `'None'`.
1278
- *
1279
- * @defaultValue
1280
- * The default is `'Lax'`.
1281
- *
1282
- * @deprecated Use "k6/browser" module instead.
1283
- */
1284
- sameSite?: CookieSameSite;
1285
- }
1286
-
1287
- /**
1288
- * CookieSameSite represents the same-site status of a {@link Cookie | cookie}.
1289
- *
1290
- * @defaultValue
1291
- * The default is `'Lax'`.
1292
- *
1293
- * @deprecated Use "k6/browser" module instead.
1294
- */
1295
- export type CookieSameSite = "Strict" | "Lax" | "None";
1296
-
1297
- /**
1298
- * ElementHandle represents an in-page DOM element.
1299
- *
1300
- * @deprecated Use "k6/browser" module instead.
1301
- */
1302
- export interface ElementHandle extends JSHandle {
1303
- /**
1304
- * Finds an element matching the specified selector in the `ElementHandle`'s subtree.
1305
- * @param selector A selector to query element for.
1306
- * @returns An `ElementHandle` pointing to the result element or `null`.
1307
- *
1308
- * @deprecated Use "k6/browser" module instead.
1309
- */
1310
- $(selector: string): ElementHandle | null;
1311
-
1312
- /**
1313
- * Finds all elements matching the specified selector in the `ElementHandle`'s subtree.
1314
- * @param selector A selector to query element for.
1315
- * @returns A list of `ElementHandle`s pointing to the result elements.
1316
- *
1317
- * @deprecated Use "k6/browser" module instead.
1318
- */
1319
- $$(selector: string): ElementHandle[];
1320
-
1321
- /**
1322
- * This method returns the bounding box of the element.
1323
- * @returns Element's bounding box.
1324
- *
1325
- * @deprecated Use "k6/browser" module instead.
1326
- */
1327
- boundingBox(): Rect;
1328
-
1329
- /**
1330
- * Checks the checkbox element.
1331
- * @param options The options to use.
1332
- *
1333
- * @deprecated Use "k6/browser" module instead.
1334
- */
1335
- check(options?: ElementClickOptions & StrictnessOptions): void;
1336
-
1337
- /**
1338
- * Clicks the element.
1339
- * @param options The options to use.
1340
- * @returns A promise that resolves when the element is clicked.
1341
- *
1342
- * @deprecated Use "k6/browser" module instead.
1343
- */
1344
- click(
1345
- options?: {
1346
- /**
1347
- * The mouse button (`left`, `middle` or `right`) to use during the action.
1348
- * Defaults to `left`.
1349
- *
1350
- * @deprecated Use "k6/browser" module instead.
1351
- */
1352
- button?: MouseButton;
1353
-
1354
- /**
1355
- * The number of times the action is performed. Defaults to `1`.
1356
- *
1357
- * @deprecated Use "k6/browser" module instead.
1358
- */
1359
- clickCount?: number;
1360
-
1361
- /**
1362
- * Milliseconds to wait between `mousedown` and `mouseup`. Defaults to `0`.
1363
- *
1364
- * @deprecated Use "k6/browser" module instead.
1365
- */
1366
- delay?: number;
1367
-
1368
- /**
1369
- * Setting this to `true` will bypass the actionability checks (`visible`,
1370
- * `stable`, `enabled`). Defaults to `false`.
1371
- *
1372
- * @deprecated Use "k6/browser" module instead.
1373
- */
1374
- force?: boolean;
1375
-
1376
- /**
1377
- * `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the
1378
- * action. If not specified, currently pressed modifiers are used,
1379
- * otherwise defaults to `null`.
1380
- *
1381
- * @deprecated Use "k6/browser" module instead.
1382
- */
1383
- modifiers?: KeyboardModifier[];
1384
-
1385
- /**
1386
- * If set to `true` and a navigation occurs from performing this action, it
1387
- * will not wait for it to complete. Defaults to `false`.
1388
- *
1389
- * @deprecated Use "k6/browser" module instead.
1390
- */
1391
- noWaitAfter?: boolean;
1392
-
1393
- /**
1394
- * A point to use relative to the top left corner of the element. If not
1395
- * supplied, a visible point of the element is used.
1396
- *
1397
- * @deprecated Use "k6/browser" module instead.
1398
- */
1399
- position?: {
1400
- x: number;
1401
-
1402
- y: number;
1403
- };
1404
-
1405
- /**
1406
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
1407
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
1408
- * `page` methods.
1409
- *
1410
- * Setting the value to `0` will disable the timeout.
1411
- *
1412
- * @deprecated Use "k6/browser" module instead.
1413
- */
1414
- timeout?: number;
1415
-
1416
- /**
1417
- * Setting this to `true` will perform the actionability checks without
1418
- * performing the action. Useful to wait until the element is ready for the
1419
- * action without performing it. Defaults to `false`.
1420
- *
1421
- * @deprecated Use "k6/browser" module instead.
1422
- */
1423
- trial?: boolean;
1424
- },
1425
- ): Promise<void>;
1426
-
1427
- /**
1428
- * Get the content frame for element handles.
1429
- * @returns The content frame handle of the element handle.
1430
- *
1431
- * @deprecated Use "k6/browser" module instead.
1432
- */
1433
- contentFrame(): Frame;
1434
-
1435
- /**
1436
- * Double clicks the element.
1437
- * @param options The options to use.
1438
- *
1439
- * @deprecated Use "k6/browser" module instead.
1440
- */
1441
- dblclick(
1442
- options?: {
1443
- /**
1444
- * The mouse button (`left`, `middle` or `right`) to use during the action.
1445
- * Defaults to `left`.
1446
- *
1447
- * @deprecated Use "k6/browser" module instead.
1448
- */
1449
- button?: MouseButton;
1450
-
1451
- /**
1452
- * Milliseconds to wait between `mousedown` and `mouseup`. Defaults to `0`.
1453
- *
1454
- * @deprecated Use "k6/browser" module instead.
1455
- */
1456
- delay?: number;
1457
-
1458
- /**
1459
- * Setting this to `true` will bypass the actionability checks (`visible`,
1460
- * `stable`, `enabled`). Defaults to `false`.
1461
- *
1462
- * @deprecated Use "k6/browser" module instead.
1463
- */
1464
- force?: boolean;
1465
-
1466
- /**
1467
- * `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the
1468
- * action. If not specified, currently pressed modifiers are used,
1469
- * otherwise defaults to `null`.
1470
- *
1471
- * @deprecated Use "k6/browser" module instead.
1472
- */
1473
- modifiers?: KeyboardModifier[];
1474
-
1475
- /**
1476
- * If set to `true` and a navigation occurs from performing this action, it
1477
- * will not wait for it to complete. Defaults to `false`.
1478
- *
1479
- * @deprecated Use "k6/browser" module instead.
1480
- */
1481
- noWaitAfter?: boolean;
1482
-
1483
- /**
1484
- * A point to use relative to the top left corner of the element. If not
1485
- * supplied, a visible point of the element is used.
1486
- *
1487
- * @deprecated Use "k6/browser" module instead.
1488
- */
1489
- position?: {
1490
- x: number;
1491
-
1492
- y: number;
1493
- };
1494
-
1495
- /**
1496
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
1497
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
1498
- * `page` methods.
1499
- *
1500
- * Setting the value to `0` will disable the timeout.
1501
- *
1502
- * @deprecated Use "k6/browser" module instead.
1503
- */
1504
- timeout?: number;
1505
-
1506
- /**
1507
- * Setting this to `true` will perform the actionability checks without
1508
- * performing the action. Useful to wait until the element is ready for the
1509
- * action without performing it. Defaults to `false`.
1510
- *
1511
- * @deprecated Use "k6/browser" module instead.
1512
- */
1513
- trial?: boolean;
1514
- },
1515
- ): void;
1516
-
1517
- /**
1518
- * Dispatches a DOM event to the element.
1519
- * @param type DOM event type: `"click"` etc.
1520
- * @param eventInit Optional event-specific initialization properties.
1521
- * @param options
1522
- *
1523
- * @deprecated Use "k6/browser" module instead.
1524
- */
1525
- dispatchEvent(
1526
- type: string,
1527
- eventInit?: EvaluationArgument,
1528
- ): void;
1529
-
1530
- /**
1531
- * Fill the `input` or `textarea` element with the provided `value`.
1532
- * @param value Value to fill for the `input` or `textarea` element.
1533
- * @param options Element handle options.
1534
- *
1535
- * @deprecated Use "k6/browser" module instead.
1536
- */
1537
- fill(value: string, options?: ElementHandleOptions): void;
1538
-
1539
- /**
1540
- * Focuses the element.
1541
- *
1542
- * @deprecated Use "k6/browser" module instead.
1543
- */
1544
- focus(): void;
1545
-
1546
- /**
1547
- * Fetch the element's attribute value.
1548
- * @param name Attribute name to get the value for.
1549
- * @returns Attribute value.
1550
- *
1551
- * @deprecated Use "k6/browser" module instead.
1552
- */
1553
- getAttribute(name: string): string | null;
1554
-
1555
- /**
1556
- * Scrolls element into view and hovers over its center point.
1557
- * @param options Hover options.
1558
- *
1559
- * @deprecated Use "k6/browser" module instead.
1560
- */
1561
- hover(options?: ElementClickOptions & KeyboardModifierOptions): void;
1562
-
1563
- /**
1564
- * Returns the `element.innerHTML`.
1565
- * @returns Element's innerHTML.
1566
- *
1567
- * @deprecated Use "k6/browser" module instead.
1568
- */
1569
- innerHTML(): string;
1570
-
1571
- /**
1572
- * Returns the `element.innerText`.
1573
- * @returns Element's innerText.
1574
- *
1575
- * @deprecated Use "k6/browser" module instead.
1576
- */
1577
- innerText(): string;
1578
-
1579
- /**
1580
- * Returns `input.value` for the selected `input`, `textarea` or `select` element.
1581
- * @returns The input value of the element.
1582
- *
1583
- * @deprecated Use "k6/browser" module instead.
1584
- */
1585
- inputValue(options?: TimeoutOptions): string;
1586
-
1587
- /**
1588
- * Checks if a checkbox or radio is checked.
1589
- * @returns Whether the element is checked.
1590
- *
1591
- * @deprecated Use "k6/browser" module instead.
1592
- */
1593
- isChecked(): boolean;
1594
-
1595
- /**
1596
- * Checks if the element is disabled.
1597
- * @returns Whether the element is disabled.
1598
- *
1599
- * @deprecated Use "k6/browser" module instead.
1600
- */
1601
- isDisabled(): boolean;
1602
-
1603
- /**
1604
- * Checks if the element is editable.
1605
- * @returns Whether the element is editable.
1606
- *
1607
- * @deprecated Use "k6/browser" module instead.
1608
- */
1609
- isEditable(): boolean;
1610
-
1611
- /**
1612
- * Checks if the element is enabled.
1613
- * @returns Whether the element is enabled.
1614
- *
1615
- * @deprecated Use "k6/browser" module instead.
1616
- */
1617
- isEnabled(): boolean;
1618
-
1619
- /**
1620
- * Checks if the element is hidden.
1621
- * @returns Whether the element is hidden.
1622
- *
1623
- * @deprecated Use "k6/browser" module instead.
1624
- */
1625
- isHidden(): boolean;
1626
-
1627
- /**
1628
- * Checks if the element is visible.
1629
- * @returns Whether the element is visible.
1630
- *
1631
- * @deprecated Use "k6/browser" module instead.
1632
- */
1633
- isVisible(): boolean;
1634
-
1635
- /**
1636
- * Returns the frame containing the given element.
1637
- * @returns The frame that contains the element handle.
1638
- *
1639
- * @deprecated Use "k6/browser" module instead.
1640
- */
1641
- ownerFrame(): Frame;
1642
-
1643
- /**
1644
- * Focuses the element, and then uses `keyboard.down` and `keyboard.up` with the specified key.
1645
- * @param key A keyboard key name or a single character to press.
1646
- * @param options Keyboard press options.
1647
- *
1648
- * @deprecated Use "k6/browser" module instead.
1649
- */
1650
- press(key: string, options?: KeyboardPressOptions): void;
1651
-
1652
- /**
1653
- * This method scrolls element into view, if needed, and then captures a
1654
- * screenshot of it.
1655
- * @param options Screenshot options.
1656
- * @returns An `ArrayBuffer` with the screenshot data.
1657
- *
1658
- * @deprecated Use "k6/browser" module instead.
1659
- */
1660
- screenshot(options?: ScreenshotOptions & TimeoutOptions): ArrayBuffer;
1661
-
1662
- /**
1663
- * This method checks whether the element is actionable using provided options, and
1664
- * then tries to scroll it into view, unless it is completely visible.
1665
- * @param options Element handle options.
1666
- *
1667
- * @deprecated Use "k6/browser" module instead.
1668
- */
1669
- scrollIntoViewIfNeeded(options?: ElementHandleOptions): void;
1670
-
1671
- /**
1672
- * Select one or more options of a `<select>` element which match the values.
1673
- * @param values Values of options to select.
1674
- * @param options Element handle options.
1675
- * @returns List of selected options.
1676
- *
1677
- * @deprecated Use "k6/browser" module instead.
1678
- */
1679
- selectOption(
1680
- values: string | ElementHandle | SelectOptionsObject | string[] | ElementHandle[] | SelectOptionsObject[],
1681
- options?: ElementHandleOptions,
1682
- ): string[];
1683
-
1684
- /**
1685
- * Focuses the element and selects all its text content.
1686
- * @param options Element handle options.
1687
- *
1688
- * @deprecated Use "k6/browser" module instead.
1689
- */
1690
- selectText(options?: ElementHandleOptions): void;
1691
-
1692
- /**
1693
- * Sets the file input element's value to the specified files.
1694
- *
1695
- * To work with local files on the file system, use the experimental
1696
- * fs module to load and read the file contents.
1697
- *
1698
- * The {@link ElementHandle | element handle} must be an [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
1699
- * @param files
1700
- * @param options
1701
- *
1702
- * @deprecated Use "k6/browser" module instead.
1703
- */
1704
- setInputFiles(files: File | File[], options?: {
1705
- /**
1706
- * Maximum time in milliseconds. Pass 0 to disable the timeout. Default
1707
- * is overridden by the setDefaultTimeout option on {@link BrowserContext} or
1708
- * {@link Page}.
1709
- * @default 30000
1710
- *
1711
- * @deprecated Use "k6/browser" module instead.
1712
- */
1713
- timeout?: number;
1714
-
1715
- /**
1716
- * If set to `true` and a navigation occurs from performing this action, it
1717
- * does not wait for it to complete.
1718
- * @default false
1719
- *
1720
- * @deprecated Use "k6/browser" module instead.
1721
- */
1722
- noWaitAfter?: boolean;
1723
- }): void;
1724
-
1725
- /**
1726
- * Scrolls element into view if needed, and then uses `page.tapscreen` to tap in the center of the element
1727
- * or at the specified position.
1728
- * @param options Tap options.
1729
- *
1730
- * @deprecated Use "k6/browser" module instead.
1731
- */
1732
- tap(options?: MouseMoveOptions): void;
1733
-
1734
- /**
1735
- * Returns the `node.textContent`.
1736
- * @returns The text content of the element.
1737
- *
1738
- * @deprecated Use "k6/browser" module instead.
1739
- */
1740
- textContent(): string;
1741
-
1742
- /**
1743
- * Scrolls element into view, focuses element and types text.
1744
- * @param text Text to type into the element.
1745
- * @param options Typing options.
1746
- *
1747
- * @deprecated Use "k6/browser" module instead.
1748
- */
1749
- type(text: string, options?: KeyboardPressOptions): void;
1750
-
1751
- /**
1752
- * Scrolls element into view, and if it's an input element of type
1753
- * checkbox that is already checked, clicks on it to mark it as unchecked.
1754
- * @param options Click options.
1755
- *
1756
- * @deprecated Use "k6/browser" module instead.
1757
- */
1758
- uncheck(options?: ElementClickOptions & StrictnessOptions): void;
1759
-
1760
- /**
1761
- * Returns when the element satisfies the `state`.
1762
- * @param state Wait for element to satisfy this state.
1763
- * @param options Wait options.
1764
- *
1765
- * @deprecated Use "k6/browser" module instead.
1766
- */
1767
- waitForElementState(state: InputElementState, options?: TimeoutOptions): void;
1768
-
1769
- /**
1770
- * Returns when the child element matching `selector` satisfies the `state`.
1771
- * @param selector A selector to query for.
1772
- * @param options Wait options.
1773
- *
1774
- * @deprecated Use "k6/browser" module instead.
1775
- */
1776
- waitForSelector(
1777
- selector: string,
1778
- options?: { state?: ElementState } & StrictnessOptions & TimeoutOptions,
1779
- ): ElementHandle;
1780
- }
1781
-
1782
- /**
1783
- * Frame represents the frame within a page. A page is made up of hierarchy of frames.
1784
- *
1785
- * @deprecated Use "k6/browser" module instead.
1786
- */
1787
- export interface Frame {
1788
- /**
1789
- * Finds an element matching the specified selector within the `Frame`.
1790
- * @param selector A selector to query element for.
1791
- * @returns An `ElementHandle` pointing to the result element or `null`.
1792
- *
1793
- * @deprecated Use "k6/browser" module instead.
1794
- */
1795
- $(selector: string): ElementHandle | null;
1796
-
1797
- /**
1798
- * Finds all elements matching the specified selector within the `Frame`.
1799
- * @param selector A selector to query element for.
1800
- * @returns A list of `ElementHandle`s pointing to the result elements.
1801
- *
1802
- * @deprecated Use "k6/browser" module instead.
1803
- */
1804
- $$(selector: string): ElementHandle[];
1805
-
1806
- /**
1807
- * Checks the first checkbox element found that matches selector.
1808
- * @param selector The selector to use.
1809
- * @param options The options to use.
1810
- *
1811
- * @deprecated Use "k6/browser" module instead.
1812
- */
1813
- check(selector: string, options?: ElementClickOptions & StrictnessOptions): void;
1814
-
1815
- /**
1816
- * Uncheck the first found element that matches the selector.
1817
- * @param selector The selector to use.
1818
- * @param options The options to use.
1819
- *
1820
- * @deprecated Use "k6/browser" module instead.
1821
- */
1822
- uncheck(selector: string, options?: ElementClickOptions & StrictnessOptions): void;
1823
-
1824
- /**
1825
- * Clicks the element.
1826
- * @param selector The selector to use.
1827
- * @param options The options to use.
1828
- * @returns A promise that resolves when the element is clicked.
1829
- *
1830
- * @deprecated Use "k6/browser" module instead.
1831
- */
1832
- click(selector: string, options?: MouseMultiClickOptions & StrictnessOptions): Promise<void>;
1833
-
1834
- /**
1835
- * Double clicks the element.
1836
- * @param selector The selector to use.
1837
- * @param options The options to use.
1838
- *
1839
- * @deprecated Use "k6/browser" module instead.
1840
- */
1841
- dblclick(selector: string, options?: MouseClickOptions & MouseMoveOptions & StrictnessOptions): void;
1842
-
1843
- /**
1844
- * Fills out the first element found that matches the selector.
1845
- * @param selector The selector to use.
1846
- * @param value The value to fill.
1847
- * @param options The options to use.
1848
- *
1849
- * @deprecated Use "k6/browser" module instead.
1850
- */
1851
- fill(selector: string, value: string, options?: ElementHandleOptions & StrictnessOptions): void;
1852
-
1853
- /**
1854
- * Focuses the first element found that matches the selector.
1855
- * @param selector The selector to use.
1856
- * @param options The options to use.
1857
- *
1858
- * @deprecated Use "k6/browser" module instead.
1859
- */
1860
- focus(selector: string, options?: TimeoutOptions & StrictnessOptions): void;
1861
-
1862
- /**
1863
- * Hovers the first element found that matches the selector.
1864
- * @param selector The selector to use.
1865
- * @param options The options to use.
1866
- *
1867
- * @deprecated Use "k6/browser" module instead.
1868
- */
1869
- hover(selector: string, options?: ElementClickOptions & KeyboardModifierOptions & StrictnessOptions): void;
1870
-
1871
- /**
1872
- * Taps the first element found that matches the selector.
1873
- * @param selector The selector to use.
1874
- * @param options The options to use.
1875
- *
1876
- * @deprecated Use "k6/browser" module instead.
1877
- */
1878
- tap(selector: string, options?: ElementClickOptions & KeyboardModifierOptions & StrictnessOptions): void;
1879
-
1880
- /**
1881
- * Press the given key for the first element found that matches the selector.
1882
- * @param selector The selector to use.
1883
- * @param key The key to press.
1884
- * @param options The options to use.
1885
- *
1886
- * @deprecated Use "k6/browser" module instead.
1887
- */
1888
- press(selector: string, key: string, options?: KeyboardPressOptions & StrictnessOptions): void;
1889
-
1890
- /**
1891
- * Type the given text for the first element found that matches the selector.
1892
- * @param selector The selector to use.
1893
- * @param text The text to type.
1894
- * @param options The options to use.
1895
- *
1896
- * @deprecated Use "k6/browser" module instead.
1897
- */
1898
- type(selector: string, text: string, options?: KeyboardPressOptions & StrictnessOptions): void;
1899
-
1900
- /**
1901
- * Select the given options and return the array of option values of the first element
1902
- * found that matches the selector.
1903
- * @param selector The selector to use.
1904
- * @param values The values to select.
1905
- * @returns The array of option values of the first element found.
1906
- *
1907
- * @deprecated Use "k6/browser" module instead.
1908
- */
1909
- selectOption(
1910
- selector: string,
1911
- values: string | ElementHandle | SelectOptionsObject | string[] | ElementHandle[] | SelectOptionsObject[],
1912
- options?: ElementHandleOptions & StrictnessOptions,
1913
- ): string[];
1914
-
1915
- /**
1916
- * Dispatches an event for the first element matching the selector.
1917
- * @param selector The selector to use.
1918
- * @param type The type of event to dispatch.
1919
- * @param eventInit The event initialization properties.
1920
- * @param options The options to use.
1921
- *
1922
- * @deprecated Use "k6/browser" module instead.
1923
- */
1924
- dispatchEvent(
1925
- selector: string,
1926
- type: string,
1927
- eventInit?: object,
1928
- options?: TimeoutOptions & StrictnessOptions,
1929
- ): void;
1930
-
1931
- /**
1932
- * Returns the value of the `pageFunction` invocation.
1933
- *
1934
- * A string can also be passed in instead of a function.
1935
- *
1936
- * @param pageFunction Function to be evaluated in the page context.
1937
- * @param arg Optional argument to pass to `pageFunction`.
1938
- *
1939
- * @deprecated Use "k6/browser" module instead.
1940
- */
1941
- evaluate<R, Arg>(pageFunction: PageFunction<Arg, R>, arg?: Arg): R;
1942
-
1943
- /**
1944
- * Returns the value of the `pageFunction` invocation as a [JSHandle].
1945
- *
1946
- * The only difference between page.evaluate(pageFunction[, arg]) and
1947
- * page.evaluateHandle(pageFunction[, arg]) is that
1948
- * page.evaluateHandle(pageFunction[, arg])returns [JSHandle].
1949
- *
1950
- * @param pageFunction Function to be evaluated in the page context.
1951
- * @param arg Optional argument to pass to `pageFunction`.
1952
- *
1953
- * @deprecated Use "k6/browser" module instead.
1954
- */
1955
- evaluateHandle<R, Arg>(pageFunction: PageFunction<Arg, R>, arg?: Arg): JSHandle<R>;
1956
-
1957
- /**
1958
- * Get the page that owns frame.
1959
- * @returns The page that owns frame.
1960
- *
1961
- * @deprecated Use "k6/browser" module instead.
1962
- */
1963
- page(): Page;
1964
-
1965
- /**
1966
- * Get the parent frame.
1967
- * @returns The parent frame, or `null` if there is no parent frame.
1968
- *
1969
- * @deprecated Use "k6/browser" module instead.
1970
- */
1971
- parentFrame(): Frame | null;
1972
-
1973
- /**
1974
- * Get a list of all child frames.
1975
- * @returns A list of all child frames.
1976
- *
1977
- * @deprecated Use "k6/browser" module instead.
1978
- */
1979
- childFrames(): Frame[];
1980
-
1981
- /**
1982
- * Get the `ElementHandle` for this frame.
1983
- * @returns The `ElementHandle` for this frame.
1984
- *
1985
- * @deprecated Use "k6/browser" module instead.
1986
- */
1987
- frameElement(): ElementHandle;
1988
-
1989
- /**
1990
- * Navigate the frame to the specified URL and return a HTTP response object.
1991
- * @param url The URL to navigate to.
1992
- * @param options The options to use.
1993
- * @returns A promise that resolves to the HTTP response object.
1994
- *
1995
- * @deprecated Use "k6/browser" module instead.
1996
- */
1997
- goto(url: string, options?: NavigationOptions): Promise<Response | null>;
1998
-
1999
- /**
2000
- * Replace the entire HTML document content.
2001
- * @param html The HTML to use.
2002
- * @param options The options to use.
2003
- *
2004
- * @deprecated Use "k6/browser" module instead.
2005
- */
2006
- setContent(html: string, options?: ContentLoadOptions): void;
2007
-
2008
- /**
2009
- * Get the name of the frame.
2010
- * @returns The name of the frame.
2011
- *
2012
- * @deprecated Use "k6/browser" module instead.
2013
- */
2014
- name(): string;
2015
-
2016
- /**
2017
- * Get the title of the frame.
2018
- * @returns The title of the frame.
2019
- *
2020
- * @deprecated Use "k6/browser" module instead.
2021
- */
2022
- title(): string;
2023
-
2024
- /**
2025
- * Get the URL of the frame.
2026
- * @returns The URL of the frame.
2027
- *
2028
- * @deprecated Use "k6/browser" module instead.
2029
- */
2030
- url(): string;
2031
-
2032
- /**
2033
- * Get the HTML content of the frame.
2034
- * @returns The HTML content of the frame.
2035
- *
2036
- * @deprecated Use "k6/browser" module instead.
2037
- */
2038
- content(): string;
2039
-
2040
- /**
2041
- * Get whether the frame is detached or not.
2042
- * @returns `true` if the frame is detached, `false` otherwise.
2043
- *
2044
- * @deprecated Use "k6/browser" module instead.
2045
- */
2046
- isDetached(): boolean;
2047
-
2048
- /**
2049
- * Сreates and returns a new locator for this frame.
2050
- * @param selector The selector to use.
2051
- * @returns The new locator.
2052
- *
2053
- * @deprecated Use "k6/browser" module instead.
2054
- */
2055
- locator(selector: string): Locator;
2056
-
2057
- /**
2058
- * Get the `innerHTML` attribute of the first element found that matches the selector.
2059
- * @param selector The selector to use.
2060
- * @param options The options to use.
2061
- * @returns The `innerHTML` attribute of the first element found.
2062
- *
2063
- * @deprecated Use "k6/browser" module instead.
2064
- */
2065
- innerHTML(selector: string, options?: TimeoutOptions & StrictnessOptions): string;
2066
-
2067
- /**
2068
- * Get the `innerText` attribute of the first element found that matches the selector.
2069
- * @param selector The selector to use.
2070
- * @param options The options to use.
2071
- * @returns The `innerText` attribute of the first element found.
2072
- *
2073
- * @deprecated Use "k6/browser" module instead.
2074
- */
2075
- innerText(selector: string, options?: TimeoutOptions & StrictnessOptions): string;
2076
-
2077
- /**
2078
- * Get the text content of the first element found that matches the selector.
2079
- * @param selector The selector to use.
2080
- * @param options The options to use.
2081
- * @returns The text content of the first element found.
2082
- *
2083
- * @deprecated Use "k6/browser" module instead.
2084
- */
2085
- textContent(selector: string, options?: TimeoutOptions & StrictnessOptions): string;
2086
-
2087
- /**
2088
- * Get the value of an attribute of the first element found that matches the selector.
2089
- * @param selector The selector to use.
2090
- * @param name The name of the attribute to get.
2091
- * @param options The options to use.
2092
- * @returns The value of the attribute.
2093
- *
2094
- * @deprecated Use "k6/browser" module instead.
2095
- */
2096
- getAttribute(selector: string, name: string, options?: TimeoutOptions & StrictnessOptions): string;
2097
-
2098
- /**
2099
- * Get the input value of the first element found that matches the selector.
2100
- * @param selector The selector to use.
2101
- * @param options The options to use.
2102
- * @returns The input value of the first element found.
2103
- *
2104
- * @deprecated Use "k6/browser" module instead.
2105
- */
2106
- inputValue(selector: string, options?: TimeoutOptions & StrictnessOptions): string;
2107
-
2108
- /**
2109
- * Get the `checked` attribute of the first checkbox element found that matches the selector.
2110
- * @param selector The selector to use.
2111
- * @param options The options to use.
2112
- * @returns `true` if the checkbox is checked, `false` otherwise.
2113
- *
2114
- * @deprecated Use "k6/browser" module instead.
2115
- */
2116
- isChecked(selector: string, options?: TimeoutOptions & StrictnessOptions): boolean;
2117
-
2118
- /**
2119
- * Get whether the first element found that matches the selector is disabled or not.
2120
- * @param selector The selector to use.
2121
- * @param options The options to use.
2122
- * @returns `true` if the element is disabled, `false` otherwise.
2123
- *
2124
- * @deprecated Use "k6/browser" module instead.
2125
- */
2126
- isDisabled(selector: string, options?: TimeoutOptions & StrictnessOptions): boolean;
2127
-
2128
- /**
2129
- * Get whether the first element found that matches the selector is enabled or not.
2130
- * @param selector The selector to use.
2131
- * @param options The options to use.
2132
- * @returns `true` if the element is enabled, `false` otherwise.
2133
- *
2134
- * @deprecated Use "k6/browser" module instead.
2135
- */
2136
- isEnabled(selector: string, options?: TimeoutOptions & StrictnessOptions): boolean;
2137
-
2138
- /**
2139
- * Get whether the first element found that matches the selector is editable or not.
2140
- * @param selector The selector to use.
2141
- * @param options The options to use.
2142
- * @returns `true` if the element is editable, `false` otherwise.
2143
- *
2144
- * @deprecated Use "k6/browser" module instead.
2145
- */
2146
- isEditable(selector: string, options?: TimeoutOptions & StrictnessOptions): boolean;
2147
-
2148
- /**
2149
- * Get whether the first element found that matches the selector is hidden or not.
2150
- * @param selector The selector to use.
2151
- * @param options The options to use.
2152
- * @returns `true` if the element is hidden, `false` otherwise.
2153
- *
2154
- * @deprecated Use "k6/browser" module instead.
2155
- */
2156
- isHidden(selector: string, options?: StrictnessOptions): boolean;
2157
-
2158
- /**
2159
- * Get whether the first element found that matches the selector is visible or not.
2160
- * @param selector The selector to use.
2161
- * @param options The options to use.
2162
- * @returns `true` if the element is visible, `false` otherwise.
2163
- *
2164
- * @deprecated Use "k6/browser" module instead.
2165
- */
2166
- isVisible(selector: string, options?: StrictnessOptions): boolean;
2167
-
2168
- /**
2169
- * Sets the file input element's value to the specified files.
2170
- *
2171
- * To work with local files on the file system, use the experimental
2172
- * fs module to load and read the file contents.
2173
- *
2174
- * This method expects a `selector` to point to an
2175
- * [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
2176
- * @param selector A selector to search for an element. If there are multiple
2177
- * elements satisfying the selector, the first will be used.
2178
- * @param files
2179
- * @param options
2180
- *
2181
- * @deprecated Use "k6/browser" module instead.
2182
- */
2183
- setInputFiles(selector: string, files: File | File[], options?: {
2184
- /**
2185
- * Maximum time in milliseconds. Pass 0 to disable the timeout. Default
2186
- * is overridden by the setDefaultTimeout option on {@link BrowserContext} or
2187
- * {@link Page}
2188
- * @default 30000
2189
- *
2190
- * @deprecated Use "k6/browser" module instead.
2191
- */
2192
- timeout?: number;
2193
-
2194
- /**
2195
- * If set to `true` and a navigation occurs from performing this action, it
2196
- * will not wait for it to complete.
2197
- * @default false
2198
- *
2199
- * @deprecated Use "k6/browser" module instead.
2200
- */
2201
- noWaitAfter?: boolean;
2202
- }): void;
2203
-
2204
- /**
2205
- * Wait for the given function to return a truthy value.
2206
- * @param predicate The function to call and wait for.
2207
- * @param options The options to use.
2208
- *
2209
- * @deprecated Use "k6/browser" module instead.
2210
- */
2211
- waitForFunction<R, Arg>(
2212
- pageFunction: PageFunction<Arg, R>,
2213
- options?: PollingOptions & TimeoutOptions,
2214
- arg?: Arg,
2215
- ): Promise<JSHandle<R>>;
2216
-
2217
- /**
2218
- * Wait for the given load state to be reached.
2219
- * This will unblock if that lifecycle event has already been received.
2220
- * @param state The load state to wait for, defaults to `load`.
2221
- * @param options The options to use.
2222
- *
2223
- * @deprecated Use "k6/browser" module instead.
2224
- */
2225
- waitForLoadState(state?: LifecycleEvent, options?: TimeoutOptions): void;
2226
-
2227
- /**
2228
- * Waits for the navigation event to happen.
2229
- * @param options The options to use.
2230
- * @returns A promise that resolves to the response of the navigation when it happens.
2231
- *
2232
- * @deprecated Use "k6/browser" module instead.
2233
- */
2234
- waitForNavigation(options?: ContentLoadOptions): Promise<Response | null>;
2235
-
2236
- /**
2237
- * Wait for the given selector to match the waiting criteria.
2238
- * @param selector The selector to use.
2239
- * @param options The options to use.
2240
- * @returns The first element found that matches the selector.
2241
- *
2242
- * @deprecated Use "k6/browser" module instead.
2243
- */
2244
- waitForSelector(selector: string, options?: ElementStateFilter & TimeoutOptions & StrictnessOptions): ElementHandle;
2245
-
2246
- /**
2247
- * Wait for the given timeout to elapse.
2248
- * @param timeout The timeout to wait for.
2249
- *
2250
- * @deprecated Use "k6/browser" module instead.
2251
- */
2252
- waitForTimeout(timeout: number): void;
2253
- }
2254
-
2255
- /**
2256
- * JSHandle represents an in-page JavaScript object.
2257
- *
2258
- * @deprecated Use "k6/browser" module instead.
2259
- */
2260
- export interface JSHandle<T = any> {
2261
- /**
2262
- * Returns either `null` or the object handle itself, if the object handle is
2263
- * an instance of `ElementHandle`.
2264
- * @returns The ElementHandle if available.
2265
- *
2266
- * @deprecated Use "k6/browser" module instead.
2267
- */
2268
- asElement(): ElementHandle | null;
2269
-
2270
- /**
2271
- * Stops referencing the element handle.
2272
- *
2273
- * @deprecated Use "k6/browser" module instead.
2274
- */
2275
- dispose(): void;
2276
-
2277
- /**
2278
- * Evaluates the page function and returns its return value.
2279
- * This method passes this handle as the first argument to the page function.
2280
- * @param pageFunction The function to be evaluated.
2281
- * @param args The arguments to pass to the page function.
2282
- * @returns The return value of `pageFunction`.
2283
- *
2284
- * @deprecated Use "k6/browser" module instead.
2285
- */
2286
- evaluate<R, Arg>(pageFunction: PageFunction<Arg, R>, arg?: Arg): R;
2287
-
2288
- /**
2289
- * Evaluates the page function and returns a `JSHandle`.
2290
- * This method passes this handle as the first argument to the page function.
2291
- * Unlike `evaluate`, `evaluateHandle` returns the value as a `JSHandle`
2292
- * @param pageFunction The function to be evaluated.
2293
- * @param args The arguments to pass to the page function.
2294
- * @returns A JSHandle of the return value of `pageFunction`.
2295
- *
2296
- * @deprecated Use "k6/browser" module instead.
2297
- */
2298
- evaluateHandle<R, Arg>(pageFunction: PageFunction<Arg, R>, arg?: Arg): JSHandle<R>;
2299
-
2300
- /**
2301
- * Fetches a map with own property names of of the `JSHandle` with their values as
2302
- * `JSHandle` instances.
2303
- * @returns A map with property names as keys and `JSHandle` instances for the property values.
2304
- *
2305
- * @deprecated Use "k6/browser" module instead.
2306
- */
2307
- getProperties(): Map<string, JSHandle>;
2308
-
2309
- /**
2310
- * Fetches a JSON representation of the object.
2311
- * @returns A JSON representation of the object.
2312
- *
2313
- * @deprecated Use "k6/browser" module instead.
2314
- */
2315
- jsonValue(): any;
2316
- }
2317
-
2318
- /**
2319
- * Keyboard provides an API for managing a virtual keyboard.
2320
- *
2321
- * @deprecated Use "k6/browser" module instead.
2322
- */
2323
- export interface Keyboard {
2324
- /**
2325
- * Sends a key down message to a session target.
2326
- * A superset of the key values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values).
2327
- * @param key Name of key to press, such as `ArrowLeft`.
2328
- *
2329
- * @deprecated Use "k6/browser" module instead.
2330
- */
2331
- down(key: string): void;
2332
-
2333
- /**
2334
- * Dispatches an `input` event with the given `text`.
2335
- * This method does not emit `keyDown`, `keyUp` or `keyPress` events.
2336
- * @param text Event text.
2337
- *
2338
- * @deprecated Use "k6/browser" module instead.
2339
- */
2340
- insertText(text: string): void;
2341
-
2342
- /**
2343
- * Sends a key press message to a session target.
2344
- * A press message consists of successive key down and up messages.
2345
- * @param key Sequence of keys to press.
2346
- * @param options Specifies the typing options.
2347
- *
2348
- * @deprecated Use "k6/browser" module instead.
2349
- */
2350
- press(key: string, options?: { delay?: number }): void;
2351
-
2352
- /**
2353
- * Type sends a `press` message to a session target for each character in text.
2354
- * It sends an insertText message if a character is not among
2355
- * valid characters in the keyboard's layout.
2356
- * Modifier keys `Shift`, `Control`, `Alt`, `Meta` are _not_ respected.
2357
- * @param text A text to type into a focused element.
2358
- * @param options Specifies the typing options.
2359
- *
2360
- * @deprecated Use "k6/browser" module instead.
2361
- */
2362
- type(text: string, options?: { delay?: number }): void;
2363
-
2364
- /**
2365
- * Sends a key up message to a session target.
2366
- * A superset of the key values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values).
2367
- * @param key Name of key to release, such as `ArrowLeft`.
2368
- *
2369
- * @deprecated Use "k6/browser" module instead.
2370
- */
2371
- up(key: string): void;
2372
- }
2373
-
2374
- /**
2375
- * The Locator API makes it easier to work with dynamically changing elements.
2376
- * Some of the benefits of using it over existing ways to locate an element
2377
- * (e.g. Page.$()) include:
2378
- *
2379
- * - Helps with writing robust tests by finding an element even if the
2380
- * underlying frame navigates.
2381
- * - Makes it easier to work with dynamic web pages and SPAs built with Svelte,
2382
- * React, Vue, etc.
2383
- *
2384
- * @deprecated Use "k6/browser" module instead.
2385
- */
2386
- export interface Locator {
2387
- /**
2388
- * Clears text boxes and input fields of any existing values.
2389
- *
2390
- * **Usage**
2391
- *
2392
- * ```js
2393
- * // Clears the input field matching the selector.
2394
- * page.locator('input[name="login"]').clear();
2395
- * ```
2396
- *
2397
- * @param options Options to use.
2398
- *
2399
- * @deprecated Use "k6/browser" module instead.
2400
- */
2401
- clear(options?: ElementHandleOptions): void;
2402
-
2403
- /**
2404
- * Mouse click on the chosen element.
2405
- * @param options Options to use.
2406
- * @returns Promise which resolves when the element is successfully clicked.
2407
- *
2408
- * @deprecated Use "k6/browser" module instead.
2409
- */
2410
- click(options?: MouseMoveOptions & MouseMultiClickOptions): Promise<void>;
2411
-
2412
- /**
2413
- * Mouse double click on the chosen element.
2414
- * @param options Options to use.
2415
- *
2416
- * @deprecated Use "k6/browser" module instead.
2417
- */
2418
- dblclick(options?: MouseMoveOptions & MouseMultiClickOptions): void;
2419
-
2420
- /**
2421
- * Use this method to select an `input type="checkbox"`.
2422
- * @param options Options to use.
2423
- *
2424
- * @deprecated Use "k6/browser" module instead.
2425
- */
2426
- check(options?: ElementClickOptions): void;
2427
-
2428
- /**
2429
- * Use this method to unselect an `input type="checkbox"`.
2430
- * @param options Options to use.
2431
- *
2432
- * @deprecated Use "k6/browser" module instead.
2433
- */
2434
- uncheck(options?: ElementClickOptions): void;
2435
-
2436
- /**
2437
- * Checks to see if the `input type="checkbox"` is selected or not.
2438
- * @param options Options to use.
2439
- * @returns `true` if the element is checked, `false` otherwise.
2440
- *
2441
- * @deprecated Use "k6/browser" module instead.
2442
- */
2443
- isChecked(options?: TimeoutOptions): boolean;
2444
-
2445
- /**
2446
- * Checks if the element is editable.
2447
- * @param options Options to use.
2448
- * @returns `true` if the element is editable, `false` otherwise.
2449
- *
2450
- * @deprecated Use "k6/browser" module instead.
2451
- */
2452
- isEditable(options?: TimeoutOptions): boolean;
2453
-
2454
- /**
2455
- * Checks if the element is `enabled`.
2456
- * @param options Options to use.
2457
- * @returns `true` if the element is enabled, `false` otherwise.
2458
- *
2459
- * @deprecated Use "k6/browser" module instead.
2460
- */
2461
- isEnabled(options?: TimeoutOptions): boolean;
2462
-
2463
- /**
2464
- * Checks if the element is `disabled`.
2465
- * @param options Options to use.
2466
- * @returns `true` if the element is disabled, `false` otherwise.
2467
- *
2468
- * @deprecated Use "k6/browser" module instead.
2469
- */
2470
- isDisabled(options?: TimeoutOptions): boolean;
2471
-
2472
- /**
2473
- * Checks if the element is `visible`.
2474
- * @returns `true` if the element is visible, `false` otherwise.
2475
- *
2476
- * @deprecated Use "k6/browser" module instead.
2477
- */
2478
- isVisible(): boolean;
2479
-
2480
- /**
2481
- * Checks if the element is `hidden`.
2482
- * @returns `true` if the element is hidden, `false` otherwise.
2483
- *
2484
- * @deprecated Use "k6/browser" module instead.
2485
- */
2486
- isHidden(): boolean;
2487
-
2488
- /**
2489
- * Fill an `input`, `textarea` or `contenteditable` element with the provided value.
2490
- * @param value Value to fill for the `input` or `textarea` element.
2491
- * @param options Options to use.
2492
- *
2493
- * @deprecated Use "k6/browser" module instead.
2494
- */
2495
- fill(value: string, options?: ElementHandleOptions): void;
2496
-
2497
- /**
2498
- * Focuses the element using locator's selector.
2499
- * @param options Options to use.
2500
- *
2501
- * @deprecated Use "k6/browser" module instead.
2502
- */
2503
- focus(options?: TimeoutOptions): void;
2504
-
2505
- /**
2506
- * Returns the element attribute value for the given attribute name.
2507
- * @param name Attribute name to retrieve value for.
2508
- * @param options Options to use.
2509
- * @returns Attribute value.
2510
- *
2511
- * @deprecated Use "k6/browser" module instead.
2512
- */
2513
- getAttribute(name: string, options?: TimeoutOptions): string | null;
2514
-
2515
- /**
2516
- * Returns the `element.innerHTML`.
2517
- * @param options Options to use.
2518
- * @returns Element's innerHTML.
2519
- *
2520
- * @deprecated Use "k6/browser" module instead.
2521
- */
2522
- innerHTML(options?: TimeoutOptions): string;
2523
-
2524
- /**
2525
- * Returns the `element.innerText`.
2526
- * @param options Options to use.
2527
- * @returns Element's innerText.
2528
- *
2529
- * @deprecated Use "k6/browser" module instead.
2530
- */
2531
- innerText(options?: TimeoutOptions): string;
2532
-
2533
- /**
2534
- * Returns the `element.textContent`.
2535
- * @param options Options to use.
2536
- * @returns Element's textContent.
2537
- *
2538
- * @deprecated Use "k6/browser" module instead.
2539
- */
2540
- textContent(options?: TimeoutOptions): string;
2541
-
2542
- /**
2543
- * Returns `input.value` for the selected `input`, `textarea` or `select` element.
2544
- * @param options Options to use.
2545
- * @returns The input value of the element.
2546
- *
2547
- * @deprecated Use "k6/browser" module instead.
2548
- */
2549
- inputValue(options?: TimeoutOptions): string;
2550
-
2551
- /**
2552
- * Select one or more options which match the values. If the select has the multiple attribute, all matching options are selected,
2553
- * otherwise only the first option matching one of the passed options is selected.
2554
- * @param values Values of options to select.
2555
- * @param options Options to use.
2556
- * @returns List of selected options.
2557
- *
2558
- * @deprecated Use "k6/browser" module instead.
2559
- */
2560
- selectOption(
2561
- values: string | string[] | { value?: string; label?: string; index?: number },
2562
- options?: ElementHandleOptions,
2563
- ): string[];
2564
-
2565
- /**
2566
- * Press a single key on the keyboard or a combination of keys.
2567
- * A superset of the key values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values).
2568
- * @param key Name of the key to press or a character to generate, such as `ArrowLeft` or `a`.
2569
- * @param options Keyboard press options.
2570
- *
2571
- * @deprecated Use "k6/browser" module instead.
2572
- */
2573
- press(key: string, options?: KeyboardPressOptions): void;
2574
-
2575
- /**
2576
- * Type a text into the input field.
2577
- * @param text Text to type into the input field.
2578
- * @param options Typing options.
2579
- *
2580
- * @deprecated Use "k6/browser" module instead.
2581
- */
2582
- type(text: string, options?: KeyboardPressOptions): void;
2583
-
2584
- /**
2585
- * Hover over the element.
2586
- * @param options Options to use.
2587
- *
2588
- * @deprecated Use "k6/browser" module instead.
2589
- */
2590
- hover(options?: MouseMoveOptions): void;
2591
-
2592
- /**
2593
- * Tap on the chosen element.
2594
- * @param options Options to use.
2595
- *
2596
- * @deprecated Use "k6/browser" module instead.
2597
- */
2598
- tap(options?: MouseMoveOptions): void;
2599
-
2600
- /**
2601
- * Dispatches HTML DOM event types e.g. `click`.
2602
- * @param type DOM event type.
2603
- * @param eventInit Event-specific properties.
2604
- * @param options Options to use.
2605
- *
2606
- * @deprecated Use "k6/browser" module instead.
2607
- */
2608
- dispatchEvent(type: string, eventInit?: EvaluationArgument, options?: TimeoutOptions): void;
2609
-
2610
- /**
2611
- * Wait for the element to be in a particular state e.g. `visible`.
2612
- * @param options Wait options.
2613
- *
2614
- * @deprecated Use "k6/browser" module instead.
2615
- */
2616
- waitFor(options?: { state?: ElementState } & TimeoutOptions): void;
2617
- }
2618
-
2619
- /**
2620
- * Mouse provides an API for managing a virtual mouse.
2621
- *
2622
- * @deprecated Use "k6/browser" module instead.
2623
- */
2624
- export interface Mouse {
2625
- /**
2626
- * Shortcut for `mouse.move(x, y)`, `mouse.down()`, `mouse.up()`.
2627
- * @param x The x position.
2628
- * @param y The y position.
2629
- * @param options The click options.
2630
- *
2631
- * @deprecated Use "k6/browser" module instead.
2632
- */
2633
- click(x: number, y: number, options?: MouseMultiClickOptions): void;
2634
-
2635
- /**
2636
- * Shortcut for `mouse.move(x, y)`, `mouse.down()`, `mouse.up()`, `mouse.down()`,
2637
- * `mouse.up()`.
2638
- * @param x The x position.
2639
- * @param y The y position.
2640
- * @param options The click options.
2641
- *
2642
- * @deprecated Use "k6/browser" module instead.
2643
- */
2644
- dblclick(x: number, y: number, options?: MouseClickOptions): void;
2645
-
2646
- /**
2647
- * Dispatches a `mousedown` event.
2648
- * @param options The mouse down options.
2649
- *
2650
- * @deprecated Use "k6/browser" module instead.
2651
- */
2652
- down(options?: MouseDownUpOptions): void;
2653
-
2654
- /**
2655
- * Dispatches a `mousemove` event.
2656
- * @param x The x position.
2657
- * @param y The y position.
2658
- * @param options The mouse move options.
2659
- *
2660
- * @deprecated Use "k6/browser" module instead.
2661
- */
2662
- move(x: number, y: number, options?: { steps?: number }): void;
2663
-
2664
- /**
2665
- * Dispatches a `mouseup` event.
2666
- * @param options The mouse up options.
2667
- *
2668
- * @deprecated Use "k6/browser" module instead.
2669
- */
2670
- up(options?: MouseDownUpOptions): void;
2671
- }
2672
-
2673
- /**
2674
- * Page provides methods to interact with a single tab in a running web browser
2675
- * instance. One instance of the browser can have many page instances.
2676
- *
2677
- * @deprecated Use "k6/browser" module instead.
2678
- */
2679
- export interface Page {
2680
- /**
2681
- * Activates the browser tab so that it comes into focus and actions can be
2682
- * performed against it.
2683
- *
2684
- * @deprecated Use "k6/browser" module instead.
2685
- */
2686
- bringToFront(): void;
2687
-
2688
- /**
2689
- * **NOTE** Use locator-based `locator.check([options])` instead.
2690
- *
2691
- * This method is used to select an input checkbox.
2692
- * @param selector A selector to search for an element. If there are multiple
2693
- * elements satisfying the selector, the first will be used.
2694
- * @param options
2695
- *
2696
- * @deprecated Use "k6/browser" module instead.
2697
- */
2698
- check(
2699
- selector: string,
2700
- options?: {
2701
- /**
2702
- * Setting this to `true` will bypass the actionability checks (visible,
2703
- * stable, enabled). Defaults to `false`.
2704
- *
2705
- * @deprecated Use "k6/browser" module instead.
2706
- */
2707
- force?: boolean;
2708
-
2709
- /**
2710
- * If set to `true` and a navigation occurs from performing this action, it
2711
- * will not wait for it to complete. Defaults to `false`.
2712
- *
2713
- * @deprecated Use "k6/browser" module instead.
2714
- */
2715
- noWaitAfter?: boolean;
2716
-
2717
- /**
2718
- * A point to use relative to the top left corner of the element. If not
2719
- * supplied, a visible point of the element is used.
2720
- *
2721
- * @deprecated Use "k6/browser" module instead.
2722
- */
2723
- position?: {
2724
- x: number;
2725
-
2726
- y: number;
2727
- };
2728
-
2729
- /**
2730
- * When `true`, the call requires selector to resolve to a single element.
2731
- * If given selector resolves to more than one element, the call throws
2732
- * an exception. Defaults to `false`.
2733
- *
2734
- * @deprecated Use "k6/browser" module instead.
2735
- */
2736
- strict?: boolean;
2737
-
2738
- /**
2739
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
2740
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
2741
- * `page` methods.
2742
- *
2743
- * Setting the value to `0` will disable the timeout.
2744
- *
2745
- * @deprecated Use "k6/browser" module instead.
2746
- */
2747
- timeout?: number;
2748
-
2749
- /**
2750
- * Setting this to `true` will perform the actionability checks without
2751
- * performing the action. Useful to wait until the element is ready for the
2752
- * action without performing it. Defaults to `false`.
2753
- *
2754
- * @deprecated Use "k6/browser" module instead.
2755
- */
2756
- trial?: boolean;
2757
- },
2758
- ): void;
2759
-
2760
- /**
2761
- * **NOTE** Use locator-based `locator.click([options])` instead.
2762
- *
2763
- * This method clicks an element matching `selector`.
2764
- * @param selector A selector to search for an element. If there are multiple
2765
- * elements satisfying the selector, the first will be used.
2766
- * @param options
2767
- *
2768
- * @deprecated Use "k6/browser" module instead.
2769
- */
2770
- click(
2771
- selector: string,
2772
- options?: {
2773
- /**
2774
- * The mouse button (`left`, `middle` or `right`) to use during the action.
2775
- * Defaults to `left`.
2776
- *
2777
- * @deprecated Use "k6/browser" module instead.
2778
- */
2779
- button?: MouseButton;
2780
-
2781
- /**
2782
- * The number of times the action is performed. Defaults to `1`.
2783
- *
2784
- * @deprecated Use "k6/browser" module instead.
2785
- */
2786
- clickCount?: number;
2787
-
2788
- /**
2789
- * Milliseconds to wait between `mousedown` and `mouseup`. Defaults to `0`.
2790
- *
2791
- * @deprecated Use "k6/browser" module instead.
2792
- */
2793
- delay?: number;
2794
-
2795
- /**
2796
- * Setting this to `true` will bypass the actionability checks (`visible`,
2797
- * `stable`, `enabled`). Defaults to `false`.
2798
- *
2799
- * @deprecated Use "k6/browser" module instead.
2800
- */
2801
- force?: boolean;
2802
-
2803
- /**
2804
- * `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the
2805
- * action. If not specified, currently pressed modifiers are used,
2806
- * otherwise defaults to `null`.
2807
- *
2808
- * @deprecated Use "k6/browser" module instead.
2809
- */
2810
- modifiers?: KeyboardModifier[];
2811
-
2812
- /**
2813
- * If set to `true` and a navigation occurs from performing this action, it
2814
- * will not wait for it to complete. Defaults to `false`.
2815
- *
2816
- * @deprecated Use "k6/browser" module instead.
2817
- */
2818
- noWaitAfter?: boolean;
2819
-
2820
- /**
2821
- * A point to use relative to the top left corner of the element. If not
2822
- * supplied, a visible point of the element is used.
2823
- *
2824
- * @deprecated Use "k6/browser" module instead.
2825
- */
2826
- position?: {
2827
- x: number;
2828
-
2829
- y: number;
2830
- };
2831
-
2832
- /**
2833
- * When `true`, the call requires selector to resolve to a single element.
2834
- * If given selector resolves to more than one element, the call throws
2835
- * an exception. Defaults to `false`.
2836
- *
2837
- * @deprecated Use "k6/browser" module instead.
2838
- */
2839
- strict?: boolean;
2840
-
2841
- /**
2842
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
2843
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
2844
- * `page` methods.
2845
- *
2846
- * Setting the value to `0` will disable the timeout.
2847
- *
2848
- * @deprecated Use "k6/browser" module instead.
2849
- */
2850
- timeout?: number;
2851
-
2852
- /**
2853
- * Setting this to `true` will perform the actionability checks without
2854
- * performing the action. Useful to wait until the element is ready for the
2855
- * action without performing it. Defaults to `false`.
2856
- *
2857
- * @deprecated Use "k6/browser" module instead.
2858
- */
2859
- trial?: boolean;
2860
- },
2861
- ): Promise<void>;
2862
-
2863
- /**
2864
- * This will close the tab that this page is associated with.
2865
- *
2866
- * @deprecated Use "k6/browser" module instead.
2867
- */
2868
- close(): void;
2869
-
2870
- /**
2871
- * Gets the HTML contents of the page.
2872
- *
2873
- * @deprecated Use "k6/browser" module instead.
2874
- */
2875
- content(): string;
2876
-
2877
- /**
2878
- * Gets the `BrowserContext` that the page belongs to.
2879
- *
2880
- * @deprecated Use "k6/browser" module instead.
2881
- */
2882
- context(): BrowserContext;
2883
-
2884
- /**
2885
- * **NOTE** Use locator-based `locator.dblclick([options])` instead.
2886
- *
2887
- * Mouse double clicks an element matching provided selector.
2888
- * @param selector A selector to search for an element. If there are multiple
2889
- * elements satisfying the selector, the first will be used.
2890
- * @param options
2891
- *
2892
- * @deprecated Use "k6/browser" module instead.
2893
- */
2894
- dblclick(
2895
- selector: string,
2896
- options?: {
2897
- /**
2898
- * The mouse button (`left`, `middle` or `right`) to use during the action.
2899
- * Defaults to `left`.
2900
- *
2901
- * @deprecated Use "k6/browser" module instead.
2902
- */
2903
- button?: MouseButton;
2904
-
2905
- /**
2906
- * Milliseconds to wait between `mousedown` and `mouseup`. Defaults to `0`.
2907
- *
2908
- * @deprecated Use "k6/browser" module instead.
2909
- */
2910
- delay?: number;
2911
-
2912
- /**
2913
- * Setting this to `true` will bypass the actionability checks (`visible`,
2914
- * `stable`, `enabled`). Defaults to `false`.
2915
- *
2916
- * @deprecated Use "k6/browser" module instead.
2917
- */
2918
- force?: boolean;
2919
-
2920
- /**
2921
- * `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the
2922
- * action. If not specified, currently pressed modifiers are used,
2923
- * otherwise defaults to `null`.
2924
- *
2925
- * @deprecated Use "k6/browser" module instead.
2926
- */
2927
- modifiers?: KeyboardModifier[];
2928
-
2929
- /**
2930
- * If set to `true` and a navigation occurs from performing this action, it
2931
- * will not wait for it to complete. Defaults to `false`.
2932
- *
2933
- * @deprecated Use "k6/browser" module instead.
2934
- */
2935
- noWaitAfter?: boolean;
2936
-
2937
- /**
2938
- * A point to use relative to the top left corner of the element. If not
2939
- * supplied, a visible point of the element is used.
2940
- *
2941
- * @deprecated Use "k6/browser" module instead.
2942
- */
2943
- position?: {
2944
- x: number;
2945
-
2946
- y: number;
2947
- };
2948
-
2949
- /**
2950
- * When `true`, the call requires selector to resolve to a single element.
2951
- * If given selector resolves to more than one element, the call throws
2952
- * an exception. Defaults to `false`.
2953
- *
2954
- * @deprecated Use "k6/browser" module instead.
2955
- */
2956
- strict?: boolean;
2957
-
2958
- /**
2959
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
2960
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
2961
- * `page` methods.
2962
- *
2963
- * Setting the value to `0` will disable the timeout.
2964
- *
2965
- * @deprecated Use "k6/browser" module instead.
2966
- */
2967
- timeout?: number;
2968
-
2969
- /**
2970
- * Setting this to `true` will perform the actionability checks without
2971
- * performing the action. Useful to wait until the element is ready for the
2972
- * action without performing it. Defaults to `false`.
2973
- *
2974
- * @deprecated Use "k6/browser" module instead.
2975
- */
2976
- trial?: boolean;
2977
- },
2978
- ): void;
2979
-
2980
- /**
2981
- * **NOTE** Use locator-based locator.dispatchEvent([options]) instead.
2982
- *
2983
- * @param selector A selector to search for an element. If there are multiple
2984
- * elements satisfying the selector, the first will be used.
2985
- * @param type DOM event type: `"click"` etc.
2986
- * @param eventInit Optional event-specific initialization properties.
2987
- * @param options
2988
- *
2989
- * @deprecated Use "k6/browser" module instead.
2990
- */
2991
- dispatchEvent(
2992
- selector: string,
2993
- type: string,
2994
- eventInit?: EvaluationArgument,
2995
- options?: {
2996
- /**
2997
- * When `true`, the call requires selector to resolve to a single element.
2998
- * If given selector resolves to more than one element, the call throws
2999
- * an exception. Defaults to `false`.
3000
- *
3001
- * @deprecated Use "k6/browser" module instead.
3002
- */
3003
- strict?: boolean;
3004
-
3005
- /**
3006
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
3007
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
3008
- * `page` methods.
3009
- *
3010
- * Setting the value to `0` will disable the timeout.
3011
- *
3012
- * @deprecated Use "k6/browser" module instead.
3013
- */
3014
- timeout?: number;
3015
- },
3016
- ): void;
3017
-
3018
- /**
3019
- * This method changes the `CSS media type` through the `media` argument,
3020
- * and/or the `'prefers-colors-scheme'` media feature, using the `colorScheme`
3021
- * argument.
3022
- * @param options
3023
- *
3024
- * @deprecated Use "k6/browser" module instead.
3025
- */
3026
- emulateMedia(options?: {
3027
- /**
3028
- * Emulates `'prefers-colors-scheme'` media feature, supported values are
3029
- * `'light'`, `'dark'`, and `'no-preference'`.
3030
- *
3031
- * @deprecated Use "k6/browser" module instead.
3032
- */
3033
- colorScheme?: "light" | "dark" | "no-preference";
3034
-
3035
- /**
3036
- * Changes the CSS media type of the page. The only allowed values are
3037
- * `'screen'`, and `'print'`.
3038
- *
3039
- * @deprecated Use "k6/browser" module instead.
3040
- */
3041
- media?: "screen" | "print";
3042
-
3043
- /**
3044
- * Emulates `'prefers-reduced-motion'` media feature, supported values are
3045
- * `'reduce'`, `'no-preference'`.
3046
- *
3047
- * @deprecated Use "k6/browser" module instead.
3048
- */
3049
- reducedMotion?: "reduce" | "no-preference";
3050
- }): void;
3051
-
3052
- /**
3053
- * This emulates your website with the specified vision deficiency type.
3054
- * The supported types are:
3055
- * - none: default.
3056
- * - blurredVision: where vision is less precise.
3057
- * - protanopia: the inability to perceive any red light.
3058
- * - deuteranopia: the inability to perceive any green light.
3059
- * - tritanopia: the inability to perceive any blue light.
3060
- * - achromatopsia: the inability to perceive any color except for shades of
3061
- * grey (extremely rare).
3062
- * @param type
3063
- *
3064
- * @deprecated Use "k6/browser" module instead.
3065
- */
3066
- emulateVisionDeficiency(
3067
- type: "none" | "blurredVision" | "deuteranopia" | "protanopia" | "tritanopia" | "achromatopsia",
3068
- ): void;
3069
-
3070
- /**
3071
- * Returns the value of the `pageFunction` invocation.
3072
- *
3073
- * A string can also be passed in instead of a function.
3074
- *
3075
- * @param pageFunction Function to be evaluated in the page context.
3076
- * @param arg Optional argument to pass to `pageFunction`.
3077
- *
3078
- * @deprecated Use "k6/browser" module instead.
3079
- */
3080
- evaluate<R, Arg>(pageFunction: PageFunction<Arg, R>, arg?: Arg): R;
3081
-
3082
- /**
3083
- * Returns the value of the `pageFunction` invocation as a [JSHandle].
3084
- *
3085
- * The only difference between page.evaluate(pageFunction[, arg]) and
3086
- * page.evaluateHandle(pageFunction[, arg]) is that
3087
- * page.evaluateHandle(pageFunction[, arg])returns [JSHandle].
3088
- *
3089
- * @param pageFunction Function to be evaluated in the page context.
3090
- * @param arg Optional argument to pass to `pageFunction`.
3091
- *
3092
- * @deprecated Use "k6/browser" module instead.
3093
- */
3094
- evaluateHandle<R, Arg>(pageFunction: PageFunction<Arg, R>, arg?: Arg): JSHandle<R>;
3095
-
3096
- /**
3097
- * **NOTE** Use locator-based `locator.fill(value[, options])` instead.
3098
- *
3099
- * Fill an `input`, `textarea` or `[contenteditable]` element with the
3100
- * provided value.
3101
- *
3102
- * @param selector A selector to search for an element. If there are multiple
3103
- * elements satisfying the selector, the first will be used.
3104
- * @param value Value to fill for the `<input>`, `<textarea>` or
3105
- * `[contenteditable]` element.
3106
- * @param options
3107
- *
3108
- * @deprecated Use "k6/browser" module instead.
3109
- */
3110
- fill(
3111
- selector: string,
3112
- value: string,
3113
- options?: {
3114
- /**
3115
- * Setting this to `true` will bypass the actionability checks (`visible`,
3116
- * `stable`, `enabled`). Defaults to `false`.
3117
- *
3118
- * @deprecated Use "k6/browser" module instead.
3119
- */
3120
- force?: boolean;
3121
-
3122
- /**
3123
- * If set to `true` and a navigation occurs from performing this action, it
3124
- * will not wait for it to complete. Defaults to `false`.
3125
- *
3126
- * @deprecated Use "k6/browser" module instead.
3127
- */
3128
- noWaitAfter?: boolean;
3129
-
3130
- /**
3131
- * When `true`, the call requires selector to resolve to a single element.
3132
- * If given selector resolves to more than one element, the call throws
3133
- * an exception. Defaults to `false`.
3134
- *
3135
- * @deprecated Use "k6/browser" module instead.
3136
- */
3137
- strict?: boolean;
3138
-
3139
- /**
3140
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
3141
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
3142
- * `page` methods.
3143
- *
3144
- * Setting the value to `0` will disable the timeout.
3145
- *
3146
- * @deprecated Use "k6/browser" module instead.
3147
- */
3148
- timeout?: number;
3149
- },
3150
- ): void;
3151
-
3152
- /**
3153
- * **NOTE** Use locator-based `locator.focus([options])` instead.
3154
- *
3155
- * This method fetches an element with `selector` and focuses it.
3156
- *
3157
- * @param selector A selector to search for an element. If there are multiple
3158
- * elements satisfying the selector, the first will be used.
3159
- * @param options
3160
- *
3161
- * @deprecated Use "k6/browser" module instead.
3162
- */
3163
- focus(
3164
- selector: string,
3165
- options?: {
3166
- /**
3167
- * When `true`, the call requires selector to resolve to a single element.
3168
- * If given selector resolves to more than one element, the call throws
3169
- * an exception. Defaults to `false`.
3170
- *
3171
- * @deprecated Use "k6/browser" module instead.
3172
- */
3173
- strict?: boolean;
3174
-
3175
- /**
3176
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
3177
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
3178
- * `page` methods.
3179
- *
3180
- * Setting the value to `0` will disable the timeout.
3181
- *
3182
- * @deprecated Use "k6/browser" module instead.
3183
- */
3184
- timeout?: number;
3185
- },
3186
- ): void;
3187
-
3188
- /**
3189
- * Frames returns an array of frames on the page.
3190
- *
3191
- * @deprecated Use "k6/browser" module instead.
3192
- */
3193
- frames(): Frame[];
3194
-
3195
- /**
3196
- * **NOTE** Use locator-based locator.getAttribute(name[, options]) instead.
3197
- *
3198
- * Returns the element attribute value for the given attribute name.
3199
- *
3200
- * @param selector A selector to search for an element. If there are multiple
3201
- * elements satisfying the selector, the first will be used.
3202
- * @param name Attribute name to get the value for.
3203
- * @param options
3204
- *
3205
- * @deprecated Use "k6/browser" module instead.
3206
- */
3207
- getAttribute(
3208
- selector: string,
3209
- name: string,
3210
- options?: {
3211
- /**
3212
- * When `true`, the call requires selector to resolve to a single element.
3213
- * If given selector resolves to more than one element, the call throws
3214
- * an exception. Defaults to `false`.
3215
- *
3216
- * @deprecated Use "k6/browser" module instead.
3217
- */
3218
- strict?: boolean;
3219
-
3220
- /**
3221
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
3222
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
3223
- * `page` methods.
3224
- *
3225
- * Setting the value to `0` will disable the timeout.
3226
- *
3227
- * @deprecated Use "k6/browser" module instead.
3228
- */
3229
- timeout?: number;
3230
- },
3231
- ): null | string;
3232
-
3233
- /**
3234
- * Navigates to the specified url and returns the main resource response.
3235
- *
3236
- * navigating to `about:blank` or navigation to the same URL with a different
3237
- * hash, will succeed and return `null`.
3238
- *
3239
- * @param url URL to navigate page to. The url should include scheme, e.g.
3240
- * `https://`.
3241
- * @param options
3242
- *
3243
- * @deprecated Use "k6/browser" module instead.
3244
- */
3245
- goto(url: string, options?: NavigationOptions): Promise<null | Response>;
3246
-
3247
- /**
3248
- * **NOTE** Use locator-based locator.hover([options]) instead.
3249
- *
3250
- * This method hovers over an element matching `selector`.
3251
- *
3252
- * @param selector A selector to search for an element. If there are multiple
3253
- * elements satisfying the selector, the first will be used.
3254
- * @param options
3255
- *
3256
- * @deprecated Use "k6/browser" module instead.
3257
- */
3258
- hover(
3259
- selector: string,
3260
- options?: {
3261
- /**
3262
- * Setting this to `true` will bypass the actionability checks (`visible`,
3263
- * `stable`, `enabled`). Defaults to `false`.
3264
- *
3265
- * @deprecated Use "k6/browser" module instead.
3266
- */
3267
- force?: boolean;
3268
-
3269
- /**
3270
- * `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the
3271
- * action. If not specified, currently pressed modifiers are used,
3272
- * otherwise defaults to `null`.
3273
- *
3274
- * @deprecated Use "k6/browser" module instead.
3275
- */
3276
- modifiers?: KeyboardModifier[];
3277
-
3278
- /**
3279
- * If set to `true` and a navigation occurs from performing this action, it
3280
- * will not wait for it to complete. Defaults to `false`.
3281
- *
3282
- * @deprecated Use "k6/browser" module instead.
3283
- */
3284
- noWaitAfter?: boolean;
3285
-
3286
- /**
3287
- * A point to use relative to the top left corner of the element. If not
3288
- * supplied, a visible point of the element is used.
3289
- *
3290
- * @deprecated Use "k6/browser" module instead.
3291
- */
3292
- position?: {
3293
- x: number;
3294
-
3295
- y: number;
3296
- };
3297
-
3298
- /**
3299
- * When `true`, the call requires selector to resolve to a single element.
3300
- * If given selector resolves to more than one element, the call throws
3301
- * an exception. Defaults to `false`.
3302
- *
3303
- * @deprecated Use "k6/browser" module instead.
3304
- */
3305
- strict?: boolean;
3306
-
3307
- /**
3308
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
3309
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
3310
- * `page` methods.
3311
- *
3312
- * Setting the value to `0` will disable the timeout.
3313
- *
3314
- * @deprecated Use "k6/browser" module instead.
3315
- */
3316
- timeout?: number;
3317
-
3318
- /**
3319
- * Setting this to `true` will perform the actionability checks without
3320
- * performing the action. Useful to wait until the element is ready for the
3321
- * action without performing it. Defaults to `false`.
3322
- *
3323
- * @deprecated Use "k6/browser" module instead.
3324
- */
3325
- trial?: boolean;
3326
- },
3327
- ): void;
3328
-
3329
- /**
3330
- * **NOTE** Use locator-based locator.innerHTML([options]) instead.
3331
- *
3332
- * Returns `element.innerHTML`.
3333
- *
3334
- * @param selector A selector to search for an element. If there are multiple
3335
- * elements satisfying the selector, the first will be used.
3336
- * @param options
3337
- *
3338
- * @deprecated Use "k6/browser" module instead.
3339
- */
3340
- innerHTML(
3341
- selector: string,
3342
- options?: {
3343
- /**
3344
- * When `true`, the call requires selector to resolve to a single element.
3345
- * If given selector resolves to more than one element, the call throws
3346
- * an exception. Defaults to `false`.
3347
- *
3348
- * @deprecated Use "k6/browser" module instead.
3349
- */
3350
- strict?: boolean;
3351
-
3352
- /**
3353
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
3354
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
3355
- * `page` methods.
3356
- *
3357
- * Setting the value to `0` will disable the timeout.
3358
- *
3359
- * @deprecated Use "k6/browser" module instead.
3360
- */
3361
- timeout?: number;
3362
- },
3363
- ): string;
3364
-
3365
- /**
3366
- * **NOTE** Use locator-based locator.innerText([options]) instead.
3367
- *
3368
- * Returns `element.innerText`.
3369
- *
3370
- * @param selector A selector to search for an element. If there are multiple
3371
- * elements satisfying the selector, the first will be used.
3372
- * @param options
3373
- *
3374
- * @deprecated Use "k6/browser" module instead.
3375
- */
3376
- innerText(
3377
- selector: string,
3378
- options?: {
3379
- /**
3380
- * When `true`, the call requires selector to resolve to a single element.
3381
- * If given selector resolves to more than one element, the call throws
3382
- * an exception. Defaults to `false`.
3383
- *
3384
- * @deprecated Use "k6/browser" module instead.
3385
- */
3386
- strict?: boolean;
3387
-
3388
- /**
3389
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
3390
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
3391
- * `page` methods.
3392
- *
3393
- * Setting the value to `0` will disable the timeout.
3394
- *
3395
- * @deprecated Use "k6/browser" module instead.
3396
- */
3397
- timeout?: number;
3398
- },
3399
- ): string;
3400
-
3401
- /**
3402
- * **NOTE** Use locator-based locator.inputValue([options]) instead.
3403
- *
3404
- * Returns `input.value` for the selected `<input>` or `<textarea>` or
3405
- * `<select>` element.
3406
- *
3407
- * @param selector A selector to search for an element. If there are multiple
3408
- * elements satisfying the selector, the first will be used.
3409
- * @param options
3410
- *
3411
- * @deprecated Use "k6/browser" module instead.
3412
- */
3413
- inputValue(
3414
- selector: string,
3415
- options?: {
3416
- /**
3417
- * When `true`, the call requires selector to resolve to a single element.
3418
- * If given selector resolves to more than one element, the call throws
3419
- * an exception. Defaults to `false`.
3420
- *
3421
- * @deprecated Use "k6/browser" module instead.
3422
- */
3423
- strict?: boolean;
3424
-
3425
- /**
3426
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
3427
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
3428
- * `page` methods.
3429
- *
3430
- * Setting the value to `0` will disable the timeout.
3431
- *
3432
- * @deprecated Use "k6/browser" module instead.
3433
- */
3434
- timeout?: number;
3435
- },
3436
- ): string;
3437
-
3438
- /**
3439
- * **NOTE** Use locator-based locator.isChecked([options]) instead.
3440
- *
3441
- * Checks to see if the `checkbox` `input` type is selected or not.
3442
- *
3443
- * @param selector A selector to search for an element. If there are multiple
3444
- * elements satisfying the selector, the first will be used.
3445
- * @param options
3446
- *
3447
- * @deprecated Use "k6/browser" module instead.
3448
- */
3449
- isChecked(
3450
- selector: string,
3451
- options?: {
3452
- /**
3453
- * When `true`, the call requires selector to resolve to a single element.
3454
- * If given selector resolves to more than one element, the call throws
3455
- * an exception. Defaults to `false`.
3456
- *
3457
- * @deprecated Use "k6/browser" module instead.
3458
- */
3459
- strict?: boolean;
3460
-
3461
- /**
3462
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
3463
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
3464
- * `page` methods.
3465
- *
3466
- * Setting the value to `0` will disable the timeout.
3467
- *
3468
- * @deprecated Use "k6/browser" module instead.
3469
- */
3470
- timeout?: number;
3471
- },
3472
- ): boolean;
3473
-
3474
- /**
3475
- * Indicates that the page has been closed.
3476
- *
3477
- * @deprecated Use "k6/browser" module instead.
3478
- */
3479
- isClosed(): boolean;
3480
-
3481
- /**
3482
- * **NOTE** Use locator-based locator.isDisabled([options]) instead.
3483
- *
3484
- * Returns whether the element is disabled.
3485
- *
3486
- * @param selector A selector to search for an element. If there are multiple
3487
- * elements satisfying the selector, the first will be used.
3488
- * @param options
3489
- *
3490
- * @deprecated Use "k6/browser" module instead.
3491
- */
3492
- isDisabled(
3493
- selector: string,
3494
- options?: {
3495
- /**
3496
- * When `true`, the call requires selector to resolve to a single element.
3497
- * If given selector resolves to more than one element, the call throws
3498
- * an exception. Defaults to `false`.
3499
- *
3500
- * @deprecated Use "k6/browser" module instead.
3501
- */
3502
- strict?: boolean;
3503
-
3504
- /**
3505
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
3506
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
3507
- * `page` methods.
3508
- *
3509
- * Setting the value to `0` will disable the timeout.
3510
- *
3511
- * @deprecated Use "k6/browser" module instead.
3512
- */
3513
- timeout?: number;
3514
- },
3515
- ): boolean;
3516
-
3517
- /**
3518
- * **NOTE** Use locator-based locator.isEditable([options]) instead.
3519
- *
3520
- * Returns whether the element is editable.
3521
- *
3522
- * @param selector A selector to search for an element. If there are multiple
3523
- * elements satisfying the selector, the first will be used.
3524
- * @param options
3525
- *
3526
- * @deprecated Use "k6/browser" module instead.
3527
- */
3528
- isEditable(
3529
- selector: string,
3530
- options?: {
3531
- /**
3532
- * When `true`, the call requires selector to resolve to a single element.
3533
- * If given selector resolves to more than one element, the call throws
3534
- * an exception. Defaults to `false`.
3535
- *
3536
- * @deprecated Use "k6/browser" module instead.
3537
- */
3538
- strict?: boolean;
3539
-
3540
- /**
3541
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
3542
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
3543
- * `page` methods.
3544
- *
3545
- * Setting the value to `0` will disable the timeout.
3546
- *
3547
- * @deprecated Use "k6/browser" module instead.
3548
- */
3549
- timeout?: number;
3550
- },
3551
- ): boolean;
3552
-
3553
- /**
3554
- * **NOTE** Use locator-based locator.isEnabled([options]) instead.
3555
- *
3556
- * Returns whether the element is enabled.
3557
- *
3558
- * @param selector A selector to search for an element. If there are multiple
3559
- * elements satisfying the selector, the first will be used.
3560
- * @param options
3561
- *
3562
- * @deprecated Use "k6/browser" module instead.
3563
- */
3564
- isEnabled(
3565
- selector: string,
3566
- options?: {
3567
- /**
3568
- * When `true`, the call requires selector to resolve to a single element.
3569
- * If given selector resolves to more than one element, the call throws
3570
- * an exception. Defaults to `false`.
3571
- *
3572
- * @deprecated Use "k6/browser" module instead.
3573
- */
3574
- strict?: boolean;
3575
-
3576
- /**
3577
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
3578
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
3579
- * `page` methods.
3580
- *
3581
- * Setting the value to `0` will disable the timeout.
3582
- *
3583
- * @deprecated Use "k6/browser" module instead.
3584
- */
3585
- timeout?: number;
3586
- },
3587
- ): boolean;
3588
-
3589
- /**
3590
- * **NOTE** Use locator-based locator.isHidden() instead.
3591
- *
3592
- * Returns whether the element is hidden.
3593
- *
3594
- * @param selector A selector to search for an element. If there are multiple
3595
- * elements satisfying the selector, the first will be used.
3596
- * @param options
3597
- *
3598
- * @deprecated Use "k6/browser" module instead.
3599
- */
3600
- isHidden(selector: string, options?: StrictnessOptions): boolean;
3601
-
3602
- /**
3603
- * **NOTE** Use locator-based locator.isVisible() instead.
3604
- *
3605
- * Returns whether the element is visible.
3606
- *
3607
- * @param selector A selector to search for an element. If there are multiple
3608
- * elements satisfying the selector, the first will be used.
3609
- * @param options
3610
- *
3611
- * @deprecated Use "k6/browser" module instead.
3612
- */
3613
- isVisible(selector: string, options?: StrictnessOptions): boolean;
3614
-
3615
- /**
3616
- * Returns the keyboard instance to interact with a virtual keyboard on the
3617
- * page.
3618
- *
3619
- * @deprecated Use "k6/browser" module instead.
3620
- */
3621
- keyboard: Keyboard;
3622
-
3623
- /**
3624
- * The method returns an element locator. Locators resolve to the element
3625
- * when the action takes place, which means locators can span over navigations
3626
- * where the underlying dom changes.
3627
- *
3628
- * @param selector A selector to use when resolving DOM element.
3629
- *
3630
- * @deprecated Use "k6/browser" module instead.
3631
- */
3632
- locator(selector: string): Locator;
3633
-
3634
- /**
3635
- * The page's main frame. Page is made up of frames in a hierarchical. At the
3636
- * top is mainFrame. A page is guaranteed to have a mainFrame.
3637
- *
3638
- * @deprecated Use "k6/browser" module instead.
3639
- */
3640
- mainFrame(): Frame;
3641
-
3642
- /**
3643
- * Returns the mouse instance to interact with a virtual mouse on the page.
3644
- *
3645
- * @deprecated Use "k6/browser" module instead.
3646
- */
3647
- mouse: Mouse;
3648
-
3649
- /**
3650
- * Emitted when JavaScript within the page calls one of console API methods
3651
- * , e.g. `console.log` or `console.dir`. Also emitted if the page throws
3652
- * an error or a warning.
3653
- *
3654
- * The arguments passed into `console.log` are available on the
3655
- * {@link ConsoleMessage} event handler argument.
3656
- *
3657
- * **Usage**
3658
- *
3659
- * ```js
3660
- * page.on('console', msg => {
3661
- * const values = [];
3662
- * for (const arg of msg.args())
3663
- * values.push(arg.jsonValue());
3664
- * console.log(...values);
3665
- * });
3666
- * page.evaluate(() => console.log('hello', 5, { foo: 'bar' }));
3667
- * ```
3668
- *
3669
- * @deprecated Use "k6/browser" module instead.
3670
- */
3671
- on(event: "console", listener: (consoleMessage: ConsoleMessage) => void): void;
3672
-
3673
- /**
3674
- * Returns the page that opened the current page. The first page that is
3675
- * navigated to will have a null opener.
3676
- *
3677
- * @deprecated Use "k6/browser" module instead.
3678
- */
3679
- opener(): Page | null;
3680
-
3681
- /**
3682
- * **NOTE** Use locator-based locator.press(key[, options]) instead.
3683
- *
3684
- * Focuses the element, and then uses keyboard.down(key) and
3685
- * keyboard.up(key).
3686
- *
3687
- * A superset of the `key` values can be found [here](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values).
3688
- *
3689
- * Following modification shortcuts are also supported: `Shift`, `Control`,
3690
- * `Alt`, `Meta`, `ShiftLeft`.
3691
- *
3692
- * Holding down `Shift` will type the text that corresponds to the `key` in
3693
- * the upper case.
3694
- *
3695
- * If `key` is a single character, it is case-sensitive, so the values `a`
3696
- * and `A` will generate different respective texts.
3697
- *
3698
- * Shortcuts such as `key: "Control+o"` or `key: "Control+Shift+T"` are
3699
- * supported as well. When specified with the modifier, modifier is pressed
3700
- * and being held while the subsequent key is being pressed.
3701
- *
3702
- * @param selector A selector to search for an element. If there are multiple
3703
- * elements satisfying the selector, the first will be used.
3704
- * @param key Name of the key to press or a character to generate, such as
3705
- * `ArrowLeft` or `a`.
3706
- * @param options
3707
- *
3708
- * @deprecated Use "k6/browser" module instead.
3709
- */
3710
- press(
3711
- selector: string,
3712
- key: string,
3713
- options?: {
3714
- /**
3715
- * Milliseconds to wait between `mousedown` and `mouseup`. Defaults to `0`.
3716
- *
3717
- * @deprecated Use "k6/browser" module instead.
3718
- */
3719
- delay?: number;
3720
-
3721
- /**
3722
- * If set to `true` and a navigation occurs from performing this action, it
3723
- * will not wait for it to complete. Defaults to `false`.
3724
- *
3725
- * @deprecated Use "k6/browser" module instead.
3726
- */
3727
- noWaitAfter?: boolean;
3728
-
3729
- /**
3730
- * When `true`, the call requires selector to resolve to a single element.
3731
- * If given selector resolves to more than one element, the call throws
3732
- * an exception. Defaults to `false`.
3733
- *
3734
- * @deprecated Use "k6/browser" module instead.
3735
- */
3736
- strict?: boolean;
3737
-
3738
- /**
3739
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
3740
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
3741
- * `page` methods.
3742
- *
3743
- * Setting the value to `0` will disable the timeout.
3744
- *
3745
- * @deprecated Use "k6/browser" module instead.
3746
- */
3747
- timeout?: number;
3748
- },
3749
- ): void;
3750
-
3751
- /**
3752
- * This reloads the current page Returns the main resource response.
3753
- *
3754
- * @param options
3755
- *
3756
- * @deprecated Use "k6/browser" module instead.
3757
- */
3758
- reload(options?: {
3759
- /**
3760
- * Maximum operation time in milliseconds. Defaults to `30` seconds. The
3761
- * default value can be changed via the
3762
- * browserContext.setDefaultNavigationTimeout(timeout),
3763
- * browserContext.setDefaultTimeout(timeout),
3764
- * page.setDefaultNavigationTimeout(timeout) or
3765
- * page.setDefaultTimeout(timeout) methods.
3766
- *
3767
- * Setting the value to `0` will disable the timeout.
3768
- *
3769
- * @deprecated Use "k6/browser" module instead.
3770
- */
3771
- timeout?: number;
3772
-
3773
- /**
3774
- * When to consider operation succeeded, defaults to `load`. Events can be
3775
- * either:
3776
- * - `'domcontentloaded'` - consider operation to be finished when the
3777
- * `DOMContentLoaded` event is fired.
3778
- * - `'load'` - consider operation to be finished when the `load` event is
3779
- * fired.
3780
- * - `'networkidle'` - **DISCOURAGED** consider operation to be finished
3781
- * when there are no network connections for at least `500` ms. Don't use
3782
- * this method for testing especially with chatty websites where the event
3783
- * may never fire, rely on web assertions to assess readiness instead.
3784
- *
3785
- * @deprecated Use "k6/browser" module instead.
3786
- */
3787
- waitUntil?: "load" | "domcontentloaded" | "networkidle";
3788
- }): null | Response;
3789
-
3790
- /**
3791
- * Returns the buffer with the captured screenshot from the browser.
3792
- *
3793
- * @param options
3794
- *
3795
- * @deprecated Use "k6/browser" module instead.
3796
- */
3797
- screenshot(
3798
- options?: {
3799
- /**
3800
- * An object which specifies clipping of the resulting image.
3801
- *
3802
- * @deprecated Use "k6/browser" module instead.
3803
- */
3804
- clip?: {
3805
- /**
3806
- * x-coordinate of top-left corner of clip area
3807
- *
3808
- * @deprecated Use "k6/browser" module instead.
3809
- */
3810
- x: number;
3811
-
3812
- /**
3813
- * y-coordinate of top-left corner of clip area
3814
- *
3815
- * @deprecated Use "k6/browser" module instead.
3816
- */
3817
- y: number;
3818
-
3819
- /**
3820
- * width of clipping area
3821
- *
3822
- * @deprecated Use "k6/browser" module instead.
3823
- */
3824
- width: number;
3825
-
3826
- /**
3827
- * height of clipping area
3828
- *
3829
- * @deprecated Use "k6/browser" module instead.
3830
- */
3831
- height: number;
3832
- };
3833
-
3834
- /**
3835
- * When true, takes a screenshot of the full scrollable page, instead of
3836
- * the currently visible viewport. Defaults to `false`.
3837
- *
3838
- * @deprecated Use "k6/browser" module instead.
3839
- */
3840
- fullPage?: boolean;
3841
- } & ScreenshotOptions,
3842
- ): ArrayBuffer;
3843
-
3844
- /**
3845
- * **NOTE** Use locator-based locator.selectOption(values[, options]) instead.
3846
- *
3847
- * This select one or more options which match the values from a <select>
3848
- * element.
3849
- *
3850
- * @param selector A selector to search for an element. If there are multiple
3851
- * elements satisfying the selector, the first will be used.
3852
- * @param values Options to select. If the select has multiple attribute, all
3853
- * matching options are selected, otherwise only the first option matching
3854
- * one of the passed options is selected. Object can be made up of keys with
3855
- * value, label or index.
3856
- * @param options
3857
- *
3858
- * @deprecated Use "k6/browser" module instead.
3859
- */
3860
- selectOption(
3861
- selector: string,
3862
- values: string | ElementHandle | SelectOptionsObject | string[] | ElementHandle[] | SelectOptionsObject[],
3863
- options?: {
3864
- /**
3865
- * Setting this to `true` will bypass the actionability checks (visible,
3866
- * stable, enabled). Defaults to `false`.
3867
- *
3868
- * @deprecated Use "k6/browser" module instead.
3869
- */
3870
- force?: boolean;
3871
-
3872
- /**
3873
- * If set to `true` and a navigation occurs from performing this action, it
3874
- * will not wait for it to complete. Defaults to `false`.
3875
- *
3876
- * @deprecated Use "k6/browser" module instead.
3877
- */
3878
- noWaitAfter?: boolean;
3879
-
3880
- /**
3881
- * When `true`, the call requires selector to resolve to a single element.
3882
- * If given selector resolves to more than one element, the call throws
3883
- * an exception. Defaults to `false`.
3884
- *
3885
- * @deprecated Use "k6/browser" module instead.
3886
- */
3887
- strict?: boolean;
3888
-
3889
- /**
3890
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
3891
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
3892
- * `page` methods.
3893
- *
3894
- * Setting the value to `0` will disable the timeout.
3895
- *
3896
- * @deprecated Use "k6/browser" module instead.
3897
- */
3898
- timeout?: number;
3899
- },
3900
- ): string[];
3901
-
3902
- /**
3903
- * Set the supplied html string to the current page.
3904
- *
3905
- * @param html HTML markup to assign to the page.
3906
- * @param options
3907
- *
3908
- * @deprecated Use "k6/browser" module instead.
3909
- */
3910
- setContent(
3911
- html: string,
3912
- options?: {
3913
- /**
3914
- * Maximum operation time in milliseconds. Defaults to `30` seconds. The
3915
- * default value can be changed via the
3916
- * browserContext.setDefaultNavigationTimeout(timeout),
3917
- * browserContext.setDefaultTimeout(timeout),
3918
- * page.setDefaultNavigationTimeout(timeout) or
3919
- * page.setDefaultTimeout(timeout) methods.
3920
- *
3921
- * Setting the value to `0` will disable the timeout.
3922
- *
3923
- * @deprecated Use "k6/browser" module instead.
3924
- */
3925
- timeout?: number;
3926
-
3927
- /**
3928
- * When to consider operation succeeded, defaults to `load`. Events can be
3929
- * either:
3930
- * - `'domcontentloaded'` - consider operation to be finished when the
3931
- * `DOMContentLoaded` event is fired.
3932
- * - `'load'` - consider operation to be finished when the `load` event is
3933
- * fired.
3934
- * - `'networkidle'` - **DISCOURAGED** consider operation to be finished
3935
- * when there are no network connections for at least `500` ms. Don't use
3936
- * this method for testing especially with chatty websites where the event
3937
- * may never fire, rely on web assertions to assess readiness instead.
3938
- *
3939
- * @deprecated Use "k6/browser" module instead.
3940
- */
3941
- waitUntil?: "load" | "domcontentloaded" | "networkidle";
3942
- },
3943
- ): void;
3944
-
3945
- /**
3946
- * This setting will change the navigation timeout for the following methods:
3947
- * - page.goto(url[, options])
3948
- * - page.reload([options])
3949
- * - page.setContent(html[, options])
3950
- * - page.waitForNavigation([options])
3951
- *
3952
- * @param timeout in milliseconds
3953
- *
3954
- * @deprecated Use "k6/browser" module instead.
3955
- */
3956
- setDefaultNavigationTimeout(timeout: number): void;
3957
-
3958
- /**
3959
- * This setting will change the timeout for all the methods accepting a
3960
- * `timeout` option.
3961
- *
3962
- * @param timeout in milliseconds
3963
- *
3964
- * @deprecated Use "k6/browser" module instead.
3965
- */
3966
- setDefaultTimeout(timeout: number): void;
3967
-
3968
- /**
3969
- * This sets extra HTTP headers which will be sent with subsequent
3970
- * HTTP requests.
3971
- *
3972
- * @param headers An object containing the additional HTTP headers.
3973
- * All header values must be strings.
3974
- *
3975
- * @deprecated Use "k6/browser" module instead.
3976
- */
3977
- setExtraHTTPHeaders(headers: { [key: string]: string }): void;
3978
-
3979
- /**
3980
- * Sets the file input element's value to the specified files.
3981
- *
3982
- * To work with local files on the file system, use the experimental
3983
- * fs module to load and read the file contents.
3984
- *
3985
- * This method expects a `selector` to point to an
3986
- * [input element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
3987
- * @param selector A selector to search for an element. If there are multiple
3988
- * elements satisfying the selector, the first will be used.
3989
- * @param files
3990
- * @param options
3991
- *
3992
- * @deprecated Use "k6/browser" module instead.
3993
- */
3994
- setInputFiles(selector: string, files: File | File[], options?: {
3995
- /**
3996
- * Maximum time in milliseconds. Pass 0 to disable the timeout. Default
3997
- * is overridden by the setDefaultTimeout option on {@link BrowserContext} or
3998
- * {@link Page}
3999
- * @default 30000
4000
- *
4001
- * @deprecated Use "k6/browser" module instead.
4002
- */
4003
- timeout?: number;
4004
-
4005
- /**
4006
- * If set to `true` and a navigation occurs from performing this action, it
4007
- * will not wait for it to complete.
4008
- * @default false
4009
- *
4010
- * @deprecated Use "k6/browser" module instead.
4011
- */
4012
- noWaitAfter?: boolean;
4013
- }): void;
4014
-
4015
- /**
4016
- * This will update the page's width and height.
4017
- *
4018
- * @param viewportSize
4019
- *
4020
- * @deprecated Use "k6/browser" module instead.
4021
- */
4022
- setViewportSize(viewportSize: {
4023
- /**
4024
- * page width in pixels.
4025
- *
4026
- * @deprecated Use "k6/browser" module instead.
4027
- */
4028
- width: number;
4029
-
4030
- /**
4031
- * page height in pixels.
4032
- *
4033
- * @deprecated Use "k6/browser" module instead.
4034
- */
4035
- height: number;
4036
- }): void;
4037
-
4038
- /**
4039
- * **NOTE** Use locator-based locator.tap([options]) instead.
4040
- *
4041
- * Tap the first element that matches the selector.
4042
- *
4043
- * @param selector A selector to search for an element. If there are multiple
4044
- * elements satisfying the selector, the first will be used.
4045
- * @param options
4046
- *
4047
- * @deprecated Use "k6/browser" module instead.
4048
- */
4049
- tap(
4050
- selector: string,
4051
- options?: {
4052
- /**
4053
- * Setting this to `true` will bypass the actionability checks (visible,
4054
- * stable, enabled). Defaults to `false`.
4055
- *
4056
- * @deprecated Use "k6/browser" module instead.
4057
- */
4058
- force?: boolean;
4059
-
4060
- /**
4061
- * `Alt`, `Control`, `Meta` or `Shift` modifiers keys pressed during the
4062
- * action. If not specified, currently pressed modifiers are used,
4063
- * otherwise defaults to `null`.
4064
- *
4065
- * @deprecated Use "k6/browser" module instead.
4066
- */
4067
- modifiers?: KeyboardModifier[];
4068
-
4069
- /**
4070
- * If set to `true` and a navigation occurs from performing this action, it
4071
- * will not wait for it to complete. Defaults to `false`.
4072
- *
4073
- * @deprecated Use "k6/browser" module instead.
4074
- */
4075
- noWaitAfter?: boolean;
4076
-
4077
- /**
4078
- * A point to use relative to the top left corner of the element. If not
4079
- * supplied, a visible point of the element is used.
4080
- *
4081
- * @deprecated Use "k6/browser" module instead.
4082
- */
4083
- position?: {
4084
- x: number;
4085
-
4086
- y: number;
4087
- };
4088
-
4089
- /**
4090
- * When `true`, the call requires selector to resolve to a single element.
4091
- * If given selector resolves to more than one element, the call throws
4092
- * an exception. Defaults to `false`.
4093
- *
4094
- * @deprecated Use "k6/browser" module instead.
4095
- */
4096
- strict?: boolean;
4097
-
4098
- /**
4099
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
4100
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
4101
- * `page` methods.
4102
- *
4103
- * Setting the value to `0` will disable the timeout.
4104
- *
4105
- * @deprecated Use "k6/browser" module instead.
4106
- */
4107
- timeout?: number;
4108
-
4109
- /**
4110
- * Setting this to `true` will perform the actionability checks without
4111
- * performing the action. Useful to wait until the element is ready for the
4112
- * action without performing it. Defaults to `false`.
4113
- *
4114
- * @deprecated Use "k6/browser" module instead.
4115
- */
4116
- trial?: boolean;
4117
- },
4118
- ): void;
4119
-
4120
- /**
4121
- * **NOTE** Use locator-based locator.textContent([options]) instead.
4122
- *
4123
- * Returns `element.textContent`.
4124
- *
4125
- * @param selector A selector to search for an element. If there are multiple
4126
- * elements satisfying the selector, the first will be used.
4127
- * @param options
4128
- *
4129
- * @deprecated Use "k6/browser" module instead.
4130
- */
4131
- textContent(
4132
- selector: string,
4133
- options?: {
4134
- /**
4135
- * When `true`, the call requires selector to resolve to a single element.
4136
- * If given selector resolves to more than one element, the call throws
4137
- * an exception. Defaults to `false`.
4138
- *
4139
- * @deprecated Use "k6/browser" module instead.
4140
- */
4141
- strict?: boolean;
4142
-
4143
- /**
4144
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
4145
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
4146
- * `page` methods.
4147
- *
4148
- * Setting the value to `0` will disable the timeout.
4149
- *
4150
- * @deprecated Use "k6/browser" module instead.
4151
- */
4152
- timeout?: number;
4153
- },
4154
- ): string;
4155
-
4156
- /**
4157
- * Throttles the CPU in Chrome/Chromium to slow it down by the specified
4158
- * `rate` in {@link CPUProfile}. {@link CPUProfile} is a mandatory
4159
- * input argument. The default `rate` is `1`.
4160
- *
4161
- * **Usage**
4162
- *
4163
- * ```js
4164
- * page.throttleCPU({ rate: 4 });
4165
- * ```
4166
- *
4167
- * @deprecated Use "k6/browser" module instead.
4168
- */
4169
- throttleCPU(profile: CPUProfile): void;
4170
-
4171
- /**
4172
- * Throttles the network in Chrome/Chromium to slow it down by the specified
4173
- * fields in {@link NetworkProfile}. {@link NetworkProfile} is a mandatory
4174
- * input argument.
4175
- *
4176
- * **Usage**
4177
- *
4178
- * ```js
4179
- * page.throttleNetwork({
4180
- * latency: 750,
4181
- * download: 250,
4182
- * upload: 250,
4183
- * });
4184
- * ```
4185
- *
4186
- * To work with the most commonly tested network profiles, import `networkProfiles`
4187
- * from the browser module. There are three profiles available:
4188
- * - `'No Throttling'` (default)
4189
- * - `'Fast 3G'`
4190
- * - `'Slow 3G'`
4191
- *
4192
- * **Usage**
4193
- *
4194
- * ```js
4195
- * import { browser, networkProfiles } from 'k6/browser';
4196
- * ... // redacted
4197
- * const context = browser.newContext();
4198
- * const page = context.newPage();
4199
- *
4200
- * try {
4201
- * page.throttleNetwork(networkProfiles['Slow 3G']);
4202
- * ... // redacted
4203
- * ```
4204
- *
4205
- * @deprecated Use "k6/browser" module instead.
4206
- */
4207
- throttleNetwork(profile: NetworkProfile): void;
4208
-
4209
- /**
4210
- * Returns the page's title.
4211
- *
4212
- * @deprecated Use "k6/browser" module instead.
4213
- */
4214
- title(): string;
4215
-
4216
- /**
4217
- * Returns the touchscreen instance to interact with a virtual touchscreen on
4218
- * the page.
4219
- *
4220
- * @deprecated Use "k6/browser" module instead.
4221
- */
4222
- touchscreen: Touchscreen;
4223
-
4224
- /**
4225
- * **NOTE** Use locator-based locator.type(text[, options]) instead.
4226
- *
4227
- * Type the `text` in the first element found that matches the selector.
4228
- *
4229
- * @param selector A selector to search for an element. If there are multiple
4230
- * elements satisfying the selector, the first will be used.
4231
- * @param text The text to type into the element.
4232
- * @param options
4233
- *
4234
- * @deprecated Use "k6/browser" module instead.
4235
- */
4236
- type(
4237
- selector: string,
4238
- text: string,
4239
- options?: {
4240
- /**
4241
- * Milliseconds to wait between `mousedown` and `mouseup`. Defaults to `0`.
4242
- *
4243
- * @deprecated Use "k6/browser" module instead.
4244
- */
4245
- delay?: number;
4246
-
4247
- /**
4248
- * If set to `true` and a navigation occurs from performing this action, it
4249
- * will not wait for it to complete. Defaults to `false`.
4250
- *
4251
- * @deprecated Use "k6/browser" module instead.
4252
- */
4253
- noWaitAfter?: boolean;
4254
-
4255
- /**
4256
- * When `true`, the call requires selector to resolve to a single element.
4257
- * If given selector resolves to more than one element, the call throws
4258
- * an exception. Defaults to `false`.
4259
- *
4260
- * @deprecated Use "k6/browser" module instead.
4261
- */
4262
- strict?: boolean;
4263
-
4264
- /**
4265
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
4266
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
4267
- * `page` methods.
4268
- *
4269
- * Setting the value to `0` will disable the timeout.
4270
- *
4271
- * @deprecated Use "k6/browser" module instead.
4272
- */
4273
- timeout?: number;
4274
- },
4275
- ): void;
4276
-
4277
- /**
4278
- * **NOTE** Use locator-based `locator.uncheck([options])` instead.
4279
- *
4280
- * This method is used to unselect an input checkbox.
4281
- *
4282
- * @param selector A selector to search for an element. If there are multiple
4283
- * elements satisfying the selector, the first will be used.
4284
- * @param options
4285
- *
4286
- * @deprecated Use "k6/browser" module instead.
4287
- */
4288
- uncheck(
4289
- selector: string,
4290
- options?: {
4291
- /**
4292
- * Setting this to `true` will bypass the actionability checks (visible,
4293
- * stable, enabled). Defaults to `false`.
4294
- *
4295
- * @deprecated Use "k6/browser" module instead.
4296
- */
4297
- force?: boolean;
4298
-
4299
- /**
4300
- * If set to `true` and a navigation occurs from performing this action, it
4301
- * will not wait for it to complete. Defaults to `false`.
4302
- *
4303
- * @deprecated Use "k6/browser" module instead.
4304
- */
4305
- noWaitAfter?: boolean;
4306
-
4307
- /**
4308
- * A point to use relative to the top left corner of the element. If not
4309
- * supplied, a visible point of the element is used.
4310
- *
4311
- * @deprecated Use "k6/browser" module instead.
4312
- */
4313
- position?: {
4314
- x: number;
4315
-
4316
- y: number;
4317
- };
4318
-
4319
- /**
4320
- * When `true`, the call requires selector to resolve to a single element.
4321
- * If given selector resolves to more than one element, the call throws
4322
- * an exception. Defaults to `false`.
4323
- *
4324
- * @deprecated Use "k6/browser" module instead.
4325
- */
4326
- strict?: boolean;
4327
-
4328
- /**
4329
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
4330
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
4331
- * `page` methods.
4332
- *
4333
- * Setting the value to `0` will disable the timeout.
4334
- *
4335
- * @deprecated Use "k6/browser" module instead.
4336
- */
4337
- timeout?: number;
4338
-
4339
- /**
4340
- * Setting this to `true` will perform the actionability checks without
4341
- * performing the action. Useful to wait until the element is ready for the
4342
- * action without performing it. Defaults to `false`.
4343
- *
4344
- * @deprecated Use "k6/browser" module instead.
4345
- */
4346
- trial?: boolean;
4347
- },
4348
- ): void;
4349
-
4350
- /**
4351
- * Returns the page's URL.
4352
- *
4353
- * @deprecated Use "k6/browser" module instead.
4354
- */
4355
- url(): string;
4356
-
4357
- /**
4358
- * Returns the page's size (width and height).
4359
- *
4360
- * @deprecated Use "k6/browser" module instead.
4361
- */
4362
- viewportSize(): {
4363
- /**
4364
- * page width in pixels.
4365
- *
4366
- * @deprecated Use "k6/browser" module instead.
4367
- */
4368
- width: number;
4369
-
4370
- /**
4371
- * page height in pixels.
4372
- *
4373
- * @deprecated Use "k6/browser" module instead.
4374
- */
4375
- height: number;
4376
- };
4377
-
4378
- /**
4379
- * Returns when the `pageFunction` returns a truthy value.
4380
- *
4381
- * @param pageFunction Function to be evaluated in the page context.
4382
- * @param arg Optional argument to pass to `pageFunction`.
4383
- * @param options
4384
- *
4385
- * @deprecated Use "k6/browser" module instead.
4386
- */
4387
- waitForFunction<R, Arg>(
4388
- pageFunction: PageFunction<Arg, R>,
4389
- options?: {
4390
- /**
4391
- * If `polling` is `'raf'`, then `pageFunction` is constantly executed in
4392
- * `requestAnimationFrame` callback. If `polling` is a number, then it is
4393
- * treated as an interval in milliseconds at which the function would be
4394
- * executed. Defaults to `raf`.
4395
- *
4396
- * @deprecated Use "k6/browser" module instead.
4397
- */
4398
- polling?: number | "raf";
4399
-
4400
- /**
4401
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
4402
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
4403
- * `page` methods.
4404
- *
4405
- * Setting the value to `0` will disable the timeout.
4406
- *
4407
- * @deprecated Use "k6/browser" module instead.
4408
- */
4409
- timeout?: number;
4410
- },
4411
- arg?: Arg,
4412
- ): Promise<JSHandle<R>>;
4413
-
4414
- /**
4415
- * This waits for the given load state to be reached. It will immediately
4416
- * unblock if that lifecycle event has already been received.
4417
- *
4418
- * @param state Optional load state to wait for, defaults to `load`:
4419
- * - `'domcontentloaded'` - consider operation to be finished when the
4420
- * `DOMContentLoaded` event is fired.
4421
- * - `'load'` - consider operation to be finished when the `load` event is
4422
- * fired.
4423
- * - `'networkidle'` - **DISCOURAGED** consider operation to be finished
4424
- * when there are no network connections for at least `500` ms. Don't use
4425
- * this method for testing especially with chatty websites where the event
4426
- * may never fire, rely on web assertions to assess readiness instead.
4427
- * @param options
4428
- *
4429
- * @deprecated Use "k6/browser" module instead.
4430
- */
4431
- waitForLoadState(
4432
- state?: "load" | "domcontentloaded" | "networkidle",
4433
- options?: {
4434
- /**
4435
- * Maximum operation time in milliseconds. Defaults to `30` seconds. The
4436
- * default value can be changed via the
4437
- * browserContext.setDefaultNavigationTimeout(timeout),
4438
- * browserContext.setDefaultTimeout(timeout),
4439
- * page.setDefaultNavigationTimeout(timeout) or
4440
- * page.setDefaultTimeout(timeout) methods.
4441
- *
4442
- * Setting the value to `0` will disable the timeout.
4443
- *
4444
- * @deprecated Use "k6/browser" module instead.
4445
- */
4446
- timeout?: number;
4447
- },
4448
- ): void;
4449
-
4450
- /**
4451
- * Waits for the given navigation lifecycle event to occur and returns the main
4452
- * resource response.
4453
- *
4454
- * @param options
4455
- *
4456
- * @deprecated Use "k6/browser" module instead.
4457
- */
4458
- waitForNavigation(options?: {
4459
- /**
4460
- * Maximum operation time in milliseconds. Defaults to `30` seconds. The
4461
- * default value can be changed via the
4462
- * browserContext.setDefaultNavigationTimeout(timeout),
4463
- * browserContext.setDefaultTimeout(timeout),
4464
- * page.setDefaultNavigationTimeout(timeout) or
4465
- * page.setDefaultTimeout(timeout) methods.
4466
- *
4467
- * Setting the value to `0` will disable the timeout.
4468
- *
4469
- * @deprecated Use "k6/browser" module instead.
4470
- */
4471
- timeout?: number;
4472
-
4473
- /**
4474
- * When to consider operation succeeded, defaults to `load`. Events can be
4475
- * either:
4476
- * - `'domcontentloaded'` - consider operation to be finished when the
4477
- * `DOMContentLoaded` event is fired.
4478
- * - `'load'` - consider operation to be finished when the `load` event is
4479
- * fired.
4480
- * - `'networkidle'` - **DISCOURAGED** consider operation to be finished
4481
- * when there are no network connections for at least `500` ms. Don't use
4482
- * this method for testing especially with chatty websites where the event
4483
- * may never fire, rely on web assertions to assess readiness instead.
4484
- *
4485
- * @deprecated Use "k6/browser" module instead.
4486
- */
4487
- waitUntil?: "load" | "domcontentloaded" | "networkidle";
4488
- }): Promise<null | Response>;
4489
-
4490
- /**
4491
- * **NOTE** Use web assertions that assert visibility or a locator-based
4492
- * locator.waitFor([options]) instead.
4493
- *
4494
- * Returns when element specified by selector satisfies `state` option.
4495
- *
4496
- * @param selector A selector to query for.
4497
- * @param options
4498
- *
4499
- * @deprecated Use "k6/browser" module instead.
4500
- */
4501
- waitForSelector(
4502
- selector: string,
4503
- options?: {
4504
- /**
4505
- * Defaults to `'visible'`. Can be either:
4506
- * - `'attached'` - wait for element to be present in DOM.
4507
- * - `'detached'` - wait for element to not be present in DOM.
4508
- * - `'visible'` - wait for element to have non-empty bounding box and no
4509
- * `visibility:hidden`.
4510
- * - `'hidden'` - wait for element to be either detached from DOM, or have
4511
- * an empty bounding box or `visibility:hidden`.
4512
- *
4513
- * @deprecated Use "k6/browser" module instead.
4514
- */
4515
- state?: "attached" | "detached" | "visible" | "hidden";
4516
-
4517
- /**
4518
- * When `true`, the call requires selector to resolve to a single element.
4519
- * If given selector resolves to more than one element, the call throws
4520
- * an exception. Defaults to `false`.
4521
- *
4522
- * @deprecated Use "k6/browser" module instead.
4523
- */
4524
- strict?: boolean;
4525
-
4526
- /**
4527
- * Maximum time in milliseconds. Defaults to `30` seconds. Default is
4528
- * overridden by the `setDefaultTimeout` option on `BrowserContext` or
4529
- * `page` methods.
4530
- *
4531
- * Setting the value to `0` will disable the timeout.
4532
- *
4533
- * @deprecated Use "k6/browser" module instead.
4534
- */
4535
- timeout?: number;
4536
- },
4537
- ): ElementHandle;
4538
-
4539
- /**
4540
- * **NOTE** Never wait for timeout in production, use this only for debugging.
4541
- * Tests that wait for time are inherently flaky. Use `Locator` actions and
4542
- * web assertions that wait automatically.
4543
- *
4544
- * Waits for the given `timeout` in milliseconds.
4545
- *
4546
- * @param timeout A timeout to wait for
4547
- *
4548
- * @deprecated Use "k6/browser" module instead.
4549
- */
4550
- waitForTimeout(timeout: number): void;
4551
-
4552
- /**
4553
- * This method returns all of the dedicated WebWorkers associated with the page.
4554
- *
4555
- * @deprecated Use "k6/browser" module instead.
4556
- */
4557
- workers(): Worker[];
4558
-
4559
- /**
4560
- * **NOTE** Use locator-based page.locator(selector[, options]) instead.
4561
- *
4562
- * The method finds an element matching the specified selector within the page.
4563
- * If no elements match the selector, the return value resolves to `null`.
4564
- * To wait for an element on the page, use locator.waitFor([options]).
4565
- * @param selector A selector to query for.
4566
- *
4567
- * @deprecated Use "k6/browser" module instead.
4568
- */
4569
- $(selector: string): ElementHandle | null;
4570
-
4571
- /**
4572
- * **NOTE** Use locator-based page.locator(selector[, options]) instead.
4573
- *
4574
- * The method finds all elements matching the specified selector within the
4575
- * page. If no elements match the selector, the return value resolves to `[]`.
4576
- * @param selector A selector to query for.
4577
- *
4578
- * @deprecated Use "k6/browser" module instead.
4579
- */
4580
- $$(selector: string): ElementHandle[];
4581
- }
4582
-
4583
- /**
4584
- * Request represents requests which are sent by a page.
4585
- *
4586
- * @deprecated Use "k6/browser" module instead.
4587
- */
4588
- export interface Request {
4589
- /**
4590
- * An object with HTTP headers associated with the request. All header names are
4591
- * lower-case.
4592
- * @returns The headers object.
4593
- *
4594
- * @deprecated Use "k6/browser" module instead.
4595
- */
4596
- allHeaders(): Record<string, string>;
4597
-
4598
- /**
4599
- * @returns the Frame that initiated this request
4600
- *
4601
- * @deprecated Use "k6/browser" module instead.
4602
- */
4603
- frame(): Frame;
4604
-
4605
- /**
4606
- * An object with HTTP headers associated with the request. All header names are
4607
- * lower-case.
4608
- * @returns An object with HTTP headers associated with the request.
4609
- *
4610
- * @deprecated Use "k6/browser" module instead.
4611
- */
4612
- headers(): Record<string, string>;
4613
-
4614
- /**
4615
- * An array with all the request HTTP headers. Unlike `Request.allHeaders()`,
4616
- * header names are not lower-cased. Headers with multiple entries, such as
4617
- * `Set-Cookie`, appear in the array multiple times.
4618
- * @returns An array of all the request HTTP headers.
4619
- *
4620
- * @deprecated Use "k6/browser" module instead.
4621
- */
4622
- headersArray(): Array<{ name: string; value: string }>;
4623
-
4624
- /**
4625
- * Retuns the value of the header matching the name. The name is case insensitive.
4626
- * @param name Header name to retrieve value for.
4627
- * @returns The value of the header matching the name.
4628
- *
4629
- * @deprecated Use "k6/browser" module instead.
4630
- */
4631
- headerValue(name: string): string | null;
4632
-
4633
- /**
4634
- * @returns a boolean stating whether the request is for a navigation
4635
- *
4636
- * @deprecated Use "k6/browser" module instead.
4637
- */
4638
- isNavigationRequest(): boolean;
4639
-
4640
- /**
4641
- * Request's method (GET, POST, etc.)
4642
- * @returns request's method name
4643
- *
4644
- * @deprecated Use "k6/browser" module instead.
4645
- */
4646
- method(): string;
4647
-
4648
- /**
4649
- * Contains the request's post body, if any.
4650
- * @returns request's post body
4651
- *
4652
- * @deprecated Use "k6/browser" module instead.
4653
- */
4654
- postData(): string;
4655
-
4656
- /**
4657
- * Request's post body in a binary form, if any.
4658
- * @returns an ArrayBuffer with request's post data
4659
- *
4660
- * @deprecated Use "k6/browser" module instead.
4661
- */
4662
- postDataBuffer(): ArrayBuffer | null;
4663
-
4664
- /**
4665
- * Contains the request's resource type as it was perceived by the rendering engine.
4666
- * ResourceType will be one of the following: `document`, `stylesheet`, `image`,
4667
- * `media`, `font`, `script`, `texttrack`, `xhr`, `fetch`, `eventsource`,
4668
- * `websocket`, `manifest`, `other`.
4669
- * @returns resource type name
4670
- *
4671
- * @deprecated Use "k6/browser" module instead.
4672
- */
4673
- resourceType(): ResourceType;
4674
-
4675
- /**
4676
- * Returns the matching `Response` object, or `null` if the response was not received
4677
- * due to error.
4678
- * @returns The `Response` object, or `null` if the response was not received due to error.
4679
- *
4680
- * @deprecated Use "k6/browser" module instead.
4681
- */
4682
- response(): Response | null;
4683
-
4684
- /**
4685
- * Returns resource size information for given request.
4686
- * @returns Resource size information for given request.
4687
- *
4688
- * @deprecated Use "k6/browser" module instead.
4689
- */
4690
- size(): { body: number; headers: number };
4691
-
4692
- /**
4693
- * Returns resource timing information for given request. Most of the timing values
4694
- * become available upon the response, `responseEnd` becomes available when request
4695
- * finishes.
4696
- * @returns Resource timing information for given request.
4697
- *
4698
- * @deprecated Use "k6/browser" module instead.
4699
- */
4700
- timing(): ResourceTiming;
4701
-
4702
- /**
4703
- * URL of the request.
4704
- * @returns request URL
4705
- *
4706
- * @deprecated Use "k6/browser" module instead.
4707
- */
4708
- url(): string;
4709
- }
4710
-
4711
- /**
4712
- * Response represents responses which are received by page.
4713
- *
4714
- * @deprecated Use "k6/browser" module instead.
4715
- */
4716
- export interface Response {
4717
- /**
4718
- * An object with HTTP headers associated with the response. All header names are
4719
- * lower-case.
4720
- * @returns The headers object.
4721
- *
4722
- * @deprecated Use "k6/browser" module instead.
4723
- */
4724
- allHeaders(): Record<string, string>;
4725
-
4726
- /**
4727
- * Returns the response body.
4728
- * @returns A buffer with response body.
4729
- *
4730
- * @deprecated Use "k6/browser" module instead.
4731
- */
4732
- body(): ArrayBuffer;
4733
-
4734
- /**
4735
- * @returns the Frame that initiated this response
4736
- *
4737
- * @deprecated Use "k6/browser" module instead.
4738
- */
4739
- frame(): Frame;
4740
-
4741
- /**
4742
- * An object with HTTP headers associated with the response. All header names are
4743
- * lower-case.
4744
- * @returns The headers object.
4745
- *
4746
- * @deprecated Use "k6/browser" module instead.
4747
- */
4748
- headers(): Record<string, string>;
4749
-
4750
- /**
4751
- * An array with all the request HTTP response headers. Unlike `Response.headers()`, header
4752
- * names are not lower-cased. Headers with multiple entries, such as `Set-Cookie`,
4753
- * appear in the array multiple times.
4754
- * @returns An array of all the request HTTP headers.
4755
- *
4756
- * @deprecated Use "k6/browser" module instead.
4757
- */
4758
- headersArray(): Array<{ name: string; value: string }>;
4759
-
4760
- /**
4761
- * Returns the value of the header matching the name. The name is case insensitive.
4762
- * If multiple headers have the same name (except `Set-Cookie`), they are returned
4763
- * as a list separated by ``,``. For `Set-Cookie`, the `\n` separator is used. If
4764
- * no headers are found, `null` is returned.
4765
- * @param name Header name to retrieve value for.
4766
- * @returns The header value for the given name.
4767
- *
4768
- * @deprecated Use "k6/browser" module instead.
4769
- */
4770
- headerValue(name: string): string | null;
4771
-
4772
- /**
4773
- * Returns all values of the headers matching the name, for example `set-cookie`.
4774
- * The name is case insensitive.
4775
- * @param name Header name to retrieve values for.
4776
- * @returns An array of header values for the given name.
4777
- *
4778
- * @deprecated Use "k6/browser" module instead.
4779
- */
4780
- headerValues(name: string): string[];
4781
-
4782
- /**
4783
- * Returns the JSON representation of response body. Throws if response body is not
4784
- * parsable via `JSON.parse`.
4785
- * @returns JSON representation of response body.
4786
- *
4787
- * @deprecated Use "k6/browser" module instead.
4788
- */
4789
- json(): any;
4790
-
4791
- /**
4792
- * Contains a boolean stating whether the response was successful (status in the
4793
- * range 200-299) or not.
4794
- * @returns a boolean stating whether the response was successful
4795
- *
4796
- * @deprecated Use "k6/browser" module instead.
4797
- */
4798
- ok(): boolean;
4799
-
4800
- /**
4801
- * The request that was used to produce the response.
4802
- * @returns the matching `Request` object
4803
- *
4804
- * @deprecated Use "k6/browser" module instead.
4805
- */
4806
- request(): Request;
4807
-
4808
- /**
4809
- * Security details associated with this response.
4810
- * @returns A matching `SecurityDetailsObject`
4811
- *
4812
- * @deprecated Use "k6/browser" module instead.
4813
- */
4814
- securityDetails(): SecurityDetailsObject | null;
4815
-
4816
- /**
4817
- * Returns the IP address and port of the server for this response.
4818
- * @returns The IP address and port of the server
4819
- *
4820
- * @deprecated Use "k6/browser" module instead.
4821
- */
4822
- serverAddr(): { ipAddress: string; port: number } | null;
4823
-
4824
- /**
4825
- * Contains the status code of the response (e.g., 200 for a success).
4826
- * @returns the status code of the response
4827
- *
4828
- * @deprecated Use "k6/browser" module instead.
4829
- */
4830
- status(): number;
4831
-
4832
- /**
4833
- * Contains the status text of the response (e.g. usually an "OK" for a success).
4834
- * @returns the status text of the response
4835
- *
4836
- * @deprecated Use "k6/browser" module instead.
4837
- */
4838
- statusText(): string;
4839
-
4840
- /**
4841
- * The size of the response body and the headers.
4842
- * @returns The size of the response body and the headers.
4843
- *
4844
- * @deprecated Use "k6/browser" module instead.
4845
- */
4846
- size(): { body: number; headers: number };
4847
-
4848
- /**
4849
- * Contains the URL of the response.
4850
- * @returns the URL of the response
4851
- *
4852
- * @deprecated Use "k6/browser" module instead.
4853
- */
4854
- url(): string;
4855
- }
4856
-
4857
- /**
4858
- * Touchscreen provides an api for interacting with a virtual touchscreen. It
4859
- * operates in main-frame CSS pixels relative to the top-left corner of the
4860
- * viewport.
4861
- *
4862
- * @deprecated Use "k6/browser" module instead.
4863
- */
4864
- export interface Touchscreen {
4865
- /**
4866
- * Taps on the specified position (`x`,`y`), which internally dispatches a `touchstart` and `touchend` event.
4867
- * @param x The x position.
4868
- * @param y The y position.
4869
- *
4870
- * @deprecated Use "k6/browser" module instead.
4871
- */
4872
- tap(x: number, y: number): void;
4873
- }
4874
-
4875
- /**
4876
- * The Worker represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API).
4877
- *
4878
- * @deprecated Use "k6/browser" module instead.
4879
- */
4880
- export interface Worker {
4881
- /**
4882
- * Get the URL of the web worker.
4883
- * @return The URL of the web worker.
4884
- *
4885
- * @deprecated Use "k6/browser" module instead.
4886
- */
4887
- url(): string;
4888
- }