@orkestrel/browser 0.0.15 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -18
- package/dist/src/core/index.cjs +132 -101
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +463 -102
- package/dist/src/core/index.d.ts +463 -102
- package/dist/src/core/index.js +133 -102
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +93 -31
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +154 -56
- package/dist/src/server/index.d.ts +154 -56
- package/dist/src/server/index.js +93 -31
- package/dist/src/server/index.js.map +1 -1
- package/package.json +16 -17
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { EmitterErrorHandler } from '@orkestrel/emitter';
|
|
2
|
-
import { EmitterHooks } from '@orkestrel/emitter';
|
|
3
|
-
import { EmitterInterface } from '@orkestrel/emitter';
|
|
1
|
+
import type { EmitterErrorHandler } from '@orkestrel/emitter';
|
|
2
|
+
import type { EmitterHooks } from '@orkestrel/emitter';
|
|
3
|
+
import type { EmitterInterface } from '@orkestrel/emitter';
|
|
4
4
|
|
|
5
5
|
/** Holds the index-ordered base64 alphabet used to build {@link BASE64_LOOKUP}. */
|
|
6
6
|
export declare const BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
@@ -8,7 +8,10 @@ export declare const BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopq
|
|
|
8
8
|
/** Maps each base64 character to its 6-bit value, derived from {@link BASE64_CHARS}. */
|
|
9
9
|
export declare const BASE64_LOOKUP: Readonly<Record<string, number>>;
|
|
10
10
|
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Names the CDP runtime binding the codegen recorder script calls into,
|
|
13
|
+
* `'__orkestrelBrowserCodegen'`.
|
|
14
|
+
*/
|
|
12
15
|
export declare const BROWSER_CODEGEN_BINDING_NAME = "__orkestrelBrowserCodegen";
|
|
13
16
|
|
|
14
17
|
/**
|
|
@@ -16,25 +19,28 @@ export declare const BROWSER_CODEGEN_BINDING_NAME = "__orkestrelBrowserCodegen";
|
|
|
16
19
|
* and `Runtime.evaluate`.
|
|
17
20
|
*
|
|
18
21
|
* @remarks
|
|
19
|
-
* Attaches capturing-phase listeners for `click`, `input` (fill), and
|
|
20
|
-
* `
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* install exactly once per document (`window[name]` sentinel) so
|
|
24
|
-
* injection on every new document is idempotent.
|
|
22
|
+
* Attaches capturing-phase listeners for `click`, `input` (fill), and `change` (select) on
|
|
23
|
+
* `document`, builds a stable CSS selector for the target element, and forwards each action
|
|
24
|
+
* to the CDP binding ({@link BROWSER_CODEGEN_BINDING_NAME}) as a JSON string payload. A
|
|
25
|
+
* `contenteditable` fill is captured through `input` events, the same way an input or a
|
|
26
|
+
* textarea is. Guarded to install exactly once per document (`window[name]` sentinel) so
|
|
27
|
+
* repeated injection on every new document is idempotent.
|
|
25
28
|
*/
|
|
26
29
|
export declare const BROWSER_CODEGEN_SOURCE: string;
|
|
27
30
|
|
|
28
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Sets the default timeout for browser connection, requests, and navigation, `30_000`
|
|
33
|
+
* milliseconds.
|
|
34
|
+
*/
|
|
29
35
|
export declare const BROWSER_DEFAULT_TIMEOUT_MS = 30000;
|
|
30
36
|
|
|
31
|
-
/** Sets the default viewport height
|
|
37
|
+
/** Sets the default viewport height, `720` pixels. */
|
|
32
38
|
export declare const BROWSER_DEFAULT_VIEWPORT_HEIGHT = 720;
|
|
33
39
|
|
|
34
|
-
/** Sets the default viewport width
|
|
40
|
+
/** Sets the default viewport width, `1280` pixels. */
|
|
35
41
|
export declare const BROWSER_DEFAULT_VIEWPORT_WIDTH = 1280;
|
|
36
42
|
|
|
37
|
-
/** Names the isolated world used for iframe evaluation
|
|
43
|
+
/** Names the isolated world used for iframe evaluation, `'__orkestrelBrowserFrame'`. */
|
|
38
44
|
export declare const BROWSER_FRAME_WORLD_NAME = "__orkestrelBrowserFrame";
|
|
39
45
|
|
|
40
46
|
/**
|
|
@@ -47,7 +53,7 @@ export declare const BROWSER_FRAME_WORLD_NAME = "__orkestrelBrowserFrame";
|
|
|
47
53
|
*/
|
|
48
54
|
export declare const BROWSER_HAR_CREATOR: Readonly<{
|
|
49
55
|
name: "@orkestrel/browser";
|
|
50
|
-
version: "0.0.
|
|
56
|
+
version: "0.0.17";
|
|
51
57
|
}>;
|
|
52
58
|
|
|
53
59
|
/** Maps a canonical modifier name to its CDP Input modifier bit value. */
|
|
@@ -57,11 +63,11 @@ export declare const BROWSER_KEY_MODIFIERS: Readonly<Record<string, number>>;
|
|
|
57
63
|
export declare const BROWSER_MOUSE_BUTTON_MASKS: Readonly<Record<BrowserMouseButton, number>>;
|
|
58
64
|
|
|
59
65
|
/**
|
|
60
|
-
* Caps the serialized-character length for an `evaluate()`/`content()` result
|
|
61
|
-
* enforced
|
|
66
|
+
* Caps the serialized-character length for an `evaluate()`/`content()` result at `2_500_000`,
|
|
67
|
+
* enforced in-page before the result is returned to CDP.
|
|
62
68
|
*
|
|
63
69
|
* @remarks
|
|
64
|
-
* This counts UTF-16
|
|
70
|
+
* This counts UTF-16 string length (`String#length`), not transport bytes —
|
|
65
71
|
* the actual CDP frame is UTF-8 encoded (up to 3 bytes/char for common
|
|
66
72
|
* multibyte content) and carries additional JSON/CDP framing overhead on top
|
|
67
73
|
* of the raw content. A `Runtime.evaluate` result above this size, once
|
|
@@ -78,17 +84,19 @@ export declare const BROWSER_MOUSE_BUTTON_MASKS: Readonly<Record<BrowserMouseBut
|
|
|
78
84
|
export declare const BROWSER_RESULT_LIMIT = 2500000;
|
|
79
85
|
|
|
80
86
|
/**
|
|
81
|
-
* Matches the in-page result-limit sentinel error message, anchored
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
87
|
+
* Matches the in-page result-limit sentinel error message, anchored immediately after the
|
|
88
|
+
* `Error:` (optionally `Uncaught Error:`) prefix Chromium prepends to a thrown error's
|
|
89
|
+
* description, `/^(?:Uncaught )?Error: \[\[ORKESTREL_BROWSER_RESULT_LIMIT\]\](\d+)/`.
|
|
90
|
+
*
|
|
91
|
+
* @remarks
|
|
92
|
+
* The anchor matches the guard's own throw only at the start of the message, rather than
|
|
93
|
+
* wherever the substring happens to occur.
|
|
86
94
|
*/
|
|
87
95
|
export declare const BROWSER_RESULT_LIMIT_PATTERN: RegExp;
|
|
88
96
|
|
|
89
97
|
/**
|
|
90
|
-
* Names the distinctive prefix for the in-page result-limit sentinel error,
|
|
91
|
-
* followed by the serialized length.
|
|
98
|
+
* Names the distinctive prefix for the in-page result-limit sentinel error,
|
|
99
|
+
* `'[[ORKESTREL_BROWSER_RESULT_LIMIT]]'`, immediately followed by the serialized length.
|
|
92
100
|
*
|
|
93
101
|
* @remarks
|
|
94
102
|
* Deliberately unlikely to appear in a page's own thrown error text (unlike
|
|
@@ -101,15 +109,17 @@ export declare const BROWSER_RESULT_LIMIT_SENTINEL_PREFIX = "[[ORKESTREL_BROWSER
|
|
|
101
109
|
/** Names the attribute that tags temporary screenshot styles and masks. */
|
|
102
110
|
export declare const BROWSER_SCREENSHOT_ATTRIBUTE = "data-orkestrel-screenshot";
|
|
103
111
|
|
|
104
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* Sets the default maximum node count accepted from a decoded CDP DOM snapshot, `100_000`.
|
|
114
|
+
*/
|
|
105
115
|
export declare const BROWSER_SNAPSHOT_NODE_LIMIT = 100000;
|
|
106
116
|
|
|
107
117
|
/** Sets the number of animation frames whose element bounds must agree before trusted input. */
|
|
108
118
|
export declare const BROWSER_STABLE_FRAME_COUNT = 2;
|
|
109
119
|
|
|
110
120
|
/**
|
|
111
|
-
* Bounds
|
|
112
|
-
*
|
|
121
|
+
* Bounds the best-effort `Page.stopLoading` call issued after a failed `navigate()` at `1_000`
|
|
122
|
+
* milliseconds.
|
|
113
123
|
*
|
|
114
124
|
* @remarks
|
|
115
125
|
* A wedged renderer can make the underlying CDP call hang for the full
|
|
@@ -133,7 +143,14 @@ export declare const BROWSER_TEST_ID_ATTRIBUTE = "data-testid";
|
|
|
133
143
|
*/
|
|
134
144
|
export declare const BROWSER_VISIBILITY_SOURCE = "style.display !== 'none' && style.visibility !== 'hidden' && style.visibility !== 'collapse' && rect.width > 0 && rect.height > 0";
|
|
135
145
|
|
|
136
|
-
/**
|
|
146
|
+
/**
|
|
147
|
+
* Sets the poll interval while waiting for a selector to appear, `100` milliseconds.
|
|
148
|
+
*
|
|
149
|
+
* @remarks
|
|
150
|
+
* A wait adds the same interval as slack to its own CDP call timeout, so the in-page poll
|
|
151
|
+
* expires before the call carrying it. Host-side CDP readiness probes wait it out between
|
|
152
|
+
* attempts.
|
|
153
|
+
*/
|
|
137
154
|
export declare const BROWSER_WAIT_POLL_INTERVAL_MS = 100;
|
|
138
155
|
|
|
139
156
|
/**
|
|
@@ -155,6 +172,7 @@ export declare class BrowserAccessibility implements BrowserAccessibilityInterfa
|
|
|
155
172
|
|
|
156
173
|
/** Inspects the accessibility tree. */
|
|
157
174
|
export declare interface BrowserAccessibilityInterface {
|
|
175
|
+
/** Reads the full accessibility tree, optionally pruned to the interesting nodes. */
|
|
158
176
|
snapshot(options?: BrowserAccessibilityOptions): Promise<BrowserAccessibilitySnapshot>;
|
|
159
177
|
}
|
|
160
178
|
|
|
@@ -185,7 +203,7 @@ export declare interface BrowserActionabilityOptions {
|
|
|
185
203
|
*
|
|
186
204
|
* @remarks
|
|
187
205
|
* - `timeout` — maximum time to wait for the selector in milliseconds
|
|
188
|
-
* - `strict` — require the selector to resolve to exactly one element
|
|
206
|
+
* - `strict` — require the selector to resolve to exactly one element (default `true`)
|
|
189
207
|
* - `force` — skip the actionability checks
|
|
190
208
|
* - `trial` — run the checks and stop before dispatching input
|
|
191
209
|
*/
|
|
@@ -267,10 +285,17 @@ export declare class BrowserClock implements BrowserClockInterface {
|
|
|
267
285
|
/** Controls Chromium virtual time for deterministic page timers. */
|
|
268
286
|
export declare interface BrowserClockInterface {
|
|
269
287
|
readonly installed: boolean;
|
|
288
|
+
/** Takes over the page clock, optionally seeding it with an epoch time. */
|
|
270
289
|
install(time?: number): Promise<void>;
|
|
290
|
+
/** Suspends virtual time so no page timer advances. */
|
|
271
291
|
pause(): Promise<void>;
|
|
292
|
+
/** Continues virtual time after a pause. */
|
|
272
293
|
resume(): Promise<void>;
|
|
294
|
+
/**
|
|
295
|
+
* Moves virtual time forward by the given milliseconds, firing the timers that fall due.
|
|
296
|
+
*/
|
|
273
297
|
advance(ms: number): Promise<void>;
|
|
298
|
+
/** Returns the page to the real clock, and does nothing when no clock was installed. */
|
|
274
299
|
uninstall(): Promise<void>;
|
|
275
300
|
}
|
|
276
301
|
|
|
@@ -350,11 +375,20 @@ export declare type BrowserCodegenEventMap = {
|
|
|
350
375
|
export declare interface BrowserCodegenInterface {
|
|
351
376
|
readonly emitter: EmitterInterface<BrowserCodegenEventMap>;
|
|
352
377
|
readonly started: boolean;
|
|
378
|
+
/**
|
|
379
|
+
* Begins recording on the page's session. A call after teardown is a silent no-op, because
|
|
380
|
+
* a torn-down recorder cannot be restarted and a fresh one is obtained through the page.
|
|
381
|
+
*/
|
|
353
382
|
start(): Promise<void>;
|
|
383
|
+
/** Stops recording and returns the captured actions. */
|
|
354
384
|
stop(): Promise<readonly BrowserCodegenAction[]>;
|
|
385
|
+
/** Returns the current normalized action list. */
|
|
355
386
|
actions(): readonly BrowserCodegenAction[];
|
|
387
|
+
/** Compiles the captured actions into a script. */
|
|
356
388
|
script(options?: BrowserCodegenScriptOptions): string;
|
|
389
|
+
/** Resets the captured action list. */
|
|
357
390
|
clear(): void;
|
|
391
|
+
/** Tears down the recorder and detaches its CDP listeners. */
|
|
358
392
|
destroy(): Promise<void>;
|
|
359
393
|
}
|
|
360
394
|
|
|
@@ -362,7 +396,7 @@ export declare interface BrowserCodegenInterface {
|
|
|
362
396
|
export declare type BrowserCodegenLanguage = 'javascript' | 'typescript';
|
|
363
397
|
|
|
364
398
|
/**
|
|
365
|
-
* Describes the options for creating a BrowserCodegen recorder.
|
|
399
|
+
* Describes the options for creating a `BrowserCodegen` recorder.
|
|
366
400
|
*
|
|
367
401
|
* @remarks
|
|
368
402
|
* - `on` — initial event listeners wired at construction
|
|
@@ -464,11 +498,27 @@ export declare interface BrowserContextInterface {
|
|
|
464
498
|
readonly permissions: BrowserPermissionManagerInterface;
|
|
465
499
|
readonly storage: BrowserStorageManagerInterface;
|
|
466
500
|
readonly emulation: BrowserEmulationManagerInterface;
|
|
501
|
+
/** Returns one page by index, or the first page. */
|
|
467
502
|
page(index?: number): BrowserPageInterface | undefined;
|
|
503
|
+
/** Returns every page in creation order. */
|
|
468
504
|
pages(): readonly BrowserPageInterface[];
|
|
505
|
+
/** Opens a page in this context. */
|
|
469
506
|
create(options?: BrowserPageOptions): Promise<BrowserPageInterface>;
|
|
507
|
+
/**
|
|
508
|
+
* Synchronizes pages from the given CDP targets, which the server discovers and core never
|
|
509
|
+
* fetches. Performs a destructive diff rather than an additive merge: a page whose target
|
|
510
|
+
* id is missing from `targets` is closed and dropped, and a target that is not yet tracked
|
|
511
|
+
* is attached and added.
|
|
512
|
+
*/
|
|
470
513
|
sync(targets: readonly CDPTarget[]): Promise<void>;
|
|
514
|
+
/**
|
|
515
|
+
* Releases local pages and detaches their sessions without disposing the remote browser
|
|
516
|
+
* context.
|
|
517
|
+
*/
|
|
471
518
|
destroy(): Promise<void>;
|
|
519
|
+
/**
|
|
520
|
+
* Closes remote pages, disposes the remote browser context, and releases local resources.
|
|
521
|
+
*/
|
|
472
522
|
close(): Promise<void>;
|
|
473
523
|
}
|
|
474
524
|
|
|
@@ -549,8 +599,11 @@ export declare class BrowserCookieManager implements BrowserCookieManagerInterfa
|
|
|
549
599
|
|
|
550
600
|
/** Provides cookie operations scoped to one browser context. */
|
|
551
601
|
export declare interface BrowserCookieManagerInterface {
|
|
602
|
+
/** Reads the context cookies, optionally narrowed to the given URLs. */
|
|
552
603
|
cookies(urls?: readonly string[]): Promise<readonly BrowserCookie[]>;
|
|
604
|
+
/** Writes the given cookies into the context. */
|
|
553
605
|
set(cookies: readonly BrowserCookieInput[]): Promise<void>;
|
|
606
|
+
/** Deletes the context cookies matching the filter, or every cookie when given none. */
|
|
554
607
|
clear(filter?: BrowserCookieFilter): Promise<void>;
|
|
555
608
|
}
|
|
556
609
|
|
|
@@ -584,8 +637,17 @@ export declare class BrowserCoverage implements BrowserCoverageInterface {
|
|
|
584
637
|
/** Drives the coverage capture lifecycle. */
|
|
585
638
|
export declare interface BrowserCoverageInterface {
|
|
586
639
|
readonly active: boolean;
|
|
640
|
+
/**
|
|
641
|
+
* Arms the requested domains. Throws a `BrowserError` when collection is already active or
|
|
642
|
+
* when neither domain is requested.
|
|
643
|
+
*/
|
|
587
644
|
start(options?: BrowserCoverageOptions): Promise<void>;
|
|
645
|
+
/** Reads the collected usage and disarms every domain it armed. */
|
|
588
646
|
stop(): Promise<BrowserCoverageResult>;
|
|
647
|
+
/**
|
|
648
|
+
* Stops an active collector, discarding any failure, and does nothing when no collection
|
|
649
|
+
* is running.
|
|
650
|
+
*/
|
|
589
651
|
destroy(): Promise<void>;
|
|
590
652
|
}
|
|
591
653
|
|
|
@@ -616,7 +678,7 @@ export declare interface BrowserCredentials {
|
|
|
616
678
|
}
|
|
617
679
|
|
|
618
680
|
/**
|
|
619
|
-
* Groups the
|
|
681
|
+
* Groups the tracing, coverage, performance, and profiler classes beneath one page.
|
|
620
682
|
*
|
|
621
683
|
* @example
|
|
622
684
|
* ```ts
|
|
@@ -643,6 +705,7 @@ export declare interface BrowserDiagnosticsInterface {
|
|
|
643
705
|
readonly coverage: BrowserCoverageInterface;
|
|
644
706
|
readonly performance: BrowserPerformanceInterface;
|
|
645
707
|
readonly profiler: BrowserProfilerInterface;
|
|
708
|
+
/** Tears down every diagnostics capability this page's group owns. */
|
|
646
709
|
destroy(): Promise<void>;
|
|
647
710
|
}
|
|
648
711
|
|
|
@@ -654,7 +717,11 @@ export declare interface BrowserDialogInterface {
|
|
|
654
717
|
readonly category: BrowserDialogCategory;
|
|
655
718
|
readonly message: string;
|
|
656
719
|
readonly default: string;
|
|
720
|
+
/**
|
|
721
|
+
* Accepts the dialog, optionally supplying prompt text. Throws once the dialog is handled.
|
|
722
|
+
*/
|
|
657
723
|
accept(value?: string): Promise<void>;
|
|
724
|
+
/** Dismisses the dialog. Throws once the dialog is handled. */
|
|
658
725
|
dismiss(): Promise<void>;
|
|
659
726
|
}
|
|
660
727
|
|
|
@@ -694,6 +761,10 @@ export declare interface BrowserDownloadInterface {
|
|
|
694
761
|
readonly received: number;
|
|
695
762
|
readonly total: number;
|
|
696
763
|
readonly path: string | undefined;
|
|
764
|
+
/**
|
|
765
|
+
* Sends CDP `Browser.cancelDownload` for this download, and is ignored unless the status
|
|
766
|
+
* is still pending.
|
|
767
|
+
*/
|
|
697
768
|
cancel(): Promise<void>;
|
|
698
769
|
/** Records one step of the download's progress. The owning page drives it. */
|
|
699
770
|
update(progress: BrowserDownloadProgress): void;
|
|
@@ -758,8 +829,13 @@ export declare class BrowserEmulationManager implements BrowserEmulationManagerI
|
|
|
758
829
|
|
|
759
830
|
/** Configures context-scoped emulation. */
|
|
760
831
|
export declare interface BrowserEmulationManagerInterface {
|
|
832
|
+
/**
|
|
833
|
+
* Clears the superseded overrides and applies the given ones to every page of the context.
|
|
834
|
+
*/
|
|
761
835
|
apply(options: BrowserEmulationOptions): Promise<void>;
|
|
836
|
+
/** Removes every override this manager applied. */
|
|
762
837
|
clear(): Promise<void>;
|
|
838
|
+
/** Applies the retained overrides to a newly created page. */
|
|
763
839
|
attach(page: BrowserPageInterface): Promise<void>;
|
|
764
840
|
}
|
|
765
841
|
|
|
@@ -777,11 +853,11 @@ export declare interface BrowserEmulationOptions {
|
|
|
777
853
|
}
|
|
778
854
|
|
|
779
855
|
/**
|
|
780
|
-
* Represents the base error for all browser automation operations
|
|
856
|
+
* Represents the base error for all browser automation operations, carrying the code
|
|
857
|
+
* `BROWSER_ERROR` and a `context` record.
|
|
781
858
|
*
|
|
782
859
|
* @remarks
|
|
783
|
-
*
|
|
784
|
-
* callers can branch in a `catch` without parsing message strings.
|
|
860
|
+
* A caller branches in a `catch` on the `code` rather than parsing message strings.
|
|
785
861
|
*/
|
|
786
862
|
export declare class BrowserError extends Error {
|
|
787
863
|
readonly code: string;
|
|
@@ -792,7 +868,12 @@ export declare class BrowserError extends Error {
|
|
|
792
868
|
/** Represents one intercepted file chooser. */
|
|
793
869
|
export declare interface BrowserFileChooserInterface {
|
|
794
870
|
readonly multiple: boolean;
|
|
871
|
+
/**
|
|
872
|
+
* Sets the chosen files. Throws when a single-file chooser is given several, and once the
|
|
873
|
+
* chooser is already handled.
|
|
874
|
+
*/
|
|
795
875
|
upload(files: readonly string[]): Promise<void>;
|
|
876
|
+
/** Clears the selection. Throws once the chooser is already handled. */
|
|
796
877
|
cancel(): Promise<void>;
|
|
797
878
|
}
|
|
798
879
|
|
|
@@ -881,20 +962,57 @@ export declare interface BrowserFrameInterface {
|
|
|
881
962
|
readonly keyboard: BrowserKeyboardInterface;
|
|
882
963
|
readonly mouse: BrowserMouseInterface;
|
|
883
964
|
readonly touch: BrowserTouchInterface;
|
|
965
|
+
/** Resolves the frame document title. */
|
|
884
966
|
title(): Promise<string>;
|
|
967
|
+
/** Extracts the URL, title, HTML, and visible text under the result-size guards. */
|
|
885
968
|
content(): Promise<BrowserContentResult>;
|
|
969
|
+
/**
|
|
970
|
+
* Distills the frame HTML to reader-facing plain text, with boilerplate and hidden regions
|
|
971
|
+
* pruned.
|
|
972
|
+
*/
|
|
886
973
|
article(): Promise<string>;
|
|
974
|
+
/**
|
|
975
|
+
* Clicks a CSS-selector match, strict by default and requiring it visible and enabled.
|
|
976
|
+
*/
|
|
887
977
|
click(selector: string, options?: BrowserActionOptions): Promise<void>;
|
|
978
|
+
/**
|
|
979
|
+
* Fills an editable input or contenteditable element, strict by default, dispatching input
|
|
980
|
+
* and change events.
|
|
981
|
+
*/
|
|
888
982
|
fill(selector: string, value: string, options?: BrowserActionOptions): Promise<void>;
|
|
983
|
+
/** Selects options on an enabled `select` element, strict by default. */
|
|
889
984
|
select(selector: string, values: readonly string[], options?: BrowserActionOptions): Promise<void>;
|
|
985
|
+
/** Evaluates an expression in the frame execution world under the result-size guard. */
|
|
890
986
|
evaluate(expression: string, timeout?: number): Promise<unknown>;
|
|
987
|
+
/**
|
|
988
|
+
* Evaluates an expression by reference and returns a disposable remote object handle.
|
|
989
|
+
*/
|
|
891
990
|
handle(expression: string): Promise<BrowserHandleInterface>;
|
|
991
|
+
/** Waits for a selector to reach the attached, detached, visible, or hidden state. */
|
|
892
992
|
wait(selector: string, options?: BrowserWaitOptions): Promise<void>;
|
|
993
|
+
/**
|
|
994
|
+
* Issues a raw CDP method in the frame's current target session, with a trailing
|
|
995
|
+
* `BrowserSendOptions` carrying a per-call `timeout` overriding the client-wide default.
|
|
996
|
+
*/
|
|
893
997
|
send(method: string, params?: Readonly<Record<string, unknown>>, options?: BrowserSendOptions): Promise<unknown>;
|
|
998
|
+
/** Subscribes to a CDP event in the frame's current target session. */
|
|
894
999
|
subscribe(method: string, handler: CDPHandler): Promise<void>;
|
|
1000
|
+
/** Removes a frame-session CDP event subscription. */
|
|
895
1001
|
unsubscribe(method: string, handler: CDPHandler): Promise<void>;
|
|
1002
|
+
/**
|
|
1003
|
+
* Persists bytes through a page writer; a child frame rejects because it owns no writer.
|
|
1004
|
+
*/
|
|
896
1005
|
save(path: string, bytes: Uint8Array): Promise<void>;
|
|
1006
|
+
/**
|
|
1007
|
+
* Throws a coded `BrowserError` when the frame can no longer accept protocol work: a frame
|
|
1008
|
+
* throws once the CDP client disconnects, and a page also throws once it closes. Every
|
|
1009
|
+
* other member here calls it first.
|
|
1010
|
+
*/
|
|
897
1011
|
assert(): void;
|
|
1012
|
+
/**
|
|
1013
|
+
* Records an externally observed URL as the frame's current `url`, which a page calls from
|
|
1014
|
+
* its own `Page.frameNavigated` handler.
|
|
1015
|
+
*/
|
|
898
1016
|
update(url: string): void;
|
|
899
1017
|
}
|
|
900
1018
|
|
|
@@ -917,10 +1035,18 @@ export declare interface BrowserGeolocation {
|
|
|
917
1035
|
*/
|
|
918
1036
|
export declare interface BrowserHandleInterface {
|
|
919
1037
|
readonly id: string;
|
|
1038
|
+
/** Reads the object back by value. */
|
|
920
1039
|
value(): Promise<unknown>;
|
|
1040
|
+
/** Runs a function declaration with the handle as `this`, by value. */
|
|
921
1041
|
call(declaration: string, args?: readonly unknown[]): Promise<unknown>;
|
|
1042
|
+
/**
|
|
1043
|
+
* Retains one own property as its own handle, or returns `undefined` when the property is
|
|
1044
|
+
* absent.
|
|
1045
|
+
*/
|
|
922
1046
|
property(name: string): Promise<BrowserHandleInterface | undefined>;
|
|
1047
|
+
/** Reads every own property by value. */
|
|
923
1048
|
properties(): Promise<Readonly<Record<string, unknown>>>;
|
|
1049
|
+
/** Releases the retained remote object. Idempotent. */
|
|
924
1050
|
dispose(): Promise<void>;
|
|
925
1051
|
}
|
|
926
1052
|
|
|
@@ -1009,9 +1135,13 @@ export declare class BrowserHARManager implements BrowserHARManagerInterface {
|
|
|
1009
1135
|
/** Provides HAR recording and replay operations. */
|
|
1010
1136
|
export declare interface BrowserHARManagerInterface {
|
|
1011
1137
|
readonly recording: boolean;
|
|
1138
|
+
/** Begins recording exchanges, optionally capturing response content. */
|
|
1012
1139
|
start(options?: BrowserHAROptions): Promise<void>;
|
|
1140
|
+
/** Ends recording and returns the archive, writing it when a path was given. */
|
|
1013
1141
|
stop(): Promise<BrowserHAR>;
|
|
1142
|
+
/** Serves matching requests from an archive instead of from the network. */
|
|
1014
1143
|
replay(har: BrowserHAR, options?: BrowserHARReplayOptions): Promise<void>;
|
|
1144
|
+
/** Drops the recorded entries and any active replay without ending the recording. */
|
|
1015
1145
|
clear(): Promise<void>;
|
|
1016
1146
|
}
|
|
1017
1147
|
|
|
@@ -1132,10 +1262,22 @@ export declare class BrowserKeyboard implements BrowserKeyboardInterface {
|
|
|
1132
1262
|
|
|
1133
1263
|
/** Provides keyboard input operations bound to one frame target session. */
|
|
1134
1264
|
export declare interface BrowserKeyboardInterface {
|
|
1265
|
+
/**
|
|
1266
|
+
* Presses one key and holds it, retaining it in the modifier mask when it is a modifier.
|
|
1267
|
+
*/
|
|
1135
1268
|
down(key: string): Promise<void>;
|
|
1269
|
+
/**
|
|
1270
|
+
* Releases one key, dropping it from the modifier mask even when the release frame fails.
|
|
1271
|
+
*/
|
|
1136
1272
|
up(key: string): Promise<void>;
|
|
1273
|
+
/**
|
|
1274
|
+
* Presses a chord: holds its modifiers, presses and releases its terminal key, then
|
|
1275
|
+
* releases the modifiers.
|
|
1276
|
+
*/
|
|
1137
1277
|
press(key: string, options?: BrowserInputOptions): Promise<void>;
|
|
1278
|
+
/** Types a string as one press and release per character. */
|
|
1138
1279
|
type(value: string, options?: BrowserInputOptions): Promise<void>;
|
|
1280
|
+
/** Inserts composed text in one frame, firing no per-key events. */
|
|
1139
1281
|
insert(value: string): Promise<void>;
|
|
1140
1282
|
}
|
|
1141
1283
|
|
|
@@ -1219,34 +1361,69 @@ export declare interface BrowserLocatorFilter {
|
|
|
1219
1361
|
export declare interface BrowserLocatorInterface {
|
|
1220
1362
|
readonly frame: BrowserFrameInterface;
|
|
1221
1363
|
readonly query: BrowserQuery;
|
|
1364
|
+
/** Narrows to a descendant matching the CSS selector. */
|
|
1222
1365
|
locator(selector: string): BrowserLocatorInterface;
|
|
1366
|
+
/** Narrows to the matches satisfying the filter. */
|
|
1223
1367
|
filter(options: BrowserLocatorFilter): BrowserLocatorInterface;
|
|
1368
|
+
/** Narrows to the first match. */
|
|
1224
1369
|
first(): BrowserLocatorInterface;
|
|
1370
|
+
/** Narrows to the last match. */
|
|
1225
1371
|
last(): BrowserLocatorInterface;
|
|
1372
|
+
/** Narrows to the match at the given index. */
|
|
1226
1373
|
item(index: number): BrowserLocatorInterface;
|
|
1374
|
+
/** Counts the current matches. */
|
|
1227
1375
|
count(): Promise<number>;
|
|
1376
|
+
/** Resolves one indexed locator per current match. */
|
|
1228
1377
|
all(): Promise<readonly BrowserLocatorInterface[]>;
|
|
1378
|
+
/** Clicks the match with trusted input after its actionability checks pass. */
|
|
1229
1379
|
click(options?: BrowserLocatorClickOptions): Promise<void>;
|
|
1380
|
+
/** Replaces the match's value with the given text. */
|
|
1230
1381
|
fill(value: string, options?: BrowserActionOptions): Promise<void>;
|
|
1382
|
+
/** Selects the given option values on the match. */
|
|
1231
1383
|
select(values: readonly string[], options?: BrowserActionOptions): Promise<void>;
|
|
1384
|
+
/** Clicks the match unless it already reports checked. */
|
|
1232
1385
|
check(options?: BrowserLocatorClickOptions): Promise<void>;
|
|
1386
|
+
/** Clicks the match unless it already reports unchecked. */
|
|
1233
1387
|
uncheck(options?: BrowserLocatorClickOptions): Promise<void>;
|
|
1388
|
+
/** Moves trusted pointer input over the match. */
|
|
1234
1389
|
hover(options?: BrowserPointerOptions): Promise<void>;
|
|
1390
|
+
/** Gives the match keyboard focus. */
|
|
1235
1391
|
focus(options?: BrowserActionOptions): Promise<void>;
|
|
1392
|
+
/** Focuses the match and presses one key or chord. */
|
|
1236
1393
|
press(key: string, options?: BrowserLocatorTypeOptions): Promise<void>;
|
|
1394
|
+
/** Focuses the match and types the value one key at a time. */
|
|
1237
1395
|
type(value: string, options?: BrowserLocatorTypeOptions): Promise<void>;
|
|
1396
|
+
/** Empties the match's value. */
|
|
1238
1397
|
clear(options?: BrowserActionOptions): Promise<void>;
|
|
1398
|
+
/** Waits until the match reaches the requested state. Rejects on timeout. */
|
|
1239
1399
|
wait(options?: BrowserWaitOptions): Promise<void>;
|
|
1400
|
+
/** Reads the first match's rendered text. */
|
|
1240
1401
|
text(): Promise<string>;
|
|
1402
|
+
/** Reads the rendered text of every match. */
|
|
1241
1403
|
texts(): Promise<readonly string[]>;
|
|
1404
|
+
/** Reads the first match's inner HTML. */
|
|
1242
1405
|
html(): Promise<string>;
|
|
1406
|
+
/** Reads the first match's form value. */
|
|
1243
1407
|
value(): Promise<string>;
|
|
1408
|
+
/**
|
|
1409
|
+
* Reads one attribute of the first match, or returns `undefined` when the match carries
|
|
1410
|
+
* none.
|
|
1411
|
+
*/
|
|
1244
1412
|
attribute(name: string): Promise<string | undefined>;
|
|
1413
|
+
/** Reports whether the first match renders a non-empty box. */
|
|
1245
1414
|
visible(): Promise<boolean>;
|
|
1415
|
+
/** Reports whether the first match accepts input. */
|
|
1246
1416
|
enabled(): Promise<boolean>;
|
|
1417
|
+
/** Reports whether the first match accepts typed text. */
|
|
1247
1418
|
editable(): Promise<boolean>;
|
|
1419
|
+
/**
|
|
1420
|
+
* Captures the first match's box, persisting it through the page writer when a path is
|
|
1421
|
+
* given.
|
|
1422
|
+
*/
|
|
1248
1423
|
screenshot(options?: BrowserScreenshotOptions): Promise<BrowserScreenshotResult>;
|
|
1424
|
+
/** Sets the file selection on the matched file input. */
|
|
1249
1425
|
upload(options: BrowserUploadOptions): Promise<void>;
|
|
1426
|
+
/** Drags the match onto the target locator with trusted pointer input. */
|
|
1250
1427
|
drag(target: BrowserLocatorInterface, options?: BrowserLocatorDragOptions): Promise<void>;
|
|
1251
1428
|
}
|
|
1252
1429
|
|
|
@@ -1314,11 +1491,20 @@ export declare type BrowserMouseButton = 'left' | 'middle' | 'right' | 'back' |
|
|
|
1314
1491
|
|
|
1315
1492
|
/** Provides mouse input operations bound to one frame target session. */
|
|
1316
1493
|
export declare interface BrowserMouseInterface {
|
|
1494
|
+
/** Moves the pointer to a point, carrying the pressed buttons. */
|
|
1317
1495
|
move(point: BrowserPoint): Promise<void>;
|
|
1496
|
+
/** Presses a button at the current point, adding it to the pressed mask. */
|
|
1318
1497
|
down(button?: BrowserMouseButton, count?: number): Promise<void>;
|
|
1498
|
+
/**
|
|
1499
|
+
* Releases a button at the current point, dropping it from the mask even when the frame
|
|
1500
|
+
* fails.
|
|
1501
|
+
*/
|
|
1319
1502
|
up(button?: BrowserMouseButton, count?: number): Promise<void>;
|
|
1503
|
+
/** Moves to the given point, presses, optionally delays, and releases. */
|
|
1320
1504
|
click(point: BrowserPoint, options?: BrowserClickOptions): Promise<void>;
|
|
1505
|
+
/** Presses at the start, moves in the requested steps to the end, and releases. */
|
|
1321
1506
|
drag(start: BrowserPoint, end: BrowserPoint, options?: BrowserDragOptions): Promise<void>;
|
|
1507
|
+
/** Sends a wheel delta at the current point. */
|
|
1322
1508
|
wheel(delta: BrowserPoint): Promise<void>;
|
|
1323
1509
|
}
|
|
1324
1510
|
|
|
@@ -1343,7 +1529,15 @@ export declare class BrowserNavigationManager implements BrowserNavigationManage
|
|
|
1343
1529
|
|
|
1344
1530
|
/** Provides URL and in-page predicate waits associated with one page. */
|
|
1345
1531
|
export declare interface BrowserNavigationManagerInterface {
|
|
1532
|
+
/**
|
|
1533
|
+
* Resolves with the URL of the next navigation matching the `*` and `**` glob pattern.
|
|
1534
|
+
* Rejects on timeout.
|
|
1535
|
+
*/
|
|
1346
1536
|
wait(pattern: string, options?: BrowserNavigationWaitOptions): Promise<string>;
|
|
1537
|
+
/**
|
|
1538
|
+
* Polls an expression in the page until it returns a truthy value, and resolves with that
|
|
1539
|
+
* value.
|
|
1540
|
+
*/
|
|
1347
1541
|
until(expression: string, options?: BrowserNavigationWaitOptions): Promise<unknown>;
|
|
1348
1542
|
}
|
|
1349
1543
|
|
|
@@ -1428,15 +1622,25 @@ export declare class BrowserNetworkManager implements BrowserNetworkManagerInter
|
|
|
1428
1622
|
export declare interface BrowserNetworkManagerInterface {
|
|
1429
1623
|
readonly emitter: EmitterInterface<BrowserNetworkEventMap>;
|
|
1430
1624
|
readonly har: BrowserHARManagerInterface;
|
|
1625
|
+
/** Enables the Network domain and subscribes to its events. Idempotent. */
|
|
1431
1626
|
start(): Promise<void>;
|
|
1627
|
+
/** Reads one observed response body as bytes. */
|
|
1432
1628
|
body(id: string): Promise<Uint8Array>;
|
|
1629
|
+
/** Reads one observed response body as text. */
|
|
1433
1630
|
text(id: string): Promise<string>;
|
|
1631
|
+
/** Reads one observed response body as parsed JSON. */
|
|
1434
1632
|
json(id: string): Promise<unknown>;
|
|
1633
|
+
/** Intercepts requests matching the query and hands each one to the handler. */
|
|
1435
1634
|
route(query: BrowserRouteQuery, handler: BrowserRouteHandler): Promise<void>;
|
|
1635
|
+
/** Removes one handler's routes, or every route when given none. */
|
|
1436
1636
|
unroute(handler?: BrowserRouteHandler): Promise<void>;
|
|
1637
|
+
/** Applies extra HTTP headers to every request the page makes. */
|
|
1437
1638
|
headers(headers: Readonly<Record<string, string>>): Promise<void>;
|
|
1639
|
+
/** Emulates an offline connection, or restores connectivity. */
|
|
1438
1640
|
offline(offline: boolean): Promise<void>;
|
|
1641
|
+
/** Applies HTTP basic-auth credentials, or clears them when given none. */
|
|
1439
1642
|
credentials(credentials?: BrowserCredentials): Promise<void>;
|
|
1643
|
+
/** Removes every route, unsubscribes, and disables the domains this manager enabled. */
|
|
1440
1644
|
destroy(): Promise<void>;
|
|
1441
1645
|
}
|
|
1442
1646
|
|
|
@@ -1570,7 +1774,8 @@ export declare type BrowserPageEventMap = {
|
|
|
1570
1774
|
};
|
|
1571
1775
|
|
|
1572
1776
|
/**
|
|
1573
|
-
* Abstracts a single top-level browser page
|
|
1777
|
+
* Abstracts a single top-level browser page, extending `BrowserFrameInterface` with
|
|
1778
|
+
* navigation, screenshots, frame discovery, DOM snapshots, codegen, and target teardown.
|
|
1574
1779
|
*
|
|
1575
1780
|
* @remarks
|
|
1576
1781
|
* Inherits every {@link BrowserFrameInterface} document operation for the
|
|
@@ -1597,22 +1802,47 @@ export declare interface BrowserPageInterface extends BrowserFrameInterface {
|
|
|
1597
1802
|
readonly opener: BrowserPageInterface | undefined;
|
|
1598
1803
|
readonly target: string;
|
|
1599
1804
|
readonly closed: boolean;
|
|
1805
|
+
/**
|
|
1806
|
+
* Goes to a URL, waits for the requested load condition, and returns the final URL with
|
|
1807
|
+
* its response correlation.
|
|
1808
|
+
*/
|
|
1600
1809
|
navigate(url: string, options?: BrowserNavigationOptions): Promise<BrowserNavigationResult>;
|
|
1810
|
+
/** Reloads the page and returns the final URL with its response correlation. */
|
|
1601
1811
|
reload(options?: BrowserNavigationOptions): Promise<BrowserNavigationResult>;
|
|
1812
|
+
/**
|
|
1813
|
+
* Navigates to the previous history entry, or returns the unchanged URL when none exists.
|
|
1814
|
+
*/
|
|
1602
1815
|
back(options?: BrowserNavigationOptions): Promise<BrowserNavigationResult>;
|
|
1816
|
+
/**
|
|
1817
|
+
* Navigates to the next history entry, or returns the unchanged URL when none exists.
|
|
1818
|
+
*/
|
|
1603
1819
|
forward(options?: BrowserNavigationOptions): Promise<BrowserNavigationResult>;
|
|
1820
|
+
/**
|
|
1821
|
+
* Captures PNG or JPEG bytes, optionally full-page and persisted through an injected
|
|
1822
|
+
* writer.
|
|
1823
|
+
*/
|
|
1604
1824
|
screenshot(options?: BrowserScreenshotOptions): Promise<BrowserScreenshotResult>;
|
|
1825
|
+
/** Prints the page to PDF bytes, optionally persisted through the injected writer. */
|
|
1605
1826
|
pdf(options?: BrowserPDFOptions): Promise<BrowserPDFResult>;
|
|
1827
|
+
/** Looks up a first-class frame by name or URL. */
|
|
1606
1828
|
frame(name: string): Promise<BrowserFrameInterface | undefined>;
|
|
1829
|
+
/** Decodes the flattened frame tree, main frame first. */
|
|
1607
1830
|
frames(): Promise<readonly BrowserFrameInterface[]>;
|
|
1831
|
+
/**
|
|
1832
|
+
* Captures and decodes every attached document, shadow root, template content, layout box,
|
|
1833
|
+
* and requested computed style.
|
|
1834
|
+
*/
|
|
1608
1835
|
snapshot(options?: BrowserSnapshotOptions): Promise<BrowserSnapshotInterface>;
|
|
1836
|
+
/** Starts the action recorder, or returns the running one. */
|
|
1609
1837
|
codegen(options?: BrowserCodegenOptions): Promise<BrowserCodegenInterface>;
|
|
1838
|
+
/** Releases local resources and detaches without closing the remote target. */
|
|
1610
1839
|
destroy(): Promise<void>;
|
|
1840
|
+
/** Closes the remote target and releases its resources. */
|
|
1611
1841
|
close(): Promise<void>;
|
|
1612
1842
|
}
|
|
1613
1843
|
|
|
1614
1844
|
/**
|
|
1615
|
-
* Describes the options for creating a
|
|
1845
|
+
* Describes the options for creating a `BrowserPage` instance.
|
|
1616
1846
|
*
|
|
1617
1847
|
* @remarks
|
|
1618
1848
|
* - `on` — initial event listeners wired at construction
|
|
@@ -1688,6 +1918,7 @@ export declare class BrowserPerformance implements BrowserPerformanceInterface {
|
|
|
1688
1918
|
* is {@link BrowserProfilerInterface}, its peer under `diagnostics`.
|
|
1689
1919
|
*/
|
|
1690
1920
|
export declare interface BrowserPerformanceInterface {
|
|
1921
|
+
/** Enables the domain, reads every metric, and disables the domain again. */
|
|
1691
1922
|
metrics(): Promise<readonly BrowserMetric[]>;
|
|
1692
1923
|
}
|
|
1693
1924
|
|
|
@@ -1713,8 +1944,11 @@ export declare class BrowserPermissionManager implements BrowserPermissionManage
|
|
|
1713
1944
|
|
|
1714
1945
|
/** Provides permission override operations scoped to one browser context. */
|
|
1715
1946
|
export declare interface BrowserPermissionManagerInterface {
|
|
1947
|
+
/** Grants each named permission, optionally for one origin, as its own CDP frame. */
|
|
1716
1948
|
grant(permissions: readonly string[], origin?: string): Promise<void>;
|
|
1949
|
+
/** Denies each named permission, optionally for one origin, as its own CDP frame. */
|
|
1717
1950
|
deny(permissions: readonly string[], origin?: string): Promise<void>;
|
|
1951
|
+
/** Resets every permission override on the context. */
|
|
1718
1952
|
clear(): Promise<void>;
|
|
1719
1953
|
}
|
|
1720
1954
|
|
|
@@ -1784,8 +2018,16 @@ export declare class BrowserProfiler implements BrowserProfilerInterface {
|
|
|
1784
2018
|
/** Drives the sampled CPU profile lifecycle. */
|
|
1785
2019
|
export declare interface BrowserProfilerInterface {
|
|
1786
2020
|
readonly active: boolean;
|
|
2021
|
+
/**
|
|
2022
|
+
* Begins sampling, optionally at an explicit positive integer interval in microseconds.
|
|
2023
|
+
*/
|
|
1787
2024
|
start(interval?: number): Promise<void>;
|
|
2025
|
+
/** Ends sampling and decodes the profile's nodes, samples, and time deltas. */
|
|
1788
2026
|
stop(): Promise<BrowserProfile>;
|
|
2027
|
+
/**
|
|
2028
|
+
* Stops an active profiler, discarding any failure, and does nothing when no profile is
|
|
2029
|
+
* running.
|
|
2030
|
+
*/
|
|
1789
2031
|
destroy(): Promise<void>;
|
|
1790
2032
|
}
|
|
1791
2033
|
|
|
@@ -1859,8 +2101,9 @@ export declare interface BrowserResponse {
|
|
|
1859
2101
|
}
|
|
1860
2102
|
|
|
1861
2103
|
/**
|
|
1862
|
-
* Reports that an `evaluate()`/`content()` result exceeded {@link BROWSER_RESULT_LIMIT}
|
|
1863
|
-
*
|
|
2104
|
+
* Reports that an `evaluate()`/`content()` result exceeded {@link BROWSER_RESULT_LIMIT} and
|
|
2105
|
+
* was rejected in-page before it could overflow the CDP transport frame, under the code
|
|
2106
|
+
* `BROWSER_RESULT_LIMIT_ERROR`.
|
|
1864
2107
|
*/
|
|
1865
2108
|
export declare class BrowserResultLimitError extends BrowserError {
|
|
1866
2109
|
constructor(message: string, context?: Readonly<Record<string, unknown>>);
|
|
@@ -1902,8 +2145,15 @@ export declare interface BrowserRouteInterface {
|
|
|
1902
2145
|
readonly id: string;
|
|
1903
2146
|
readonly request: BrowserRequest;
|
|
1904
2147
|
readonly handled: boolean;
|
|
2148
|
+
/** Fails the request with a Chromium error reason, `'Failed'` by default. */
|
|
1905
2149
|
abort(reason?: string): Promise<void>;
|
|
2150
|
+
/**
|
|
2151
|
+
* Lets the request proceed, optionally overriding its URL, method, headers, or post body.
|
|
2152
|
+
*/
|
|
1906
2153
|
continue(options?: BrowserRouteContinueOptions): Promise<void>;
|
|
2154
|
+
/**
|
|
2155
|
+
* Answers the request locally. Throws when the status is not an integer from 100 to 999.
|
|
2156
|
+
*/
|
|
1907
2157
|
fulfill(options: BrowserRouteFulfillOptions): Promise<void>;
|
|
1908
2158
|
}
|
|
1909
2159
|
|
|
@@ -2000,10 +2250,15 @@ export declare class BrowserScriptManager implements BrowserScriptManagerInterfa
|
|
|
2000
2250
|
|
|
2001
2251
|
/** Manages initialization scripts and host bindings for one page. */
|
|
2002
2252
|
export declare interface BrowserScriptManagerInterface {
|
|
2253
|
+
/** Installs a script evaluated on every new document, and returns its identifier. */
|
|
2003
2254
|
add(source: string): Promise<string>;
|
|
2255
|
+
/** Removes one installed script by identifier. */
|
|
2004
2256
|
remove(id: string): Promise<void>;
|
|
2257
|
+
/** Binds a host function to a page-global name, callable from page JavaScript. */
|
|
2005
2258
|
expose(name: string, handler: BrowserBindingHandler): Promise<void>;
|
|
2259
|
+
/** Removes one exposed binding and its installed bridge script. */
|
|
2006
2260
|
revoke(name: string): Promise<void>;
|
|
2261
|
+
/** Removes every installed script and binding this manager owns. */
|
|
2007
2262
|
destroy(): Promise<void>;
|
|
2008
2263
|
}
|
|
2009
2264
|
|
|
@@ -2024,7 +2279,8 @@ export declare interface BrowserSecurity {
|
|
|
2024
2279
|
export declare type BrowserSelector = 'css' | 'role' | 'text' | 'label' | 'placeholder' | 'testId';
|
|
2025
2280
|
|
|
2026
2281
|
/**
|
|
2027
|
-
* Reports that a selector-based lookup or wait timed out without the element appearing
|
|
2282
|
+
* Reports that a selector-based lookup or wait timed out without the element appearing, under
|
|
2283
|
+
* the code `BROWSER_SELECTOR_ERROR`.
|
|
2028
2284
|
*/
|
|
2029
2285
|
export declare class BrowserSelectorError extends BrowserError {
|
|
2030
2286
|
constructor(message: string, context?: Readonly<Record<string, unknown>>);
|
|
@@ -2057,11 +2313,17 @@ export declare class BrowserSelectorManager implements BrowserSelectorManagerInt
|
|
|
2057
2313
|
* Groups the locator factories by selector semantics.
|
|
2058
2314
|
*/
|
|
2059
2315
|
export declare interface BrowserSelectorManagerInterface {
|
|
2316
|
+
/** Locates by CSS selector. */
|
|
2060
2317
|
css(value: string): BrowserLocatorInterface;
|
|
2318
|
+
/** Locates by ARIA role, optionally by accessible name and exactness. */
|
|
2061
2319
|
role(value: string, options?: BrowserRoleOptions): BrowserLocatorInterface;
|
|
2320
|
+
/** Locates by rendered text, optionally exact. */
|
|
2062
2321
|
text(value: string, options?: BrowserTextOptions): BrowserLocatorInterface;
|
|
2322
|
+
/** Locates a labelled control by its label text, optionally exact. */
|
|
2063
2323
|
label(value: string, options?: BrowserTextOptions): BrowserLocatorInterface;
|
|
2324
|
+
/** Locates an input by its placeholder text, optionally exact. */
|
|
2064
2325
|
placeholder(value: string, options?: BrowserTextOptions): BrowserLocatorInterface;
|
|
2326
|
+
/** Locates by the test-id attribute. */
|
|
2065
2327
|
testId(value: string): BrowserLocatorInterface;
|
|
2066
2328
|
}
|
|
2067
2329
|
|
|
@@ -2115,26 +2377,70 @@ export declare class BrowserSnapshot implements BrowserSnapshotInterface {
|
|
|
2115
2377
|
path(node: BrowserNode): string;
|
|
2116
2378
|
}
|
|
2117
2379
|
|
|
2118
|
-
/**
|
|
2380
|
+
/**
|
|
2381
|
+
* Describes the serializable input for a navigable browser snapshot — the form a
|
|
2382
|
+
* `BrowserSnapshot` is built from and serializes back to.
|
|
2383
|
+
*/
|
|
2119
2384
|
export declare interface BrowserSnapshotInput {
|
|
2120
2385
|
readonly documents: readonly BrowserDocument[];
|
|
2121
2386
|
readonly styles: readonly string[];
|
|
2122
2387
|
}
|
|
2123
2388
|
|
|
2124
|
-
/**
|
|
2389
|
+
/**
|
|
2390
|
+
* Represents a navigable, serializable snapshot of every document attached to a page,
|
|
2391
|
+
* extending `BrowserSnapshotInput` with walking, structural relationships, search, and path
|
|
2392
|
+
* derivation over plain `BrowserNode` values.
|
|
2393
|
+
*/
|
|
2125
2394
|
export declare interface BrowserSnapshotInterface extends BrowserSnapshotInput {
|
|
2395
|
+
/**
|
|
2396
|
+
* Traverses the whole capture, or one subtree when `root` is given and yielded first, in
|
|
2397
|
+
* `'depth'` order by default or in `'breadth'` order. Visits each node exactly once.
|
|
2398
|
+
*/
|
|
2126
2399
|
walk(options?: BrowserWalkOptions): Generator<BrowserNode, void, unknown>;
|
|
2400
|
+
/** Traverses one node's subtree in depth-first order, excluding the node itself. */
|
|
2127
2401
|
descendants(node: BrowserNode): Generator<BrowserNode, void, unknown>;
|
|
2402
|
+
/** Resolves the captured document a node belongs to. */
|
|
2128
2403
|
document(node: BrowserNode): BrowserDocument | undefined;
|
|
2404
|
+
/**
|
|
2405
|
+
* Returns the direct children of a node, entering a linked iframe's content document.
|
|
2406
|
+
*/
|
|
2129
2407
|
children(node: BrowserNode): readonly BrowserNode[];
|
|
2408
|
+
/**
|
|
2409
|
+
* Returns the structural parent of a node, crossing a document boundary to the owning
|
|
2410
|
+
* iframe.
|
|
2411
|
+
*/
|
|
2130
2412
|
parent(node: BrowserNode): BrowserNode | undefined;
|
|
2413
|
+
/**
|
|
2414
|
+
* Returns the structural siblings of a node; `'preceding'` or `'following'` narrows to one
|
|
2415
|
+
* side, and omitting the relation returns every sibling but the node itself.
|
|
2416
|
+
*/
|
|
2131
2417
|
siblings(node: BrowserNode, relation?: BrowserSiblingRelation): readonly BrowserNode[];
|
|
2418
|
+
/**
|
|
2419
|
+
* Returns the ancestors of a node, nearest first, across document and iframe boundaries.
|
|
2420
|
+
*/
|
|
2132
2421
|
ancestors(node: BrowserNode): readonly BrowserNode[];
|
|
2422
|
+
/**
|
|
2423
|
+
* Returns the nearest common ancestor of two nodes, counting each node as its own
|
|
2424
|
+
* candidate.
|
|
2425
|
+
*/
|
|
2133
2426
|
common(first: BrowserNode, second: BrowserNode): BrowserNode | undefined;
|
|
2427
|
+
/**
|
|
2428
|
+
* Returns the structural edge count between two nodes, or `undefined` when they share no
|
|
2429
|
+
* ancestor.
|
|
2430
|
+
*/
|
|
2134
2431
|
distance(first: BrowserNode, second: BrowserNode): number | undefined;
|
|
2432
|
+
/** Returns the first node matching a `BrowserNodeQuery` or a `BrowserNodePredicate`. */
|
|
2135
2433
|
find(query: BrowserNodeQuery | BrowserNodePredicate): BrowserNode | undefined;
|
|
2434
|
+
/**
|
|
2435
|
+
* Returns every matching node, bounded by an optional `limit`; a negative or fractional
|
|
2436
|
+
* limit throws a coded `BrowserError`.
|
|
2437
|
+
*/
|
|
2136
2438
|
filter(query: BrowserNodeQuery | BrowserNodePredicate, limit?: number): readonly BrowserNode[];
|
|
2439
|
+
/**
|
|
2440
|
+
* Returns the nearest match from a node through its ancestors, testing the node first.
|
|
2441
|
+
*/
|
|
2137
2442
|
closest(node: BrowserNode, query: BrowserNodeQuery | BrowserNodePredicate): BrowserNode | undefined;
|
|
2443
|
+
/** Returns a deterministic frame-qualified structural path for one node. */
|
|
2138
2444
|
path(node: BrowserNode): string;
|
|
2139
2445
|
}
|
|
2140
2446
|
|
|
@@ -2191,8 +2497,11 @@ export declare class BrowserStorageManager implements BrowserStorageManagerInter
|
|
|
2191
2497
|
|
|
2192
2498
|
/** Provides storage-state import, export, and clearing operations. */
|
|
2193
2499
|
export declare interface BrowserStorageManagerInterface {
|
|
2500
|
+
/** Reads the context cookies and the per-origin local and session storage. */
|
|
2194
2501
|
state(options?: BrowserStorageOptions): Promise<BrowserStorageState>;
|
|
2502
|
+
/** Writes a previously read state back into the context. */
|
|
2195
2503
|
restore(state: BrowserStorageState): Promise<void>;
|
|
2504
|
+
/** Drops the storage of one origin, or of every origin when given none. */
|
|
2196
2505
|
clear(origin?: string): Promise<void>;
|
|
2197
2506
|
}
|
|
2198
2507
|
|
|
@@ -2270,6 +2579,9 @@ export declare class BrowserTouch implements BrowserTouchInterface {
|
|
|
2270
2579
|
|
|
2271
2580
|
/** Provides touch input operations bound to one frame target session. */
|
|
2272
2581
|
export declare interface BrowserTouchInterface {
|
|
2582
|
+
/**
|
|
2583
|
+
* Dispatches a touch start at the point and a touch end, cancelling the touch on failure.
|
|
2584
|
+
*/
|
|
2273
2585
|
tap(point: BrowserPoint): Promise<void>;
|
|
2274
2586
|
}
|
|
2275
2587
|
|
|
@@ -2297,8 +2609,20 @@ export declare class BrowserTracing implements BrowserTracingInterface {
|
|
|
2297
2609
|
/** Drives the trace capture lifecycle. */
|
|
2298
2610
|
export declare interface BrowserTracingInterface {
|
|
2299
2611
|
readonly active: boolean;
|
|
2612
|
+
/**
|
|
2613
|
+
* Begins tracing with the given categories. Throws a `BrowserError` when a trace is
|
|
2614
|
+
* already active.
|
|
2615
|
+
*/
|
|
2300
2616
|
start(options?: BrowserTracingOptions): Promise<void>;
|
|
2617
|
+
/**
|
|
2618
|
+
* Ends tracing, drains the IO stream, and writes it through the page writer when a path
|
|
2619
|
+
* was set.
|
|
2620
|
+
*/
|
|
2301
2621
|
stop(): Promise<BrowserTracingResult>;
|
|
2622
|
+
/**
|
|
2623
|
+
* Stops an active trace, discarding any failure, and does nothing when no trace is
|
|
2624
|
+
* running.
|
|
2625
|
+
*/
|
|
2302
2626
|
destroy(): Promise<void>;
|
|
2303
2627
|
}
|
|
2304
2628
|
|
|
@@ -2357,6 +2681,10 @@ export declare type BrowserTransitionFunction<T> = () => Promise<T>;
|
|
|
2357
2681
|
*/
|
|
2358
2682
|
export declare interface BrowserTransitionInterface<T> {
|
|
2359
2683
|
readonly pending: Promise<T> | undefined;
|
|
2684
|
+
/**
|
|
2685
|
+
* Starts the work when nothing is in flight, and otherwise joins the running transition
|
|
2686
|
+
* and returns its result.
|
|
2687
|
+
*/
|
|
2360
2688
|
execute(work: BrowserTransitionFunction<T>): Promise<T>;
|
|
2361
2689
|
}
|
|
2362
2690
|
|
|
@@ -2485,9 +2813,13 @@ export declare interface BrowserWorkerInterface {
|
|
|
2485
2813
|
readonly id: string;
|
|
2486
2814
|
readonly url: string;
|
|
2487
2815
|
readonly category: BrowserWorkerCategory;
|
|
2816
|
+
/** Evaluates a guarded expression in the worker and returns its value. */
|
|
2488
2817
|
evaluate(expression: string, timeout?: number): Promise<unknown>;
|
|
2818
|
+
/** Issues one CDP method call on the worker's session. */
|
|
2489
2819
|
send(method: string, params?: Readonly<Record<string, unknown>>): Promise<unknown>;
|
|
2820
|
+
/** Stops driving the worker locally without closing its target. */
|
|
2490
2821
|
detach(): void;
|
|
2822
|
+
/** Closes the worker target, tolerating a worker that already terminated. Idempotent. */
|
|
2491
2823
|
close(): Promise<void>;
|
|
2492
2824
|
}
|
|
2493
2825
|
|
|
@@ -2500,6 +2832,7 @@ export declare interface BrowserWorkerInterface {
|
|
|
2500
2832
|
* screenshot, PDF, trace, or HAR request carries a `path`.
|
|
2501
2833
|
*/
|
|
2502
2834
|
export declare interface BrowserWriterInterface {
|
|
2835
|
+
/** Persists the captured bytes to the given path, creating its parent directories. */
|
|
2503
2836
|
write(path: string, data: Uint8Array): Promise<void>;
|
|
2504
2837
|
}
|
|
2505
2838
|
|
|
@@ -2598,16 +2931,26 @@ export declare type CDPClientEventMap = {
|
|
|
2598
2931
|
export declare interface CDPClientInterface {
|
|
2599
2932
|
readonly emitter: EmitterInterface<CDPClientEventMap>;
|
|
2600
2933
|
readonly connected: boolean;
|
|
2934
|
+
/** Starts the transport and begins dispatching. Idempotent. */
|
|
2601
2935
|
connect(): Promise<void>;
|
|
2936
|
+
/** Closes the transport and re-establishes it. */
|
|
2602
2937
|
reconnect(): Promise<void>;
|
|
2938
|
+
/**
|
|
2939
|
+
* Issues a CDP method call with optional params and a trailing `CDPSendOptions` carrying
|
|
2940
|
+
* the `session` to scope it to and a per-call `timeout` overriding the client-wide
|
|
2941
|
+
* default; rejects on timeout.
|
|
2942
|
+
*/
|
|
2603
2943
|
send(method: string, params?: Readonly<Record<string, unknown>>, options?: CDPSendOptions): Promise<unknown>;
|
|
2944
|
+
/** Registers a handler for a CDP event, optionally session-scoped. */
|
|
2604
2945
|
subscribe(method: string, handler: CDPHandler, session?: string): void;
|
|
2946
|
+
/** Removes a handler for a CDP event, optionally session-scoped. */
|
|
2605
2947
|
unsubscribe(method: string, handler: CDPHandler, session?: string): void;
|
|
2948
|
+
/** Tears down the transport and rejects every pending request. */
|
|
2606
2949
|
close(): Promise<void>;
|
|
2607
2950
|
}
|
|
2608
2951
|
|
|
2609
2952
|
/**
|
|
2610
|
-
* Describes the options for creating a CDPClient.
|
|
2953
|
+
* Describes the options for creating a `CDPClient` instance.
|
|
2611
2954
|
*
|
|
2612
2955
|
* @remarks
|
|
2613
2956
|
* - `transport` — the text pipe the client sends/receives JSON-RPC frames over
|
|
@@ -2628,21 +2971,21 @@ export declare interface CDPClientOptions {
|
|
|
2628
2971
|
}
|
|
2629
2972
|
|
|
2630
2973
|
/**
|
|
2631
|
-
* Reports that a CDP request could not be sent or completed because the client was not in
|
|
2632
|
-
*
|
|
2633
|
-
*
|
|
2974
|
+
* Reports that a CDP request could not be sent or completed because the client was not in a
|
|
2975
|
+
* connectable state — not connected, closed while connecting, or the connection dropped
|
|
2976
|
+
* mid-request — under the code `BROWSER_CDP_CONNECTION_ERROR`.
|
|
2634
2977
|
*/
|
|
2635
2978
|
export declare class CDPConnectionError extends BrowserError {
|
|
2636
2979
|
constructor(message: string, context?: Readonly<Record<string, unknown>>);
|
|
2637
2980
|
}
|
|
2638
2981
|
|
|
2639
2982
|
/**
|
|
2640
|
-
* Reports that a CDP request received an error response from the remote endpoint
|
|
2983
|
+
* Reports that a CDP request received an error response from the remote endpoint, under the
|
|
2984
|
+
* code `BROWSER_CDP_ERROR`, with the `method`, the CDP `code`, the `message`, and any `data`
|
|
2985
|
+
* in its context.
|
|
2641
2986
|
*
|
|
2642
2987
|
* @remarks
|
|
2643
|
-
*
|
|
2644
|
-
* `message`, and `data` (when present) in `context`, so callers can branch
|
|
2645
|
-
* on the protocol-level error instead of parsing the message string.
|
|
2988
|
+
* Branch on the protocol-level error in `context` instead of parsing the message string.
|
|
2646
2989
|
*/
|
|
2647
2990
|
export declare class CDPError extends BrowserError {
|
|
2648
2991
|
constructor(message: string, context?: Readonly<Record<string, unknown>>);
|
|
@@ -2678,7 +3021,8 @@ export declare interface CDPTarget {
|
|
|
2678
3021
|
}
|
|
2679
3022
|
|
|
2680
3023
|
/**
|
|
2681
|
-
* Reports that a pending CDP request was not answered within its timeout window
|
|
3024
|
+
* Reports that a pending CDP request was not answered within its timeout window, under the
|
|
3025
|
+
* code `BROWSER_CDP_TIMEOUT_ERROR`.
|
|
2682
3026
|
*/
|
|
2683
3027
|
export declare class CDPTimeoutError extends BrowserError {
|
|
2684
3028
|
constructor(message: string, context?: Readonly<Record<string, unknown>>);
|
|
@@ -2700,7 +3044,7 @@ export declare type CDPTransportEventMap = {
|
|
|
2700
3044
|
};
|
|
2701
3045
|
|
|
2702
3046
|
/**
|
|
2703
|
-
* Represents
|
|
3047
|
+
* Represents the text pipe a `CDPClient` sends and receives JSON-RPC frames over.
|
|
2704
3048
|
*
|
|
2705
3049
|
* @remarks
|
|
2706
3050
|
* The transport owns the connection (WebSocket, pipe, or any other duplex
|
|
@@ -2711,8 +3055,14 @@ export declare type CDPTransportEventMap = {
|
|
|
2711
3055
|
*/
|
|
2712
3056
|
export declare interface CDPTransportInterface {
|
|
2713
3057
|
readonly emitter: EmitterInterface<CDPTransportEventMap>;
|
|
3058
|
+
/** Opens the underlying connection. */
|
|
2714
3059
|
start(): Promise<void>;
|
|
3060
|
+
/**
|
|
3061
|
+
* Writes one raw text frame to the connection. Throws a coded `BrowserConnectionError`
|
|
3062
|
+
* carrying the transport `url` when called before the connection opens or after it closes.
|
|
3063
|
+
*/
|
|
2715
3064
|
send(data: string): Promise<void>;
|
|
3065
|
+
/** Closes the underlying connection and releases its resources. */
|
|
2716
3066
|
close(): Promise<void>;
|
|
2717
3067
|
}
|
|
2718
3068
|
|
|
@@ -2776,7 +3126,7 @@ export declare function compileBrowserBindingSource(name: string): string;
|
|
|
2776
3126
|
export declare function compileClickExpression(selector: string, strict: boolean): string;
|
|
2777
3127
|
|
|
2778
3128
|
/**
|
|
2779
|
-
* Compiles recorded codegen actions into a replayable script.
|
|
3129
|
+
* Compiles recorded codegen actions into a replayable JavaScript or TypeScript script.
|
|
2780
3130
|
*
|
|
2781
3131
|
* @remarks
|
|
2782
3132
|
* Emits one statement per action against a `page` object shaped like
|
|
@@ -2826,9 +3176,9 @@ export declare function compileFillExpression(selector: string, value: string, s
|
|
|
2826
3176
|
export declare function compileFunctionWaitExpression(expression: string, timeout: number): string;
|
|
2827
3177
|
|
|
2828
3178
|
/**
|
|
2829
|
-
* Compiles a `Runtime.evaluate` expression so the
|
|
2830
|
-
*
|
|
2831
|
-
*
|
|
3179
|
+
* Compiles a `Runtime.evaluate` expression so the in-page code stringifies its own result and
|
|
3180
|
+
* throws a recognizable sentinel error before an oversized result would overflow the CDP
|
|
3181
|
+
* transport frame.
|
|
2832
3182
|
*
|
|
2833
3183
|
* @remarks
|
|
2834
3184
|
* A result whose `JSON.stringify` length exceeds `limit` throws
|
|
@@ -2946,7 +3296,7 @@ export declare function compileVisibleWaitExpression(selector: string, strict: b
|
|
|
2946
3296
|
/**
|
|
2947
3297
|
* Computes the CDP Input pressed-button bitmask.
|
|
2948
3298
|
*
|
|
2949
|
-
* @param buttons -
|
|
3299
|
+
* @param buttons - Pressed public mouse buttons
|
|
2950
3300
|
* @returns Combined CDP pressed-button mask
|
|
2951
3301
|
*/
|
|
2952
3302
|
export declare function computeBrowserButtons(buttons: readonly BrowserMouseButton[]): number;
|
|
@@ -2987,7 +3337,7 @@ export declare function cookieToProtocol(cookie: BrowserCookieInput): Readonly<R
|
|
|
2987
3337
|
export declare function createBrowserHAREntry(pending: BrowserHARPending, duration: number, body?: Uint8Array, error?: string): BrowserHAREntry;
|
|
2988
3338
|
|
|
2989
3339
|
/**
|
|
2990
|
-
* Creates a navigable
|
|
3340
|
+
* Creates a navigable `BrowserSnapshotInterface` over decoded `BrowserSnapshotInput` data.
|
|
2991
3341
|
*
|
|
2992
3342
|
* @param input - Captured documents and computed-style names
|
|
2993
3343
|
* @returns A {@link BrowserSnapshotInterface}
|
|
@@ -3003,7 +3353,7 @@ export declare function createBrowserHAREntry(pending: BrowserHARPending, durati
|
|
|
3003
3353
|
export declare function createBrowserSnapshot(input: BrowserSnapshotInput): BrowserSnapshotInterface;
|
|
3004
3354
|
|
|
3005
3355
|
/**
|
|
3006
|
-
* Creates a
|
|
3356
|
+
* Creates a `CDPClientInterface` bound to the given `CDPTransportInterface`.
|
|
3007
3357
|
*
|
|
3008
3358
|
* @param options - The transport (and optional timeout) the client uses
|
|
3009
3359
|
* @returns A {@link CDPClientInterface}
|
|
@@ -3045,7 +3395,8 @@ export declare function decodeBase64(text: string): Uint8Array;
|
|
|
3045
3395
|
export declare function encodeBase64(bytes: Uint8Array): string;
|
|
3046
3396
|
|
|
3047
3397
|
/**
|
|
3048
|
-
* Extracts a keyboard chord such as `Control+Shift+P` into its parts
|
|
3398
|
+
* Extracts a keyboard chord such as `Control+Shift+P` into its parts, throwing a
|
|
3399
|
+
* `BrowserError` on an empty chord or an unsupported modifier.
|
|
3049
3400
|
*
|
|
3050
3401
|
* @param value - Chord source
|
|
3051
3402
|
* @returns Canonical modifiers and terminal key
|
|
@@ -3054,7 +3405,7 @@ export declare function encodeBase64(bytes: Uint8Array): string;
|
|
|
3054
3405
|
export declare function extractBrowserChord(value: string): BrowserChord;
|
|
3055
3406
|
|
|
3056
3407
|
/**
|
|
3057
|
-
* Narrows an unknown value to BrowserError
|
|
3408
|
+
* Narrows an unknown value to a `BrowserError`.
|
|
3058
3409
|
*
|
|
3059
3410
|
* @param value - Value to check
|
|
3060
3411
|
* @returns True if value is a BrowserError instance; false otherwise
|
|
@@ -3062,7 +3413,7 @@ export declare function extractBrowserChord(value: string): BrowserChord;
|
|
|
3062
3413
|
export declare function isBrowserError(value: unknown): value is BrowserError;
|
|
3063
3414
|
|
|
3064
3415
|
/**
|
|
3065
|
-
* Tests whether a browser-node matcher is a declarative query.
|
|
3416
|
+
* Tests whether a browser-node matcher is a declarative query rather than a predicate.
|
|
3066
3417
|
*
|
|
3067
3418
|
* @param value - Browser-node query or predicate
|
|
3068
3419
|
* @returns True if the matcher is a declarative query; false otherwise
|
|
@@ -3086,7 +3437,7 @@ export declare function isBrowserNodeQuery(value: BrowserNodeQuery | BrowserNode
|
|
|
3086
3437
|
export declare function isBrowserNodeVisible(node: BrowserNode): boolean;
|
|
3087
3438
|
|
|
3088
3439
|
/**
|
|
3089
|
-
* Narrows an unknown value to BrowserResultLimitError
|
|
3440
|
+
* Narrows an unknown value to a `BrowserResultLimitError`.
|
|
3090
3441
|
*
|
|
3091
3442
|
* @param value - Value to check
|
|
3092
3443
|
* @returns True if value is a BrowserResultLimitError instance; false otherwise
|
|
@@ -3094,7 +3445,7 @@ export declare function isBrowserNodeVisible(node: BrowserNode): boolean;
|
|
|
3094
3445
|
export declare function isBrowserResultLimitError(value: unknown): value is BrowserResultLimitError;
|
|
3095
3446
|
|
|
3096
3447
|
/**
|
|
3097
|
-
* Narrows an unknown value to BrowserSelectorError
|
|
3448
|
+
* Narrows an unknown value to a `BrowserSelectorError`.
|
|
3098
3449
|
*
|
|
3099
3450
|
* @param value - Value to check
|
|
3100
3451
|
* @returns True if value is a BrowserSelectorError instance; false otherwise
|
|
@@ -3102,7 +3453,7 @@ export declare function isBrowserResultLimitError(value: unknown): value is Brow
|
|
|
3102
3453
|
export declare function isBrowserSelectorError(value: unknown): value is BrowserSelectorError;
|
|
3103
3454
|
|
|
3104
3455
|
/**
|
|
3105
|
-
* Narrows an unknown value to CDPConnectionError
|
|
3456
|
+
* Narrows an unknown value to a `CDPConnectionError`.
|
|
3106
3457
|
*
|
|
3107
3458
|
* @param value - Value to check
|
|
3108
3459
|
* @returns True if value is a CDPConnectionError instance; false otherwise
|
|
@@ -3110,7 +3461,7 @@ export declare function isBrowserSelectorError(value: unknown): value is Browser
|
|
|
3110
3461
|
export declare function isCDPConnectionError(value: unknown): value is CDPConnectionError;
|
|
3111
3462
|
|
|
3112
3463
|
/**
|
|
3113
|
-
* Narrows an unknown value to CDPError
|
|
3464
|
+
* Narrows an unknown value to a `CDPError`.
|
|
3114
3465
|
*
|
|
3115
3466
|
* @param value - Value to check
|
|
3116
3467
|
* @returns True if value is a CDPError instance; false otherwise
|
|
@@ -3118,7 +3469,7 @@ export declare function isCDPConnectionError(value: unknown): value is CDPConnec
|
|
|
3118
3469
|
export declare function isCDPError(value: unknown): value is CDPError;
|
|
3119
3470
|
|
|
3120
3471
|
/**
|
|
3121
|
-
* Narrows an unknown value to CDPTimeoutError
|
|
3472
|
+
* Narrows an unknown value to a `CDPTimeoutError`.
|
|
3122
3473
|
*
|
|
3123
3474
|
* @param value - Value to check
|
|
3124
3475
|
* @returns True if value is a CDPTimeoutError instance; false otherwise
|
|
@@ -3178,13 +3529,12 @@ export declare function matchesBrowserURL(url: string, pattern: string): boolean
|
|
|
3178
3529
|
export declare function mediaToFeatures(media: BrowserMedia): ReadonlyArray<Readonly<Record<string, string>>>;
|
|
3179
3530
|
|
|
3180
3531
|
/**
|
|
3181
|
-
* Normalizes
|
|
3532
|
+
* Normalizes recorded codegen actions, collapsing consecutive `fill` actions on the same
|
|
3533
|
+
* selector into the latest value.
|
|
3182
3534
|
*
|
|
3183
3535
|
* @remarks
|
|
3184
|
-
*
|
|
3185
|
-
*
|
|
3186
|
-
* compiled script reflects the final typed value rather than every
|
|
3187
|
-
* intermediate keystroke.
|
|
3536
|
+
* A text input fires one `input` event per keystroke, so the compiled script reflects
|
|
3537
|
+
* the final typed value rather than every intermediate keystroke.
|
|
3188
3538
|
*
|
|
3189
3539
|
* @param actions - Raw recorded actions, in capture order
|
|
3190
3540
|
* @returns Normalized actions, in the same order
|
|
@@ -3255,8 +3605,7 @@ export declare function parseBrowserDownloadStart(value: unknown): BrowserDownlo
|
|
|
3255
3605
|
export declare function parseBrowserPageError(value: unknown): BrowserPageError | undefined;
|
|
3256
3606
|
|
|
3257
3607
|
/**
|
|
3258
|
-
* Coerces a
|
|
3259
|
-
* off-shape.
|
|
3608
|
+
* Coerces a four-number CSS-pixel rectangle to a `BrowserRect`, or `undefined` off-shape.
|
|
3260
3609
|
*
|
|
3261
3610
|
* @param value - Candidate four-number array
|
|
3262
3611
|
* @returns A rectangle, or undefined
|
|
@@ -3356,8 +3705,8 @@ export declare function parseBrowserWebSocketFrame(value: unknown): BrowserWebSo
|
|
|
3356
3705
|
export declare function parseCodegenActionPayload(payload: unknown): BrowserCodegenAction | undefined;
|
|
3357
3706
|
|
|
3358
3707
|
/**
|
|
3359
|
-
* Coerces a `Page.frameNavigated` CDP event to a `navigate` codegen action, or
|
|
3360
|
-
*
|
|
3708
|
+
* Coerces a `Page.frameNavigated` CDP event to a `navigate` codegen action, or `undefined`
|
|
3709
|
+
* off-shape and for every frame but the top-level one.
|
|
3361
3710
|
*
|
|
3362
3711
|
* @remarks
|
|
3363
3712
|
* Only the top-level (main) frame's navigation is recorded — a frame
|
|
@@ -3388,7 +3737,8 @@ export declare function parseNumberArray(value: unknown): readonly number[] | un
|
|
|
3388
3737
|
export declare function parseSnapshotString(strings: readonly string[], index: unknown): string | undefined;
|
|
3389
3738
|
|
|
3390
3739
|
/**
|
|
3391
|
-
* Decodes Accessibility-domain nodes into a flat serializable tree
|
|
3740
|
+
* Decodes Accessibility-domain nodes into a flat serializable tree, throwing a `BrowserError`
|
|
3741
|
+
* off-shape.
|
|
3392
3742
|
*
|
|
3393
3743
|
* @param value - Unknown full or partial AX-tree result
|
|
3394
3744
|
* @returns Valid accessibility snapshot
|
|
@@ -3396,7 +3746,7 @@ export declare function parseSnapshotString(strings: readonly string[], index: u
|
|
|
3396
3746
|
export declare function readBrowserAccessibility(value: unknown): BrowserAccessibilitySnapshot;
|
|
3397
3747
|
|
|
3398
3748
|
/**
|
|
3399
|
-
* Decodes flattened CDP node attributes.
|
|
3749
|
+
* Decodes flattened CDP node attributes into a frozen record, skipping every off-shape pair.
|
|
3400
3750
|
*
|
|
3401
3751
|
* @param value - Candidate string-index array
|
|
3402
3752
|
* @param strings - Snapshot string table
|
|
@@ -3405,7 +3755,7 @@ export declare function readBrowserAccessibility(value: unknown): BrowserAccessi
|
|
|
3405
3755
|
export declare function readBrowserAttributes(value: unknown, strings: readonly string[]): Readonly<Record<string, string>>;
|
|
3406
3756
|
|
|
3407
3757
|
/**
|
|
3408
|
-
* Decodes an Accessibility-domain AXValue.
|
|
3758
|
+
* Decodes an Accessibility-domain AXValue, or `undefined` when the record carries none.
|
|
3409
3759
|
*
|
|
3410
3760
|
* @param value - Unknown AX value
|
|
3411
3761
|
* @returns Underlying value
|
|
@@ -3413,7 +3763,7 @@ export declare function readBrowserAttributes(value: unknown, strings: readonly
|
|
|
3413
3763
|
export declare function readBrowserAXValue(value: unknown): unknown;
|
|
3414
3764
|
|
|
3415
3765
|
/**
|
|
3416
|
-
* Decodes one Chromium cookie.
|
|
3766
|
+
* Decodes one Chromium cookie, throwing a `BrowserError` off-shape.
|
|
3417
3767
|
*
|
|
3418
3768
|
* @param value - Unknown cookie record
|
|
3419
3769
|
* @param index - Source array position for diagnostics
|
|
@@ -3422,7 +3772,7 @@ export declare function readBrowserAXValue(value: unknown): unknown;
|
|
|
3422
3772
|
export declare function readBrowserCookie(value: unknown, index: number): BrowserCookie;
|
|
3423
3773
|
|
|
3424
3774
|
/**
|
|
3425
|
-
* Decodes cookies
|
|
3775
|
+
* Decodes the cookies `Storage.getCookies` returns, throwing a `BrowserError` off-shape.
|
|
3426
3776
|
*
|
|
3427
3777
|
* @param value - Unknown protocol result
|
|
3428
3778
|
* @returns Valid cookies
|
|
@@ -3430,7 +3780,7 @@ export declare function readBrowserCookie(value: unknown, index: number): Browse
|
|
|
3430
3780
|
export declare function readBrowserCookies(value: unknown): readonly BrowserCookie[];
|
|
3431
3781
|
|
|
3432
3782
|
/**
|
|
3433
|
-
* Decodes coverage ranges.
|
|
3783
|
+
* Decodes and normalizes coverage ranges, throwing a `BrowserError` off-shape.
|
|
3434
3784
|
*
|
|
3435
3785
|
* @param value - Unknown ranges
|
|
3436
3786
|
* @param script - Script index for diagnostics
|
|
@@ -3439,7 +3789,8 @@ export declare function readBrowserCookies(value: unknown): readonly BrowserCook
|
|
|
3439
3789
|
export declare function readBrowserCoverageRanges(value: unknown, script: number): readonly BrowserCoverageRange[];
|
|
3440
3790
|
|
|
3441
3791
|
/**
|
|
3442
|
-
* Decodes a flattened CDP `Page.getFrameTree` result
|
|
3792
|
+
* Decodes a flattened CDP `Page.getFrameTree` result into depth-first frame metadata, skipping
|
|
3793
|
+
* every off-shape frame.
|
|
3443
3794
|
*
|
|
3444
3795
|
* @param value - Unknown CDP result
|
|
3445
3796
|
* @returns Frame metadata in depth-first, main-frame-first order
|
|
@@ -3447,7 +3798,8 @@ export declare function readBrowserCoverageRanges(value: unknown, script: number
|
|
|
3447
3798
|
export declare function readBrowserFrames(value: unknown): readonly BrowserFrameInfo[];
|
|
3448
3799
|
|
|
3449
3800
|
/**
|
|
3450
|
-
* Decodes a Chromium Headers object into string values
|
|
3801
|
+
* Decodes a Chromium Headers object into string values, skipping every entry that is neither a
|
|
3802
|
+
* string nor a finite number.
|
|
3451
3803
|
*
|
|
3452
3804
|
* @param value - Unknown headers
|
|
3453
3805
|
* @returns Frozen-compatible header record
|
|
@@ -3455,7 +3807,7 @@ export declare function readBrowserFrames(value: unknown): readonly BrowserFrame
|
|
|
3455
3807
|
export declare function readBrowserHeaders(value: unknown): Readonly<Record<string, string>>;
|
|
3456
3808
|
|
|
3457
3809
|
/**
|
|
3458
|
-
* Decodes Performance-domain metrics.
|
|
3810
|
+
* Decodes Performance-domain metrics, throwing a `BrowserError` off-shape.
|
|
3459
3811
|
*
|
|
3460
3812
|
* @param value - Unknown metrics result
|
|
3461
3813
|
* @returns Valid metrics
|
|
@@ -3463,7 +3815,7 @@ export declare function readBrowserHeaders(value: unknown): Readonly<Record<stri
|
|
|
3463
3815
|
export declare function readBrowserMetrics(value: unknown): readonly BrowserMetric[];
|
|
3464
3816
|
|
|
3465
3817
|
/**
|
|
3466
|
-
* Decodes one CPU profile.
|
|
3818
|
+
* Decodes one CPU profile, throwing a `BrowserError` off-shape.
|
|
3467
3819
|
*
|
|
3468
3820
|
* @param value - Unknown `Profiler.stop` result
|
|
3469
3821
|
* @returns Valid profile
|
|
@@ -3471,7 +3823,7 @@ export declare function readBrowserMetrics(value: unknown): readonly BrowserMetr
|
|
|
3471
3823
|
export declare function readBrowserProfile(value: unknown): BrowserProfile;
|
|
3472
3824
|
|
|
3473
3825
|
/**
|
|
3474
|
-
* Decodes a CPU profile call frame.
|
|
3826
|
+
* Decodes a CPU profile call frame, throwing a `BrowserError` off-shape.
|
|
3475
3827
|
*
|
|
3476
3828
|
* @param value - Unknown call frame
|
|
3477
3829
|
* @param node - Node index for diagnostics
|
|
@@ -3480,7 +3832,8 @@ export declare function readBrowserProfile(value: unknown): BrowserProfile;
|
|
|
3480
3832
|
export declare function readBrowserProfileFrame(value: unknown, node: number): BrowserProfileFrame;
|
|
3481
3833
|
|
|
3482
3834
|
/**
|
|
3483
|
-
* Decodes the first `DOM.getContentQuads` quad and its center
|
|
3835
|
+
* Decodes the first `DOM.getContentQuads` quad and its center, throwing a `BrowserError`
|
|
3836
|
+
* off-shape.
|
|
3484
3837
|
*
|
|
3485
3838
|
* @param value - Unknown CDP result
|
|
3486
3839
|
* @returns Decoded quad
|
|
@@ -3488,7 +3841,8 @@ export declare function readBrowserProfileFrame(value: unknown, node: number): B
|
|
|
3488
3841
|
export declare function readBrowserQuad(value: unknown): BrowserQuad;
|
|
3489
3842
|
|
|
3490
3843
|
/**
|
|
3491
|
-
* Decodes a Runtime remote object's printable value
|
|
3844
|
+
* Decodes a Runtime remote object's printable value, falling back to its unserializable form
|
|
3845
|
+
* and then its description, or `undefined` when it carries none.
|
|
3492
3846
|
*
|
|
3493
3847
|
* @param value - Unknown remote object
|
|
3494
3848
|
* @returns By-value data or a description
|
|
@@ -3496,7 +3850,7 @@ export declare function readBrowserQuad(value: unknown): BrowserQuad;
|
|
|
3496
3850
|
export declare function readBrowserRemoteValue(value: unknown): unknown;
|
|
3497
3851
|
|
|
3498
3852
|
/**
|
|
3499
|
-
* Decodes JavaScript precise coverage.
|
|
3853
|
+
* Decodes JavaScript precise coverage, throwing a `BrowserError` off-shape.
|
|
3500
3854
|
*
|
|
3501
3855
|
* @param value - Unknown `Profiler.takePreciseCoverage` result
|
|
3502
3856
|
* @returns Script coverage
|
|
@@ -3504,7 +3858,8 @@ export declare function readBrowserRemoteValue(value: unknown): unknown;
|
|
|
3504
3858
|
export declare function readBrowserScriptCoverage(value: unknown): readonly BrowserScriptCoverage[];
|
|
3505
3859
|
|
|
3506
3860
|
/**
|
|
3507
|
-
* Decodes the `Page.addScriptToEvaluateOnNewDocument` result
|
|
3861
|
+
* Decodes the `Page.addScriptToEvaluateOnNewDocument` result, throwing a `BrowserError`
|
|
3862
|
+
* off-shape.
|
|
3508
3863
|
*
|
|
3509
3864
|
* @param value - Unknown protocol result
|
|
3510
3865
|
* @returns Script identifier
|
|
@@ -3512,7 +3867,9 @@ export declare function readBrowserScriptCoverage(value: unknown): readonly Brow
|
|
|
3512
3867
|
export declare function readBrowserScriptIdentifier(value: unknown): string;
|
|
3513
3868
|
|
|
3514
3869
|
/**
|
|
3515
|
-
* Decodes a CDP `DOMSnapshot.captureSnapshot` result
|
|
3870
|
+
* Decodes a CDP `DOMSnapshot.captureSnapshot` result into a serializable
|
|
3871
|
+
* `BrowserSnapshotInput`, throwing a `BrowserError` off-shape and a `BrowserResultLimitError`
|
|
3872
|
+
* past the configured node limit.
|
|
3516
3873
|
*
|
|
3517
3874
|
* @param value - Unknown CDP result
|
|
3518
3875
|
* @param styles - Requested computed-style names, in protocol order
|
|
@@ -3522,7 +3879,7 @@ export declare function readBrowserScriptIdentifier(value: unknown): string;
|
|
|
3522
3879
|
export declare function readBrowserSnapshot(value: unknown, styles?: readonly string[], limit?: number): BrowserSnapshotInput;
|
|
3523
3880
|
|
|
3524
3881
|
/**
|
|
3525
|
-
* Decodes a Chromium runtime stack trace.
|
|
3882
|
+
* Decodes a Chromium runtime stack trace, skipping every off-shape call frame.
|
|
3526
3883
|
*
|
|
3527
3884
|
* @param value - Unknown stack trace or call-frame list
|
|
3528
3885
|
* @returns Valid stack frames
|
|
@@ -3530,7 +3887,7 @@ export declare function readBrowserSnapshot(value: unknown, styles?: readonly st
|
|
|
3530
3887
|
export declare function readBrowserStack(value: unknown): readonly BrowserStackFrame[];
|
|
3531
3888
|
|
|
3532
3889
|
/**
|
|
3533
|
-
* Decodes a list of web-storage entries.
|
|
3890
|
+
* Decodes a list of web-storage entries, throwing a `BrowserError` off-shape.
|
|
3534
3891
|
*
|
|
3535
3892
|
* @param value - Unknown entry list
|
|
3536
3893
|
* @param origin - Origin used for diagnostics
|
|
@@ -3540,7 +3897,7 @@ export declare function readBrowserStack(value: unknown): readonly BrowserStackF
|
|
|
3540
3897
|
export declare function readBrowserStorageEntries(value: unknown, origin: string, storage: 'local' | 'session'): readonly BrowserStorageEntry[];
|
|
3541
3898
|
|
|
3542
3899
|
/**
|
|
3543
|
-
* Decodes one in-page web-storage snapshot.
|
|
3900
|
+
* Decodes one in-page web-storage snapshot, throwing a `BrowserError` off-shape.
|
|
3544
3901
|
*
|
|
3545
3902
|
* @param value - Unknown evaluation result
|
|
3546
3903
|
* @param origin - Origin represented by the result
|
|
@@ -3549,7 +3906,7 @@ export declare function readBrowserStorageEntries(value: unknown, origin: string
|
|
|
3549
3906
|
export declare function readBrowserStorageOrigin(value: unknown, origin: string): BrowserStorageOrigin;
|
|
3550
3907
|
|
|
3551
3908
|
/**
|
|
3552
|
-
* Decodes one `IO.read` response.
|
|
3909
|
+
* Decodes one `IO.read` response, throwing a `BrowserError` off-shape.
|
|
3553
3910
|
*
|
|
3554
3911
|
* @param value - Unknown protocol result
|
|
3555
3912
|
* @returns Valid stream chunk
|
|
@@ -3557,7 +3914,7 @@ export declare function readBrowserStorageOrigin(value: unknown, origin: string)
|
|
|
3557
3914
|
export declare function readBrowserStreamChunk(value: unknown): BrowserStreamChunk;
|
|
3558
3915
|
|
|
3559
3916
|
/**
|
|
3560
|
-
* Decodes CSS rule usage.
|
|
3917
|
+
* Decodes CSS rule usage, throwing a `BrowserError` off-shape.
|
|
3561
3918
|
*
|
|
3562
3919
|
* @param value - Unknown `CSS.stopRuleUsageTracking` result
|
|
3563
3920
|
* @returns Stylesheet coverage
|
|
@@ -3565,7 +3922,8 @@ export declare function readBrowserStreamChunk(value: unknown): BrowserStreamChu
|
|
|
3565
3922
|
export declare function readBrowserStyleCoverage(value: unknown): readonly BrowserStyleCoverage[];
|
|
3566
3923
|
|
|
3567
3924
|
/**
|
|
3568
|
-
* Decodes one CDP `Runtime.evaluate` result
|
|
3925
|
+
* Decodes one CDP `Runtime.evaluate` result, throwing a `BrowserError` on a failed evaluation
|
|
3926
|
+
* and a `BrowserResultLimitError` past the guarded result size.
|
|
3569
3927
|
*
|
|
3570
3928
|
* @param value - Unknown CDP result
|
|
3571
3929
|
* @returns The returned by-value payload, or undefined
|
|
@@ -3573,7 +3931,8 @@ export declare function readBrowserStyleCoverage(value: unknown): readonly Brows
|
|
|
3573
3931
|
export declare function readEvaluationResult(value: unknown): unknown;
|
|
3574
3932
|
|
|
3575
3933
|
/**
|
|
3576
|
-
* Decodes CDP snapshot sparse boolean data
|
|
3934
|
+
* Decodes CDP snapshot sparse boolean data into a set of node indexes, skipping every
|
|
3935
|
+
* off-shape entry.
|
|
3577
3936
|
*
|
|
3578
3937
|
* @param value - Sparse `{ index }` record
|
|
3579
3938
|
* @returns Set of node indexes whose value is true
|
|
@@ -3581,7 +3940,8 @@ export declare function readEvaluationResult(value: unknown): unknown;
|
|
|
3581
3940
|
export declare function readRareBooleanData(value: unknown): ReadonlySet<number>;
|
|
3582
3941
|
|
|
3583
3942
|
/**
|
|
3584
|
-
* Decodes CDP snapshot sparse integer data
|
|
3943
|
+
* Decodes CDP snapshot sparse integer data into a node-index map, skipping every off-shape
|
|
3944
|
+
* entry.
|
|
3585
3945
|
*
|
|
3586
3946
|
* @param value - Sparse `{ index, value }` record
|
|
3587
3947
|
* @returns Node-index to integer map
|
|
@@ -3589,7 +3949,8 @@ export declare function readRareBooleanData(value: unknown): ReadonlySet<number>
|
|
|
3589
3949
|
export declare function readRareIntegerData(value: unknown): ReadonlyMap<number, number>;
|
|
3590
3950
|
|
|
3591
3951
|
/**
|
|
3592
|
-
* Decodes CDP snapshot sparse string data
|
|
3952
|
+
* Decodes CDP snapshot sparse string data into a node-index map, skipping every off-shape
|
|
3953
|
+
* entry.
|
|
3593
3954
|
*
|
|
3594
3955
|
* @param value - Sparse `{ index, value }` record
|
|
3595
3956
|
* @param strings - Snapshot string table
|
|
@@ -3666,7 +4027,7 @@ export declare function validateBrowserEmulationOptions(options: BrowserEmulatio
|
|
|
3666
4027
|
export declare function validateBrowserHAR(value: unknown): asserts value is BrowserHAR;
|
|
3667
4028
|
|
|
3668
4029
|
/**
|
|
3669
|
-
* Validates the bounded
|
|
4030
|
+
* Validates the bounded delay, count, steps, and position of one trusted-input operation.
|
|
3670
4031
|
*
|
|
3671
4032
|
* @remarks
|
|
3672
4033
|
* The parameter is `BrowserOperationOptions`, so one validator answers for a
|