@orkestrel/browser 0.0.5 → 0.0.7
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 +12 -3
- package/dist/src/core/index.cjs +6602 -629
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +2906 -309
- package/dist/src/core/index.d.ts +2906 -309
- package/dist/src/core/index.js +6452 -631
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +261 -75
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +53 -5
- package/dist/src/server/index.d.ts +53 -5
- package/dist/src/server/index.js +261 -78
- package/dist/src/server/index.js.map +1 -1
- package/package.json +16 -16
|
@@ -2,6 +2,24 @@ import { EmitterErrorHandler } from '@orkestrel/emitter';
|
|
|
2
2
|
import { EmitterHooks } from '@orkestrel/emitter';
|
|
3
3
|
import { EmitterInterface } from '@orkestrel/emitter';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Return the nearest-first ancestor chain for a captured browser node.
|
|
7
|
+
*
|
|
8
|
+
* @param snapshot - Captured browser snapshot
|
|
9
|
+
* @param node - Descendant node
|
|
10
|
+
* @returns Nearest-first ancestor list
|
|
11
|
+
*/
|
|
12
|
+
export declare function ancestorsOfBrowserNode(snapshot: BrowserSnapshot, node: BrowserNode): readonly BrowserNode[];
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Read one captured node attribute.
|
|
16
|
+
*
|
|
17
|
+
* @param node - Captured browser node
|
|
18
|
+
* @param name - Attribute name
|
|
19
|
+
* @returns Attribute value, or undefined
|
|
20
|
+
*/
|
|
21
|
+
export declare function attributeOfBrowserNode(node: BrowserNode, name: string): string | undefined;
|
|
22
|
+
|
|
5
23
|
/** Base64 alphabet, index-ordered, used to build {@link BASE64_LOOKUP}. */
|
|
6
24
|
export declare const BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
7
25
|
|
|
@@ -34,6 +52,21 @@ export declare const BROWSER_DEFAULT_VIEWPORT_HEIGHT = 720;
|
|
|
34
52
|
/** Default viewport width in pixels. */
|
|
35
53
|
export declare const BROWSER_DEFAULT_VIEWPORT_WIDTH = 1280;
|
|
36
54
|
|
|
55
|
+
/** Isolated-world name used for iframe evaluation. */
|
|
56
|
+
export declare const BROWSER_FRAME_WORLD_NAME = "__orkestrelBrowserFrame";
|
|
57
|
+
|
|
58
|
+
/** Tool identity embedded in HAR 1.2 documents. */
|
|
59
|
+
export declare const BROWSER_HAR_CREATOR: Readonly<{
|
|
60
|
+
name: "@orkestrel/browser";
|
|
61
|
+
version: "0.0.5";
|
|
62
|
+
}>;
|
|
63
|
+
|
|
64
|
+
/** CDP Input modifier bit values keyed by canonical key name. */
|
|
65
|
+
export declare const BROWSER_KEY_MODIFIERS: Readonly<Record<string, number>>;
|
|
66
|
+
|
|
67
|
+
/** CDP Input pressed-button bit values keyed by public mouse button. */
|
|
68
|
+
export declare const BROWSER_MOUSE_BUTTON_MASKS: Readonly<Record<BrowserMouseButton, number>>;
|
|
69
|
+
|
|
37
70
|
/**
|
|
38
71
|
* Maximum serialized-character length for an `evaluate()`/`content()` result,
|
|
39
72
|
* enforced IN-PAGE before the result is returned to CDP.
|
|
@@ -76,6 +109,15 @@ export declare const BROWSER_RESULT_LIMIT_PATTERN: RegExp;
|
|
|
76
109
|
*/
|
|
77
110
|
export declare const BROWSER_RESULT_LIMIT_SENTINEL_PREFIX = "[[ORKESTREL_BROWSER_RESULT_LIMIT]]";
|
|
78
111
|
|
|
112
|
+
/** Attribute used to tag temporary screenshot styles and masks. */
|
|
113
|
+
export declare const BROWSER_SCREENSHOT_ATTRIBUTE = "data-orkestrel-screenshot";
|
|
114
|
+
|
|
115
|
+
/** Default maximum node count accepted from a decoded CDP DOM snapshot. */
|
|
116
|
+
export declare const BROWSER_SNAPSHOT_NODE_LIMIT = 100000;
|
|
117
|
+
|
|
118
|
+
/** Number of animation frames whose element bounds must agree before trusted input. */
|
|
119
|
+
export declare const BROWSER_STABLE_FRAME_COUNT = 2;
|
|
120
|
+
|
|
79
121
|
/**
|
|
80
122
|
* Bound (in milliseconds) on the best-effort `Page.stopLoading` call issued
|
|
81
123
|
* after a failed `navigate()`.
|
|
@@ -88,9 +130,48 @@ export declare const BROWSER_RESULT_LIMIT_SENTINEL_PREFIX = "[[ORKESTREL_BROWSER
|
|
|
88
130
|
*/
|
|
89
131
|
export declare const BROWSER_STOP_LOADING_TIMEOUT_MS = 1000;
|
|
90
132
|
|
|
133
|
+
/** Attribute used by the semantic test-id selector. */
|
|
134
|
+
export declare const BROWSER_TEST_ID_ATTRIBUTE = "data-testid";
|
|
135
|
+
|
|
91
136
|
/** Poll interval in milliseconds while waiting for a selector to appear. */
|
|
92
137
|
export declare const BROWSER_WAIT_POLL_INTERVAL_MS = 100;
|
|
93
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Chromium Accessibility-domain snapshots for one page.
|
|
141
|
+
*/
|
|
142
|
+
export declare class BrowserAccessibility implements BrowserAccessibilityInterface {
|
|
143
|
+
#private;
|
|
144
|
+
constructor(frame: BrowserFrameInterface);
|
|
145
|
+
snapshot(options?: BrowserAccessibilityOptions): Promise<BrowserAccessibilitySnapshot>;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** Accessibility tree inspection. */
|
|
149
|
+
export declare interface BrowserAccessibilityInterface {
|
|
150
|
+
snapshot(options?: BrowserAccessibilityOptions): Promise<BrowserAccessibilitySnapshot>;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** Accessibility snapshot options. */
|
|
154
|
+
export declare interface BrowserAccessibilityOptions {
|
|
155
|
+
readonly root?: number;
|
|
156
|
+
readonly depth?: number;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** Serializable accessibility-tree snapshot. */
|
|
160
|
+
export declare interface BrowserAccessibilitySnapshot {
|
|
161
|
+
readonly roots: readonly string[];
|
|
162
|
+
readonly nodes: readonly BrowserAXNode[];
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** Actionability checks performed before locator input. */
|
|
166
|
+
export declare interface BrowserActionabilityOptions {
|
|
167
|
+
readonly visible?: boolean;
|
|
168
|
+
readonly stable?: boolean;
|
|
169
|
+
readonly events?: boolean;
|
|
170
|
+
readonly enabled?: boolean;
|
|
171
|
+
readonly editable?: boolean;
|
|
172
|
+
readonly position?: BrowserPoint;
|
|
173
|
+
}
|
|
174
|
+
|
|
94
175
|
/**
|
|
95
176
|
* Options for element interaction (click, fill, select, wait).
|
|
96
177
|
*
|
|
@@ -99,8 +180,75 @@ export declare const BROWSER_WAIT_POLL_INTERVAL_MS = 100;
|
|
|
99
180
|
*/
|
|
100
181
|
export declare interface BrowserActionOptions {
|
|
101
182
|
readonly timeout?: number;
|
|
183
|
+
readonly strict?: boolean;
|
|
184
|
+
readonly force?: boolean;
|
|
185
|
+
readonly trial?: boolean;
|
|
186
|
+
readonly delay?: number;
|
|
187
|
+
readonly button?: BrowserMouseButton;
|
|
188
|
+
readonly count?: number;
|
|
189
|
+
readonly position?: BrowserPoint;
|
|
190
|
+
readonly steps?: number;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** One decoded Chromium accessibility node. */
|
|
194
|
+
export declare interface BrowserAXNode {
|
|
195
|
+
readonly id: string;
|
|
196
|
+
readonly parent: string | undefined;
|
|
197
|
+
readonly children: readonly string[];
|
|
198
|
+
readonly backend: number | undefined;
|
|
199
|
+
readonly frame: string | undefined;
|
|
200
|
+
readonly ignored: boolean;
|
|
201
|
+
readonly role: string | undefined;
|
|
202
|
+
readonly name: string | undefined;
|
|
203
|
+
readonly description: string | undefined;
|
|
204
|
+
readonly value: unknown;
|
|
205
|
+
readonly properties: Readonly<Record<string, unknown>>;
|
|
102
206
|
}
|
|
103
207
|
|
|
208
|
+
/** Decoded page-to-host binding call. */
|
|
209
|
+
export declare interface BrowserBindingCall {
|
|
210
|
+
readonly id: string;
|
|
211
|
+
readonly name: string;
|
|
212
|
+
readonly args: readonly unknown[];
|
|
213
|
+
readonly context: number;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** Host function exposed into page JavaScript. */
|
|
217
|
+
export declare type BrowserBindingHandler = (...args: unknown[]) => unknown | Promise<unknown>;
|
|
218
|
+
|
|
219
|
+
/** Parsed keyboard chord. */
|
|
220
|
+
export declare interface BrowserChord {
|
|
221
|
+
readonly modifiers: readonly string[];
|
|
222
|
+
readonly key: string;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Chromium virtual-time budget controls for deterministic page timers.
|
|
227
|
+
*/
|
|
228
|
+
export declare class BrowserClock implements BrowserClockInterface {
|
|
229
|
+
#private;
|
|
230
|
+
constructor(frame: BrowserFrameInterface);
|
|
231
|
+
get installed(): boolean;
|
|
232
|
+
install(time?: number): Promise<void>;
|
|
233
|
+
pause(): Promise<void>;
|
|
234
|
+
resume(): Promise<void>;
|
|
235
|
+
advance(ms: number): Promise<void>;
|
|
236
|
+
uninstall(): Promise<void>;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/** Chromium virtual-time control for deterministic page timers. */
|
|
240
|
+
export declare interface BrowserClockInterface {
|
|
241
|
+
readonly installed: boolean;
|
|
242
|
+
install(time?: number): Promise<void>;
|
|
243
|
+
pause(): Promise<void>;
|
|
244
|
+
resume(): Promise<void>;
|
|
245
|
+
advance(ms: number): Promise<void>;
|
|
246
|
+
uninstall(): Promise<void>;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Records page navigation and form interactions and compiles replayable scripts.
|
|
251
|
+
*/
|
|
104
252
|
export declare class BrowserCodegen implements BrowserCodegenInterface {
|
|
105
253
|
#private;
|
|
106
254
|
constructor(client: CDPClientInterface, sessionId: string, options?: BrowserCodegenOptions);
|
|
@@ -197,6 +345,15 @@ export declare interface BrowserCodegenScriptOptions {
|
|
|
197
345
|
readonly language?: BrowserCodegenLanguage;
|
|
198
346
|
}
|
|
199
347
|
|
|
348
|
+
/** One console API call. */
|
|
349
|
+
export declare interface BrowserConsoleMessage {
|
|
350
|
+
readonly level: string;
|
|
351
|
+
readonly text: string;
|
|
352
|
+
readonly values: readonly unknown[];
|
|
353
|
+
readonly timestamp: number;
|
|
354
|
+
readonly stack: readonly BrowserStackFrame[];
|
|
355
|
+
}
|
|
356
|
+
|
|
200
357
|
/**
|
|
201
358
|
* Result of page content extraction.
|
|
202
359
|
*
|
|
@@ -213,10 +370,18 @@ export declare interface BrowserContentResult {
|
|
|
213
370
|
readonly text: string;
|
|
214
371
|
}
|
|
215
372
|
|
|
373
|
+
/**
|
|
374
|
+
* Owns pages and shared state inside one Chromium browser context.
|
|
375
|
+
*/
|
|
216
376
|
export declare class BrowserContext implements BrowserContextInterface {
|
|
217
377
|
#private;
|
|
218
|
-
constructor(client: CDPClientInterface, id?: string, viewport?: BrowserViewport, writer?: ScreenshotWriterInterface);
|
|
378
|
+
constructor(client: CDPClientInterface, id?: string, viewport?: BrowserViewport, writer?: ScreenshotWriterInterface, emulation?: BrowserEmulationOptions, downloads?: BrowserDownloadOptions);
|
|
379
|
+
get emitter(): EmitterInterface<BrowserContextEventMap>;
|
|
219
380
|
get id(): string | undefined;
|
|
381
|
+
get cookies(): BrowserCookieManagerInterface;
|
|
382
|
+
get permissions(): BrowserPermissionManagerInterface;
|
|
383
|
+
get storage(): BrowserStorageManagerInterface;
|
|
384
|
+
get emulation(): BrowserEmulationManagerInterface;
|
|
220
385
|
page(index?: number): BrowserPageInterface | undefined;
|
|
221
386
|
pages(): readonly BrowserPageInterface[];
|
|
222
387
|
create(options?: BrowserPageOptions): Promise<BrowserPageInterface>;
|
|
@@ -225,6 +390,12 @@ export declare class BrowserContext implements BrowserContextInterface {
|
|
|
225
390
|
close(): Promise<void>;
|
|
226
391
|
}
|
|
227
392
|
|
|
393
|
+
/** Browser-context lifecycle events. */
|
|
394
|
+
export declare type BrowserContextEventMap = {
|
|
395
|
+
readonly page: readonly [page: BrowserPageInterface];
|
|
396
|
+
readonly close: readonly [];
|
|
397
|
+
};
|
|
398
|
+
|
|
228
399
|
/**
|
|
229
400
|
* Isolated browser session over a CDP browser context.
|
|
230
401
|
*
|
|
@@ -240,7 +411,12 @@ export declare class BrowserContext implements BrowserContextInterface {
|
|
|
240
411
|
* - `close` — close remote pages and dispose the remote context
|
|
241
412
|
*/
|
|
242
413
|
export declare interface BrowserContextInterface {
|
|
414
|
+
readonly emitter: EmitterInterface<BrowserContextEventMap>;
|
|
243
415
|
readonly id: string | undefined;
|
|
416
|
+
readonly cookies: BrowserCookieManagerInterface;
|
|
417
|
+
readonly permissions: BrowserPermissionManagerInterface;
|
|
418
|
+
readonly storage: BrowserStorageManagerInterface;
|
|
419
|
+
readonly emulation: BrowserEmulationManagerInterface;
|
|
244
420
|
page(index?: number): BrowserPageInterface | undefined;
|
|
245
421
|
pages(): readonly BrowserPageInterface[];
|
|
246
422
|
create(options?: BrowserPageOptions): Promise<BrowserPageInterface>;
|
|
@@ -249,6 +425,271 @@ export declare interface BrowserContextInterface {
|
|
|
249
425
|
close(): Promise<void>;
|
|
250
426
|
}
|
|
251
427
|
|
|
428
|
+
/** Options for creating and configuring an isolated browser context. */
|
|
429
|
+
export declare interface BrowserContextOptions {
|
|
430
|
+
readonly proxy?: BrowserProxy;
|
|
431
|
+
readonly origins?: readonly string[];
|
|
432
|
+
readonly downloads?: BrowserDownloadOptions;
|
|
433
|
+
readonly emulation?: BrowserEmulationOptions;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/** One cookie returned from a browser context. */
|
|
437
|
+
export declare interface BrowserCookie {
|
|
438
|
+
readonly name: string;
|
|
439
|
+
readonly value: string;
|
|
440
|
+
readonly domain: string;
|
|
441
|
+
readonly path: string;
|
|
442
|
+
readonly expires: number;
|
|
443
|
+
readonly http: boolean;
|
|
444
|
+
readonly secure: boolean;
|
|
445
|
+
readonly site: BrowserSameSite | undefined;
|
|
446
|
+
readonly partition: BrowserCookiePartition | undefined;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/** Optional narrowing criteria for clearing context cookies. */
|
|
450
|
+
export declare interface BrowserCookieFilter {
|
|
451
|
+
readonly name?: string;
|
|
452
|
+
readonly domain?: string;
|
|
453
|
+
readonly path?: string;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/** Input used to create or replace a browser cookie. */
|
|
457
|
+
export declare interface BrowserCookieInput {
|
|
458
|
+
readonly name: string;
|
|
459
|
+
readonly value: string;
|
|
460
|
+
readonly url?: string;
|
|
461
|
+
readonly domain?: string;
|
|
462
|
+
readonly path?: string;
|
|
463
|
+
readonly expires?: number;
|
|
464
|
+
readonly http?: boolean;
|
|
465
|
+
readonly secure?: boolean;
|
|
466
|
+
readonly site?: BrowserSameSite;
|
|
467
|
+
readonly priority?: 'Low' | 'Medium' | 'High';
|
|
468
|
+
readonly partition?: BrowserCookiePartition;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* Cookie operations isolated to one browser context.
|
|
473
|
+
*/
|
|
474
|
+
export declare class BrowserCookieManager implements BrowserCookieManagerInterface {
|
|
475
|
+
#private;
|
|
476
|
+
constructor(client: CDPClientInterface, context?: string);
|
|
477
|
+
list(urls?: readonly string[]): Promise<readonly BrowserCookie[]>;
|
|
478
|
+
set(cookies: readonly BrowserCookieInput[]): Promise<void>;
|
|
479
|
+
clear(filter?: BrowserCookieFilter): Promise<void>;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/** Cookie operations scoped to one browser context. */
|
|
483
|
+
export declare interface BrowserCookieManagerInterface {
|
|
484
|
+
list(urls?: readonly string[]): Promise<readonly BrowserCookie[]>;
|
|
485
|
+
set(cookies: readonly BrowserCookieInput[]): Promise<void>;
|
|
486
|
+
clear(filter?: BrowserCookieFilter): Promise<void>;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/** Cookie partition key used by CHIPS-partitioned cookies. */
|
|
490
|
+
export declare interface BrowserCookiePartition {
|
|
491
|
+
readonly site: string;
|
|
492
|
+
readonly ancestor?: boolean;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* JavaScript precise coverage and CSS rule usage for one page target.
|
|
497
|
+
*/
|
|
498
|
+
export declare class BrowserCoverage implements BrowserCoverageInterface {
|
|
499
|
+
#private;
|
|
500
|
+
constructor(frame: BrowserFrameInterface);
|
|
501
|
+
get active(): boolean;
|
|
502
|
+
start(options?: BrowserCoverageOptions): Promise<void>;
|
|
503
|
+
stop(): Promise<BrowserCoverageResult>;
|
|
504
|
+
destroy(): Promise<void>;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
/** Coverage capture lifecycle. */
|
|
508
|
+
export declare interface BrowserCoverageInterface {
|
|
509
|
+
readonly active: boolean;
|
|
510
|
+
start(options?: BrowserCoverageOptions): Promise<void>;
|
|
511
|
+
stop(): Promise<BrowserCoverageResult>;
|
|
512
|
+
destroy(): Promise<void>;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/** Coverage capture options. */
|
|
516
|
+
export declare interface BrowserCoverageOptions {
|
|
517
|
+
readonly javascript?: boolean;
|
|
518
|
+
readonly css?: boolean;
|
|
519
|
+
readonly detailed?: boolean;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/** Source range reported by JavaScript or CSS coverage. */
|
|
523
|
+
export declare interface BrowserCoverageRange {
|
|
524
|
+
readonly start: number;
|
|
525
|
+
readonly end: number;
|
|
526
|
+
readonly count: number;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/** Combined JavaScript and CSS usage. */
|
|
530
|
+
export declare interface BrowserCoverageResult {
|
|
531
|
+
readonly scripts: readonly BrowserScriptCoverage[];
|
|
532
|
+
readonly styles: readonly BrowserStyleCoverage[];
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/** HTTP basic-auth credentials applied to context pages. */
|
|
536
|
+
export declare interface BrowserCredentials {
|
|
537
|
+
readonly username: string;
|
|
538
|
+
readonly password: string;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* Diagnostic subentities grouped beneath one page.
|
|
543
|
+
*/
|
|
544
|
+
export declare class BrowserDiagnostics implements BrowserDiagnosticsInterface {
|
|
545
|
+
#private;
|
|
546
|
+
constructor(frame: BrowserFrameInterface, writer?: ScreenshotWriterInterface);
|
|
547
|
+
get tracing(): BrowserTracingInterface;
|
|
548
|
+
get coverage(): BrowserCoverageInterface;
|
|
549
|
+
get performance(): BrowserPerformanceInterface;
|
|
550
|
+
destroy(): Promise<void>;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/** Diagnostics grouped by capability. */
|
|
554
|
+
export declare interface BrowserDiagnosticsInterface {
|
|
555
|
+
readonly tracing: BrowserTracingInterface;
|
|
556
|
+
readonly coverage: BrowserCoverageInterface;
|
|
557
|
+
readonly performance: BrowserPerformanceInterface;
|
|
558
|
+
destroy(): Promise<void>;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* One JavaScript dialog awaiting a user decision.
|
|
563
|
+
*/
|
|
564
|
+
export declare class BrowserDialog implements BrowserDialogInterface {
|
|
565
|
+
#private;
|
|
566
|
+
constructor(frame: BrowserFrameInterface, category: BrowserDialogCategory, message: string, value: string);
|
|
567
|
+
get category(): BrowserDialogCategory;
|
|
568
|
+
get message(): string;
|
|
569
|
+
get default(): string;
|
|
570
|
+
accept(value?: string): Promise<void>;
|
|
571
|
+
dismiss(): Promise<void>;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
/** JavaScript dialog category reported by Chromium. */
|
|
575
|
+
export declare type BrowserDialogCategory = 'alert' | 'confirm' | 'prompt' | 'beforeunload';
|
|
576
|
+
|
|
577
|
+
/** One active JavaScript dialog. */
|
|
578
|
+
export declare interface BrowserDialogInterface {
|
|
579
|
+
readonly category: BrowserDialogCategory;
|
|
580
|
+
readonly message: string;
|
|
581
|
+
readonly default: string;
|
|
582
|
+
accept(value?: string): Promise<void>;
|
|
583
|
+
dismiss(): Promise<void>;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
/** One document captured in a CDP DOM snapshot. */
|
|
587
|
+
export declare interface BrowserDocument {
|
|
588
|
+
readonly index: number;
|
|
589
|
+
readonly frame: string;
|
|
590
|
+
readonly url: string;
|
|
591
|
+
readonly title: string;
|
|
592
|
+
readonly nodes: readonly BrowserNode[];
|
|
593
|
+
readonly scroll: readonly [x: number | undefined, y: number | undefined];
|
|
594
|
+
readonly width: number | undefined;
|
|
595
|
+
readonly height: number | undefined;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* One Chromium download and its progress lifecycle.
|
|
600
|
+
*/
|
|
601
|
+
export declare class BrowserDownload implements BrowserDownloadInterface {
|
|
602
|
+
#private;
|
|
603
|
+
constructor(client: CDPClientInterface, id: string, url: string, name: string, context?: string);
|
|
604
|
+
get emitter(): EmitterInterface<BrowserDownloadEventMap>;
|
|
605
|
+
get id(): string;
|
|
606
|
+
get url(): string;
|
|
607
|
+
get name(): string;
|
|
608
|
+
get status(): BrowserDownloadStatus;
|
|
609
|
+
get received(): number;
|
|
610
|
+
get total(): number;
|
|
611
|
+
get path(): string | undefined;
|
|
612
|
+
cancel(): Promise<void>;
|
|
613
|
+
update(progress: BrowserDownloadProgress): void;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
/** Download progress events. */
|
|
617
|
+
export declare type BrowserDownloadEventMap = {
|
|
618
|
+
readonly progress: readonly [received: number, total: number];
|
|
619
|
+
readonly complete: readonly [path: string | undefined];
|
|
620
|
+
readonly cancel: readonly [];
|
|
621
|
+
};
|
|
622
|
+
|
|
623
|
+
/** One context download tracked through Chromium's Browser domain. */
|
|
624
|
+
export declare interface BrowserDownloadInterface {
|
|
625
|
+
readonly emitter: EmitterInterface<BrowserDownloadEventMap>;
|
|
626
|
+
readonly id: string;
|
|
627
|
+
readonly url: string;
|
|
628
|
+
readonly name: string;
|
|
629
|
+
readonly status: BrowserDownloadStatus;
|
|
630
|
+
readonly received: number;
|
|
631
|
+
readonly total: number;
|
|
632
|
+
readonly path: string | undefined;
|
|
633
|
+
cancel(): Promise<void>;
|
|
634
|
+
update(progress: BrowserDownloadProgress): void;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
/** Download policy for a browser context. */
|
|
638
|
+
export declare interface BrowserDownloadOptions {
|
|
639
|
+
readonly path: string;
|
|
640
|
+
readonly named?: boolean;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
/** Protocol-neutral download progress update. */
|
|
644
|
+
export declare interface BrowserDownloadProgress {
|
|
645
|
+
readonly status: BrowserDownloadStatus;
|
|
646
|
+
readonly received: number;
|
|
647
|
+
readonly total: number;
|
|
648
|
+
readonly path?: string;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
/** Decoded `Browser.downloadWillBegin` event. */
|
|
652
|
+
export declare interface BrowserDownloadStart {
|
|
653
|
+
readonly id: string;
|
|
654
|
+
readonly url: string;
|
|
655
|
+
readonly name: string;
|
|
656
|
+
readonly frame: string;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
/** Download lifecycle phase. */
|
|
660
|
+
export declare type BrowserDownloadStatus = 'pending' | 'complete' | 'cancelled';
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* Rendering, identity, location, and network emulation for context pages.
|
|
664
|
+
*/
|
|
665
|
+
export declare class BrowserEmulationManager implements BrowserEmulationManagerInterface {
|
|
666
|
+
#private;
|
|
667
|
+
constructor(pages: () => readonly BrowserPageInterface[], options?: BrowserEmulationOptions);
|
|
668
|
+
apply(options: BrowserEmulationOptions): Promise<void>;
|
|
669
|
+
clear(): Promise<void>;
|
|
670
|
+
attach(page: BrowserPageInterface): Promise<void>;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
/** Context-scoped emulation configuration. */
|
|
674
|
+
export declare interface BrowserEmulationManagerInterface {
|
|
675
|
+
apply(options: BrowserEmulationOptions): Promise<void>;
|
|
676
|
+
clear(): Promise<void>;
|
|
677
|
+
attach(page: BrowserPageInterface): Promise<void>;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
/** Network and rendering overrides inherited by context pages. */
|
|
681
|
+
export declare interface BrowserEmulationOptions {
|
|
682
|
+
readonly viewport?: BrowserViewport;
|
|
683
|
+
readonly user?: BrowserUserAgent;
|
|
684
|
+
readonly locale?: string;
|
|
685
|
+
readonly timezone?: string;
|
|
686
|
+
readonly geolocation?: BrowserGeolocation;
|
|
687
|
+
readonly media?: BrowserMedia;
|
|
688
|
+
readonly offline?: boolean;
|
|
689
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
690
|
+
readonly credentials?: BrowserCredentials;
|
|
691
|
+
}
|
|
692
|
+
|
|
252
693
|
/**
|
|
253
694
|
* Base error for all browser automation operations.
|
|
254
695
|
*
|
|
@@ -263,465 +704,2470 @@ export declare class BrowserError extends Error {
|
|
|
263
704
|
}
|
|
264
705
|
|
|
265
706
|
/**
|
|
266
|
-
* One
|
|
267
|
-
*
|
|
268
|
-
* @remarks
|
|
269
|
-
* - `id` — the frame's CDP frame id
|
|
270
|
-
* - `parent` — the parent frame's id, undefined for the main frame
|
|
271
|
-
* - `name` — the frame's `name`/`id` HTML attribute, undefined when not set
|
|
272
|
-
* - `url` — the frame's current URL
|
|
707
|
+
* One intercepted file input selection.
|
|
273
708
|
*/
|
|
274
|
-
export declare
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
readonly
|
|
279
|
-
|
|
709
|
+
export declare class BrowserFileChooser implements BrowserFileChooserInterface {
|
|
710
|
+
#private;
|
|
711
|
+
constructor(frame: BrowserFrameInterface, backend: number, multiple: boolean);
|
|
712
|
+
get multiple(): boolean;
|
|
713
|
+
upload(files: readonly string[]): Promise<void>;
|
|
714
|
+
cancel(): Promise<void>;
|
|
715
|
+
}
|
|
280
716
|
|
|
281
|
-
/**
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
* - `timeout` — bounds the whole navigate call (the `Page.navigate` send
|
|
287
|
-
* itself plus the load-event wait), in milliseconds
|
|
288
|
-
*/
|
|
289
|
-
export declare interface BrowserNavigationOptions {
|
|
290
|
-
readonly condition?: BrowserWaitUntil;
|
|
291
|
-
readonly timeout?: number;
|
|
717
|
+
/** One intercepted file chooser. */
|
|
718
|
+
export declare interface BrowserFileChooserInterface {
|
|
719
|
+
readonly multiple: boolean;
|
|
720
|
+
upload(files: readonly string[]): Promise<void>;
|
|
721
|
+
cancel(): Promise<void>;
|
|
292
722
|
}
|
|
293
723
|
|
|
294
|
-
|
|
724
|
+
/** Options for filtering a locator. */
|
|
725
|
+
export declare interface BrowserFilterOptions extends BrowserLocatorFilter {
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* One attached document frame, evaluated through its own CDP execution world.
|
|
730
|
+
*/
|
|
731
|
+
export declare class BrowserFrame implements BrowserFrameInterface {
|
|
295
732
|
#private;
|
|
296
|
-
constructor(client: CDPClientInterface,
|
|
733
|
+
constructor(client: CDPClientInterface, session: string | BrowserSessionFunction, id: string, url: string, parent?: string, name?: string, isolated?: boolean);
|
|
734
|
+
get id(): string;
|
|
735
|
+
get parent(): string | undefined;
|
|
736
|
+
get name(): string | undefined;
|
|
297
737
|
get url(): string;
|
|
298
|
-
get
|
|
738
|
+
get selectors(): BrowserSelectorManagerInterface;
|
|
739
|
+
get keyboard(): BrowserKeyboardInterface;
|
|
740
|
+
get mouse(): BrowserMouseInterface;
|
|
741
|
+
get touch(): BrowserTouchInterface;
|
|
299
742
|
title(): Promise<string>;
|
|
300
|
-
navigate(url: string, options?: BrowserNavigationOptions): Promise<void>;
|
|
301
743
|
content(): Promise<BrowserContentResult>;
|
|
302
|
-
screenshot(options?: BrowserScreenshotOptions): Promise<BrowserScreenshotResult>;
|
|
303
744
|
click(selector: string, options?: BrowserActionOptions): Promise<void>;
|
|
304
745
|
fill(selector: string, value: string, options?: BrowserActionOptions): Promise<void>;
|
|
305
746
|
select(selector: string, values: readonly string[], options?: BrowserActionOptions): Promise<void>;
|
|
306
|
-
evaluate(expression: string): Promise<unknown>;
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
747
|
+
evaluate(expression: string, timeout?: number): Promise<unknown>;
|
|
748
|
+
handle(expression: string): Promise<BrowserHandleInterface>;
|
|
749
|
+
wait(selector: string, options?: BrowserWaitOptions): Promise<void>;
|
|
750
|
+
send(method: string, params?: Readonly<Record<string, unknown>>): Promise<unknown>;
|
|
751
|
+
subscribe(method: string, handler: CDPHandler): Promise<void>;
|
|
752
|
+
unsubscribe(method: string, handler: CDPHandler): Promise<void>;
|
|
753
|
+
save(path: string, _bytes: Uint8Array): Promise<void>;
|
|
754
|
+
protected assert(): void;
|
|
755
|
+
protected request(method: string, params?: Readonly<Record<string, unknown>>, timeout?: number): Promise<unknown>;
|
|
756
|
+
protected raw(expression: string, timeout?: number): Promise<unknown>;
|
|
757
|
+
protected update(url: string): void;
|
|
313
758
|
}
|
|
314
759
|
|
|
315
760
|
/**
|
|
316
|
-
*
|
|
761
|
+
* Serializable frame metadata decoded from CDP `Page.getFrameTree`.
|
|
317
762
|
*
|
|
318
763
|
* @remarks
|
|
319
|
-
* - `
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
* - `
|
|
764
|
+
* - `id` — the frame's CDP frame id
|
|
765
|
+
* - `parent` — the parent frame's id, undefined for the main frame
|
|
766
|
+
* - `name` — the frame's `name`/`id` HTML attribute, undefined when not set
|
|
767
|
+
* - `url` — the frame's current URL
|
|
768
|
+
*/
|
|
769
|
+
export declare interface BrowserFrameInfo {
|
|
770
|
+
readonly id: string;
|
|
771
|
+
readonly parent: string | undefined;
|
|
772
|
+
readonly name: string | undefined;
|
|
773
|
+
readonly url: string;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* Operations shared by a top-level page and an iframe document.
|
|
778
|
+
*
|
|
779
|
+
* @remarks
|
|
780
|
+
* - `id` — CDP frame id
|
|
781
|
+
* - `parent` — parent frame id, undefined for the main frame
|
|
782
|
+
* - `name` — frame `name`/`id`, undefined when absent
|
|
783
|
+
* - `url` — current frame URL
|
|
323
784
|
* - `title` — resolve the document title
|
|
324
|
-
* - `navigate` — go to a URL and wait for the specified load condition
|
|
325
785
|
* - `content` — extract page URL, title, HTML, and visible text
|
|
326
|
-
* - `screenshot` — capture a PNG or JPEG image of the page
|
|
327
786
|
* - `click` — click an element matching the selector
|
|
328
787
|
* - `fill` — type text into an input element
|
|
329
788
|
* - `select` — choose option(s) in a `<select>` element
|
|
330
789
|
* - `evaluate` — execute a JavaScript expression in the page context
|
|
331
|
-
* - `wait` — wait for an element
|
|
332
|
-
* - `
|
|
333
|
-
* - `frames` — list the page's flattened frame tree, main frame first
|
|
334
|
-
* - `codegen` — start (or return the existing) action recorder for this page
|
|
335
|
-
* - `destroy` — release local resources and detach from the target
|
|
336
|
-
* - `close` — close the remote target and release local resources
|
|
790
|
+
* - `wait` — wait for an element state
|
|
791
|
+
* - `send` — issue a raw CDP method in the frame's current target session
|
|
337
792
|
*/
|
|
338
|
-
export declare interface
|
|
793
|
+
export declare interface BrowserFrameInterface {
|
|
794
|
+
readonly id: string;
|
|
795
|
+
readonly parent: string | undefined;
|
|
796
|
+
readonly name: string | undefined;
|
|
339
797
|
readonly url: string;
|
|
340
|
-
readonly
|
|
798
|
+
readonly selectors: BrowserSelectorManagerInterface;
|
|
799
|
+
readonly keyboard: BrowserKeyboardInterface;
|
|
800
|
+
readonly mouse: BrowserMouseInterface;
|
|
801
|
+
readonly touch: BrowserTouchInterface;
|
|
341
802
|
title(): Promise<string>;
|
|
342
|
-
navigate(url: string, options?: BrowserNavigationOptions): Promise<void>;
|
|
343
803
|
content(): Promise<BrowserContentResult>;
|
|
344
|
-
screenshot(options?: BrowserScreenshotOptions): Promise<BrowserScreenshotResult>;
|
|
345
804
|
click(selector: string, options?: BrowserActionOptions): Promise<void>;
|
|
346
805
|
fill(selector: string, value: string, options?: BrowserActionOptions): Promise<void>;
|
|
347
806
|
select(selector: string, values: readonly string[], options?: BrowserActionOptions): Promise<void>;
|
|
348
|
-
evaluate(expression: string): Promise<unknown>;
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
807
|
+
evaluate(expression: string, timeout?: number): Promise<unknown>;
|
|
808
|
+
handle(expression: string): Promise<BrowserHandleInterface>;
|
|
809
|
+
wait(selector: string, options?: BrowserWaitOptions): Promise<void>;
|
|
810
|
+
send(method: string, params?: Readonly<Record<string, unknown>>): Promise<unknown>;
|
|
811
|
+
subscribe(method: string, handler: CDPHandler): Promise<void>;
|
|
812
|
+
unsubscribe(method: string, handler: CDPHandler): Promise<void>;
|
|
813
|
+
save(path: string, bytes: Uint8Array): Promise<void>;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
/** Function coverage inside one script. */
|
|
817
|
+
export declare interface BrowserFunctionCoverage {
|
|
818
|
+
readonly name: string;
|
|
819
|
+
readonly ranges: readonly BrowserCoverageRange[];
|
|
820
|
+
readonly block: boolean;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
/** Geographic location override. */
|
|
824
|
+
export declare interface BrowserGeolocation {
|
|
825
|
+
readonly latitude: number;
|
|
826
|
+
readonly longitude: number;
|
|
827
|
+
readonly accuracy?: number;
|
|
355
828
|
}
|
|
356
829
|
|
|
357
830
|
/**
|
|
358
|
-
*
|
|
359
|
-
*
|
|
360
|
-
* @remarks
|
|
361
|
-
* - `url` — navigate to this URL immediately after creation
|
|
362
|
-
* - `viewport` — override the context-level default viewport
|
|
363
|
-
* - `timeout` — navigation timeout for the initial URL
|
|
831
|
+
* One retained remote object in a frame execution context.
|
|
364
832
|
*/
|
|
365
|
-
export declare
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
833
|
+
export declare class BrowserHandle implements BrowserHandleInterface {
|
|
834
|
+
#private;
|
|
835
|
+
constructor(client: CDPClientInterface, session: string, id: string);
|
|
836
|
+
get id(): string;
|
|
837
|
+
value(): Promise<unknown>;
|
|
838
|
+
call(declaration: string, args?: readonly unknown[]): Promise<unknown>;
|
|
839
|
+
property(name: string): Promise<BrowserHandleInterface | undefined>;
|
|
840
|
+
properties(): Promise<Readonly<Record<string, unknown>>>;
|
|
841
|
+
dispose(): Promise<void>;
|
|
369
842
|
}
|
|
370
843
|
|
|
371
844
|
/**
|
|
372
|
-
*
|
|
373
|
-
* and was rejected in-page before it could overflow the CDP transport frame.
|
|
845
|
+
* A remote JavaScript object retained in one frame execution context.
|
|
374
846
|
*/
|
|
375
|
-
export declare
|
|
376
|
-
|
|
847
|
+
export declare interface BrowserHandleInterface {
|
|
848
|
+
readonly id: string;
|
|
849
|
+
value(): Promise<unknown>;
|
|
850
|
+
call(declaration: string, args?: readonly unknown[]): Promise<unknown>;
|
|
851
|
+
property(name: string): Promise<BrowserHandleInterface | undefined>;
|
|
852
|
+
properties(): Promise<Readonly<Record<string, unknown>>>;
|
|
853
|
+
dispose(): Promise<void>;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
/** Standards-shaped HAR 1.2 document produced by the network manager. */
|
|
857
|
+
export declare interface BrowserHAR {
|
|
858
|
+
readonly log: BrowserHARLog;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
/** Response body metadata in an HTTP archive. */
|
|
862
|
+
export declare interface BrowserHARContent {
|
|
863
|
+
readonly size: number;
|
|
864
|
+
readonly mimeType: string;
|
|
865
|
+
readonly text?: string;
|
|
866
|
+
readonly encoding?: 'base64';
|
|
377
867
|
}
|
|
378
868
|
|
|
379
869
|
/**
|
|
380
|
-
*
|
|
870
|
+
* One cookie in an HTTP archive.
|
|
381
871
|
*
|
|
382
872
|
* @remarks
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
*
|
|
386
|
-
* - `quality` — JPEG quality 0–100 (ignored for PNG)
|
|
873
|
+
* HAR data preserves the official HAR 1.2 JSON field names. These compound
|
|
874
|
+
* properties are external wire-schema keys, so archives remain interoperable
|
|
875
|
+
* without a lossy projection layer.
|
|
387
876
|
*/
|
|
388
|
-
export declare interface
|
|
877
|
+
export declare interface BrowserHARCookie extends BrowserHARValue {
|
|
389
878
|
readonly path?: string;
|
|
390
|
-
readonly
|
|
391
|
-
readonly
|
|
392
|
-
readonly
|
|
879
|
+
readonly domain?: string;
|
|
880
|
+
readonly expires?: string;
|
|
881
|
+
readonly httpOnly?: boolean;
|
|
882
|
+
readonly secure?: boolean;
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
/** Tool identity embedded in an HTTP archive. */
|
|
886
|
+
export declare interface BrowserHARCreator {
|
|
887
|
+
readonly name: string;
|
|
888
|
+
readonly version: string;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
/** One completed HTTP exchange in a HAR recording. */
|
|
892
|
+
export declare interface BrowserHAREntry {
|
|
893
|
+
readonly startedDateTime: string;
|
|
894
|
+
readonly time: number;
|
|
895
|
+
readonly request: BrowserHARRequest;
|
|
896
|
+
readonly response: BrowserHARResponse;
|
|
897
|
+
readonly cache: Readonly<Record<string, unknown>>;
|
|
898
|
+
readonly timings: BrowserHARTimings;
|
|
393
899
|
}
|
|
394
900
|
|
|
395
901
|
/**
|
|
396
|
-
*
|
|
902
|
+
* Convert HAR name/value headers into a Fetch-domain header record.
|
|
397
903
|
*
|
|
398
|
-
* @
|
|
399
|
-
*
|
|
400
|
-
* - `path` — file path if persisted via the page's writer, otherwise undefined
|
|
904
|
+
* @param headers - HAR header entries
|
|
905
|
+
* @returns Header record with later duplicate names replacing earlier values
|
|
401
906
|
*/
|
|
402
|
-
export declare
|
|
403
|
-
|
|
404
|
-
|
|
907
|
+
export declare function browserHARHeadersToRecord(headers: readonly BrowserHARValue[]): Readonly<Record<string, string>>;
|
|
908
|
+
|
|
909
|
+
/** HAR 1.2 log object. */
|
|
910
|
+
export declare interface BrowserHARLog {
|
|
911
|
+
readonly version: '1.2';
|
|
912
|
+
readonly creator: BrowserHARCreator;
|
|
913
|
+
readonly entries: readonly BrowserHAREntry[];
|
|
405
914
|
}
|
|
406
915
|
|
|
407
916
|
/**
|
|
408
|
-
*
|
|
917
|
+
* HTTP archive recording and replay over one page network manager.
|
|
409
918
|
*/
|
|
410
|
-
export declare class
|
|
411
|
-
|
|
919
|
+
export declare class BrowserHARManager implements BrowserHARManagerInterface {
|
|
920
|
+
#private;
|
|
921
|
+
constructor(network: BrowserNetworkManagerInterface, writer?: ScreenshotWriterInterface);
|
|
922
|
+
get recording(): boolean;
|
|
923
|
+
start(options?: BrowserHAROptions): Promise<void>;
|
|
924
|
+
stop(): Promise<BrowserHAR>;
|
|
925
|
+
replay(har: BrowserHAR, options?: BrowserHARReplayOptions): Promise<void>;
|
|
926
|
+
clear(): Promise<void>;
|
|
412
927
|
}
|
|
413
928
|
|
|
414
|
-
/**
|
|
415
|
-
export declare interface
|
|
416
|
-
readonly
|
|
417
|
-
|
|
929
|
+
/** HAR recording and replay operations. */
|
|
930
|
+
export declare interface BrowserHARManagerInterface {
|
|
931
|
+
readonly recording: boolean;
|
|
932
|
+
start(options?: BrowserHAROptions): Promise<void>;
|
|
933
|
+
stop(): Promise<BrowserHAR>;
|
|
934
|
+
replay(har: BrowserHAR, options?: BrowserHARReplayOptions): Promise<void>;
|
|
935
|
+
clear(): Promise<void>;
|
|
418
936
|
}
|
|
419
937
|
|
|
420
|
-
/**
|
|
421
|
-
export declare
|
|
938
|
+
/** HAR recording options. */
|
|
939
|
+
export declare interface BrowserHAROptions {
|
|
940
|
+
readonly path?: string;
|
|
941
|
+
readonly content?: boolean;
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
/** Mutable recording state held until a request finishes. */
|
|
945
|
+
export declare interface BrowserHARPending {
|
|
946
|
+
readonly request: BrowserRequest;
|
|
947
|
+
readonly started: number;
|
|
948
|
+
readonly response: BrowserResponse | undefined;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
/** Request body metadata in an HTTP archive. */
|
|
952
|
+
export declare interface BrowserHARPost {
|
|
953
|
+
readonly mimeType: string;
|
|
954
|
+
readonly text: string;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
/** HAR replay behavior. */
|
|
958
|
+
export declare interface BrowserHARReplayOptions {
|
|
959
|
+
readonly fallback?: boolean;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
/** HAR 1.2 request entry. */
|
|
963
|
+
export declare interface BrowserHARRequest {
|
|
964
|
+
readonly method: string;
|
|
965
|
+
readonly url: string;
|
|
966
|
+
readonly httpVersion: string;
|
|
967
|
+
readonly cookies: readonly BrowserHARCookie[];
|
|
968
|
+
readonly headers: readonly BrowserHARValue[];
|
|
969
|
+
readonly queryString: readonly BrowserHARValue[];
|
|
970
|
+
readonly postData?: BrowserHARPost;
|
|
971
|
+
readonly headersSize: number;
|
|
972
|
+
readonly bodySize: number;
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
/** HAR 1.2 response entry. */
|
|
976
|
+
export declare interface BrowserHARResponse {
|
|
977
|
+
readonly status: number;
|
|
978
|
+
readonly statusText: string;
|
|
979
|
+
readonly httpVersion: string;
|
|
980
|
+
readonly cookies: readonly BrowserHARCookie[];
|
|
981
|
+
readonly headers: readonly BrowserHARValue[];
|
|
982
|
+
readonly content: BrowserHARContent;
|
|
983
|
+
readonly redirectURL: string;
|
|
984
|
+
readonly headersSize: number;
|
|
985
|
+
readonly bodySize: number;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
/** HAR 1.2 phase timings in milliseconds. */
|
|
989
|
+
export declare interface BrowserHARTimings {
|
|
990
|
+
readonly blocked: number;
|
|
991
|
+
readonly dns: number;
|
|
992
|
+
readonly connect: number;
|
|
993
|
+
readonly send: number;
|
|
994
|
+
readonly wait: number;
|
|
995
|
+
readonly receive: number;
|
|
996
|
+
readonly ssl: number;
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
/** One name/value pair in an HTTP archive. */
|
|
1000
|
+
export declare interface BrowserHARValue {
|
|
1001
|
+
readonly name: string;
|
|
1002
|
+
readonly value: string;
|
|
1003
|
+
}
|
|
422
1004
|
|
|
423
1005
|
/**
|
|
424
|
-
*
|
|
1006
|
+
* Convert a header record to Fetch-domain name/value entries.
|
|
1007
|
+
*
|
|
1008
|
+
* @param headers - Header record
|
|
1009
|
+
* @returns Protocol header entries
|
|
1010
|
+
*/
|
|
1011
|
+
export declare function browserHeadersToProtocol(headers: Readonly<Record<string, string>>): readonly Readonly<Record<string, string>>[];
|
|
1012
|
+
|
|
1013
|
+
/** Normalized CDP keyboard key data. */
|
|
1014
|
+
export declare interface BrowserKey {
|
|
1015
|
+
readonly key: string;
|
|
1016
|
+
readonly code: string;
|
|
1017
|
+
readonly text: string | undefined;
|
|
1018
|
+
readonly number: number;
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
/**
|
|
1022
|
+
* Trusted keyboard input through Chromium's CDP Input domain.
|
|
1023
|
+
*/
|
|
1024
|
+
export declare class BrowserKeyboard implements BrowserKeyboardInterface {
|
|
1025
|
+
#private;
|
|
1026
|
+
constructor(frame: BrowserFrameInterface);
|
|
1027
|
+
down(value: string): Promise<void>;
|
|
1028
|
+
up(value: string): Promise<void>;
|
|
1029
|
+
press(value: string, options?: BrowserActionOptions): Promise<void>;
|
|
1030
|
+
type(value: string, options?: BrowserActionOptions): Promise<void>;
|
|
1031
|
+
insert(value: string): Promise<void>;
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
/** Keyboard input operations bound to one frame target session. */
|
|
1035
|
+
export declare interface BrowserKeyboardInterface {
|
|
1036
|
+
down(key: string): Promise<void>;
|
|
1037
|
+
up(key: string): Promise<void>;
|
|
1038
|
+
press(key: string, options?: BrowserActionOptions): Promise<void>;
|
|
1039
|
+
type(value: string, options?: BrowserActionOptions): Promise<void>;
|
|
1040
|
+
insert(value: string): Promise<void>;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
/** Layout data associated with one captured DOM node. */
|
|
1044
|
+
export declare interface BrowserLayout {
|
|
1045
|
+
readonly bounds: BrowserRect | undefined;
|
|
1046
|
+
readonly styles: Readonly<Record<string, string>>;
|
|
1047
|
+
readonly text: string | undefined;
|
|
1048
|
+
readonly paint: number | undefined;
|
|
1049
|
+
readonly offset: BrowserRect | undefined;
|
|
1050
|
+
readonly scroll: BrowserRect | undefined;
|
|
1051
|
+
readonly client: BrowserRect | undefined;
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
/**
|
|
1055
|
+
* Reusable strict semantic locator over one frame.
|
|
1056
|
+
*/
|
|
1057
|
+
export declare class BrowserLocator implements BrowserLocatorInterface {
|
|
1058
|
+
#private;
|
|
1059
|
+
constructor(frame: BrowserFrameInterface, query: BrowserQuery);
|
|
1060
|
+
get frame(): BrowserFrameInterface;
|
|
1061
|
+
get query(): BrowserQuery;
|
|
1062
|
+
locator(selector: string): BrowserLocatorInterface;
|
|
1063
|
+
filter(options: BrowserFilterOptions): BrowserLocatorInterface;
|
|
1064
|
+
first(): BrowserLocatorInterface;
|
|
1065
|
+
last(): BrowserLocatorInterface;
|
|
1066
|
+
item(index: number): BrowserLocatorInterface;
|
|
1067
|
+
count(): Promise<number>;
|
|
1068
|
+
all(): Promise<readonly BrowserLocatorInterface[]>;
|
|
1069
|
+
click(options?: BrowserActionOptions): Promise<void>;
|
|
1070
|
+
fill(value: string, options?: BrowserActionOptions): Promise<void>;
|
|
1071
|
+
select(values: readonly string[], options?: BrowserActionOptions): Promise<void>;
|
|
1072
|
+
check(options?: BrowserActionOptions): Promise<void>;
|
|
1073
|
+
uncheck(options?: BrowserActionOptions): Promise<void>;
|
|
1074
|
+
hover(options?: BrowserActionOptions): Promise<void>;
|
|
1075
|
+
focus(options?: BrowserActionOptions): Promise<void>;
|
|
1076
|
+
press(key: string, options?: BrowserActionOptions): Promise<void>;
|
|
1077
|
+
type(value: string, options?: BrowserActionOptions): Promise<void>;
|
|
1078
|
+
clear(options?: BrowserActionOptions): Promise<void>;
|
|
1079
|
+
wait(options?: BrowserWaitOptions): Promise<void>;
|
|
1080
|
+
text(options?: BrowserTextResultOptions): Promise<string | readonly string[]>;
|
|
1081
|
+
html(): Promise<string>;
|
|
1082
|
+
value(): Promise<string>;
|
|
1083
|
+
attribute(name: string): Promise<string | undefined>;
|
|
1084
|
+
visible(): Promise<boolean>;
|
|
1085
|
+
enabled(): Promise<boolean>;
|
|
1086
|
+
editable(): Promise<boolean>;
|
|
1087
|
+
screenshot(options?: BrowserScreenshotOptions): Promise<BrowserScreenshotResult>;
|
|
1088
|
+
upload(options: BrowserUploadOptions): Promise<void>;
|
|
1089
|
+
drag(target: BrowserLocatorInterface, options?: BrowserActionOptions): Promise<void>;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
/** Declarative locator filter applied after selector resolution. */
|
|
1093
|
+
export declare interface BrowserLocatorFilter {
|
|
1094
|
+
readonly text?: string;
|
|
1095
|
+
readonly exact?: boolean;
|
|
1096
|
+
readonly visible?: boolean;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
/**
|
|
1100
|
+
* Reusable strict locator over one frame.
|
|
1101
|
+
*/
|
|
1102
|
+
export declare interface BrowserLocatorInterface {
|
|
1103
|
+
readonly frame: BrowserFrameInterface;
|
|
1104
|
+
readonly query: BrowserQuery;
|
|
1105
|
+
locator(selector: string): BrowserLocatorInterface;
|
|
1106
|
+
filter(options: BrowserFilterOptions): BrowserLocatorInterface;
|
|
1107
|
+
first(): BrowserLocatorInterface;
|
|
1108
|
+
last(): BrowserLocatorInterface;
|
|
1109
|
+
item(index: number): BrowserLocatorInterface;
|
|
1110
|
+
count(): Promise<number>;
|
|
1111
|
+
all(): Promise<readonly BrowserLocatorInterface[]>;
|
|
1112
|
+
click(options?: BrowserActionOptions): Promise<void>;
|
|
1113
|
+
fill(value: string, options?: BrowserActionOptions): Promise<void>;
|
|
1114
|
+
select(values: readonly string[], options?: BrowserActionOptions): Promise<void>;
|
|
1115
|
+
check(options?: BrowserActionOptions): Promise<void>;
|
|
1116
|
+
uncheck(options?: BrowserActionOptions): Promise<void>;
|
|
1117
|
+
hover(options?: BrowserActionOptions): Promise<void>;
|
|
1118
|
+
focus(options?: BrowserActionOptions): Promise<void>;
|
|
1119
|
+
press(key: string, options?: BrowserActionOptions): Promise<void>;
|
|
1120
|
+
type(value: string, options?: BrowserActionOptions): Promise<void>;
|
|
1121
|
+
clear(options?: BrowserActionOptions): Promise<void>;
|
|
1122
|
+
wait(options?: BrowserWaitOptions): Promise<void>;
|
|
1123
|
+
text(options?: BrowserTextResultOptions): Promise<string | readonly string[]>;
|
|
1124
|
+
html(): Promise<string>;
|
|
1125
|
+
value(): Promise<string>;
|
|
1126
|
+
attribute(name: string): Promise<string | undefined>;
|
|
1127
|
+
visible(): Promise<boolean>;
|
|
1128
|
+
enabled(): Promise<boolean>;
|
|
1129
|
+
editable(): Promise<boolean>;
|
|
1130
|
+
screenshot(options?: BrowserScreenshotOptions): Promise<BrowserScreenshotResult>;
|
|
1131
|
+
upload(options: BrowserUploadOptions): Promise<void>;
|
|
1132
|
+
drag(target: BrowserLocatorInterface, options?: BrowserActionOptions): Promise<void>;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
/** Paper margin lengths accepted by Chromium print-to-PDF. */
|
|
1136
|
+
export declare interface BrowserMargin {
|
|
1137
|
+
readonly top?: number;
|
|
1138
|
+
readonly right?: number;
|
|
1139
|
+
readonly bottom?: number;
|
|
1140
|
+
readonly left?: number;
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
/** Browser color and media feature overrides. */
|
|
1144
|
+
export declare interface BrowserMedia {
|
|
1145
|
+
readonly media?: 'screen' | 'print';
|
|
1146
|
+
readonly color?: 'light' | 'dark' | 'no-preference';
|
|
1147
|
+
readonly contrast?: 'more' | 'less' | 'no-preference';
|
|
1148
|
+
readonly motion?: 'reduce' | 'no-preference';
|
|
1149
|
+
readonly colors?: 'active' | 'none';
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
/** One Performance-domain metric. */
|
|
1153
|
+
export declare interface BrowserMetric {
|
|
1154
|
+
readonly name: string;
|
|
1155
|
+
readonly value: number;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
/**
|
|
1159
|
+
* Trusted mouse input through Chromium's CDP Input domain.
|
|
1160
|
+
*/
|
|
1161
|
+
export declare class BrowserMouse implements BrowserMouseInterface {
|
|
1162
|
+
#private;
|
|
1163
|
+
constructor(frame: BrowserFrameInterface);
|
|
1164
|
+
move(point: BrowserPoint): Promise<void>;
|
|
1165
|
+
down(button?: BrowserMouseButton, count?: number): Promise<void>;
|
|
1166
|
+
up(button?: BrowserMouseButton, count?: number): Promise<void>;
|
|
1167
|
+
click(point: BrowserPoint, options?: BrowserActionOptions): Promise<void>;
|
|
1168
|
+
drag(start: BrowserPoint, end: BrowserPoint, options?: BrowserActionOptions): Promise<void>;
|
|
1169
|
+
wheel(delta: BrowserPoint): Promise<void>;
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
/** Mouse button understood by Chromium's Input domain. */
|
|
1173
|
+
export declare type BrowserMouseButton = 'left' | 'middle' | 'right' | 'back' | 'forward';
|
|
1174
|
+
|
|
1175
|
+
/** Mouse input operations bound to one frame target session. */
|
|
1176
|
+
export declare interface BrowserMouseInterface {
|
|
1177
|
+
move(point: BrowserPoint): Promise<void>;
|
|
1178
|
+
down(button?: BrowserMouseButton, count?: number): Promise<void>;
|
|
1179
|
+
up(button?: BrowserMouseButton, count?: number): Promise<void>;
|
|
1180
|
+
click(point: BrowserPoint, options?: BrowserActionOptions): Promise<void>;
|
|
1181
|
+
drag(start: BrowserPoint, end: BrowserPoint, options?: BrowserActionOptions): Promise<void>;
|
|
1182
|
+
wheel(delta: BrowserPoint): Promise<void>;
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
/**
|
|
1186
|
+
* URL and page-predicate waits resilient to ordinary navigation events.
|
|
1187
|
+
*/
|
|
1188
|
+
export declare class BrowserNavigationManager implements BrowserNavigationManagerInterface {
|
|
1189
|
+
#private;
|
|
1190
|
+
constructor(page: BrowserPageInterface);
|
|
1191
|
+
wait(pattern: string, options?: BrowserNavigationWaitOptions): Promise<string>;
|
|
1192
|
+
until(expression: string, options?: BrowserNavigationWaitOptions): Promise<unknown>;
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
/** URL and in-page predicate waits associated with one page. */
|
|
1196
|
+
export declare interface BrowserNavigationManagerInterface {
|
|
1197
|
+
wait(pattern: string, options?: BrowserNavigationWaitOptions): Promise<string>;
|
|
1198
|
+
until(expression: string, options?: BrowserNavigationWaitOptions): Promise<unknown>;
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
/**
|
|
1202
|
+
* Options for page navigation.
|
|
425
1203
|
*
|
|
426
1204
|
* @remarks
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
*
|
|
430
|
-
|
|
1205
|
+
* - `condition` — page load condition to wait for (default `'load'`)
|
|
1206
|
+
* - `timeout` — bounds the whole navigate call (the `Page.navigate` send
|
|
1207
|
+
* itself plus the load-event wait), in milliseconds
|
|
1208
|
+
*/
|
|
1209
|
+
export declare interface BrowserNavigationOptions {
|
|
1210
|
+
readonly condition?: BrowserWaitUntil;
|
|
1211
|
+
readonly timeout?: number;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
/** Outcome of a top-level navigation command. */
|
|
1215
|
+
export declare interface BrowserNavigationResult {
|
|
1216
|
+
readonly url: string;
|
|
1217
|
+
readonly response: BrowserResponse | undefined;
|
|
1218
|
+
readonly same: boolean;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
/** One pending URL-pattern wait. */
|
|
1222
|
+
export declare interface BrowserNavigationWait {
|
|
1223
|
+
readonly pattern: string;
|
|
1224
|
+
readonly timer: ReturnType<typeof setTimeout>;
|
|
1225
|
+
readonly resolve: (url: string) => void;
|
|
1226
|
+
readonly reject: (error: unknown) => void;
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
/** Options for URL and predicate waits. */
|
|
1230
|
+
export declare interface BrowserNavigationWaitOptions {
|
|
1231
|
+
readonly timeout?: number;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
/** State retained while correlating navigation with Network events. */
|
|
1235
|
+
export declare interface BrowserNavigationWatch {
|
|
1236
|
+
readonly responses: BrowserResponse[];
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
/** Network events emitted by a page's network manager. */
|
|
1240
|
+
export declare type BrowserNetworkEventMap = {
|
|
1241
|
+
readonly request: readonly [request: BrowserRequest];
|
|
1242
|
+
readonly response: readonly [response: BrowserResponse];
|
|
1243
|
+
readonly failure: readonly [failure: BrowserRequestFailure];
|
|
1244
|
+
readonly finish: readonly [id: string];
|
|
1245
|
+
readonly socket: readonly [socket: BrowserWebSocketInterface];
|
|
1246
|
+
};
|
|
1247
|
+
|
|
1248
|
+
/**
|
|
1249
|
+
* Page-scoped Network and Fetch domain lifecycle.
|
|
1250
|
+
*/
|
|
1251
|
+
export declare class BrowserNetworkManager implements BrowserNetworkManagerInterface {
|
|
1252
|
+
#private;
|
|
1253
|
+
constructor(frame: BrowserFrameInterface, writer?: ScreenshotWriterInterface);
|
|
1254
|
+
get emitter(): EmitterInterface<BrowserNetworkEventMap>;
|
|
1255
|
+
get har(): BrowserHARManagerInterface;
|
|
1256
|
+
start(): Promise<void>;
|
|
1257
|
+
body(id: string): Promise<Uint8Array>;
|
|
1258
|
+
text(id: string): Promise<string>;
|
|
1259
|
+
json(id: string): Promise<unknown>;
|
|
1260
|
+
route(query: BrowserRouteQuery, handler: BrowserRouteHandler): Promise<void>;
|
|
1261
|
+
unroute(handler?: BrowserRouteHandler): Promise<void>;
|
|
1262
|
+
headers(headers: Readonly<Record<string, string>>): Promise<void>;
|
|
1263
|
+
offline(offline: boolean): Promise<void>;
|
|
1264
|
+
credentials(credentials?: BrowserCredentials): Promise<void>;
|
|
1265
|
+
destroy(): Promise<void>;
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
/** Page-scoped network observation and interception. */
|
|
1269
|
+
export declare interface BrowserNetworkManagerInterface {
|
|
1270
|
+
readonly emitter: EmitterInterface<BrowserNetworkEventMap>;
|
|
1271
|
+
readonly har: BrowserHARManagerInterface;
|
|
1272
|
+
start(): Promise<void>;
|
|
1273
|
+
body(id: string): Promise<Uint8Array>;
|
|
1274
|
+
text(id: string): Promise<string>;
|
|
1275
|
+
json(id: string): Promise<unknown>;
|
|
1276
|
+
route(query: BrowserRouteQuery, handler: BrowserRouteHandler): Promise<void>;
|
|
1277
|
+
unroute(handler?: BrowserRouteHandler): Promise<void>;
|
|
1278
|
+
headers(headers: Readonly<Record<string, string>>): Promise<void>;
|
|
1279
|
+
offline(offline: boolean): Promise<void>;
|
|
1280
|
+
credentials(credentials?: BrowserCredentials): Promise<void>;
|
|
1281
|
+
destroy(): Promise<void>;
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
/** One serializable DOM node decoded from a CDP DOM snapshot. */
|
|
1285
|
+
export declare interface BrowserNode {
|
|
1286
|
+
readonly document: number;
|
|
1287
|
+
readonly frame: string;
|
|
1288
|
+
readonly index: number;
|
|
1289
|
+
readonly id: number | undefined;
|
|
1290
|
+
readonly parent: number | undefined;
|
|
1291
|
+
readonly type: number;
|
|
1292
|
+
readonly name: string;
|
|
1293
|
+
readonly value: string;
|
|
1294
|
+
readonly attributes: Readonly<Record<string, string>>;
|
|
1295
|
+
readonly text: string | undefined;
|
|
1296
|
+
readonly input: string | undefined;
|
|
1297
|
+
readonly checked: boolean | undefined;
|
|
1298
|
+
readonly selected: boolean | undefined;
|
|
1299
|
+
readonly clickable: boolean | undefined;
|
|
1300
|
+
readonly shadow: string | undefined;
|
|
1301
|
+
readonly content: number | undefined;
|
|
1302
|
+
readonly pseudo: string | undefined;
|
|
1303
|
+
readonly source: string | undefined;
|
|
1304
|
+
readonly origin: string | undefined;
|
|
1305
|
+
readonly layout: BrowserLayout | undefined;
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
/** Predicate used by browser snapshot traversal helpers. */
|
|
1309
|
+
export declare type BrowserNodePredicate = (node: BrowserNode) => boolean;
|
|
1310
|
+
|
|
1311
|
+
/**
|
|
1312
|
+
* Declarative browser-node matcher used by {@link matchesBrowserNode}.
|
|
431
1313
|
*
|
|
432
|
-
*
|
|
433
|
-
*
|
|
434
|
-
*
|
|
435
|
-
*
|
|
1314
|
+
* @remarks
|
|
1315
|
+
* Every supplied field must match. `name` is case-insensitive, `text`
|
|
1316
|
+
* searches layout text and node value, and `attributes` requires every
|
|
1317
|
+
* supplied name/value pair.
|
|
436
1318
|
*/
|
|
437
|
-
export declare
|
|
1319
|
+
export declare interface BrowserNodeQuery {
|
|
1320
|
+
readonly name?: string;
|
|
1321
|
+
readonly text?: string;
|
|
1322
|
+
readonly attributes?: Readonly<Record<string, string>>;
|
|
1323
|
+
readonly frame?: string;
|
|
1324
|
+
readonly visible?: boolean;
|
|
1325
|
+
readonly clickable?: boolean;
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
/**
|
|
1329
|
+
* A top-level browser page, including its target lifecycle and child frames.
|
|
1330
|
+
*/
|
|
1331
|
+
export declare class BrowserPage extends BrowserFrame implements BrowserPageInterface {
|
|
438
1332
|
#private;
|
|
439
|
-
constructor(
|
|
440
|
-
get
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
* transport is active again. Only pending requests are rejected here.
|
|
463
|
-
* If `close()` is called while `connect()` is still awaiting
|
|
464
|
-
* `transport.start()`, the in-flight connect is rejected and the
|
|
465
|
-
* transport is closed deterministically once `start()` resolves.
|
|
466
|
-
*/
|
|
1333
|
+
constructor(client: CDPClientInterface, targetId: string, sessionId: string, writer?: ScreenshotWriterInterface, url?: string, frameId?: string, contextId?: string, opener?: BrowserPageInterface);
|
|
1334
|
+
get emitter(): EmitterInterface<BrowserPageEventMap>;
|
|
1335
|
+
get network(): BrowserNetworkManagerInterface;
|
|
1336
|
+
get navigation(): BrowserNavigationManagerInterface;
|
|
1337
|
+
get scripts(): BrowserScriptManagerInterface;
|
|
1338
|
+
get accessibility(): BrowserAccessibilityInterface;
|
|
1339
|
+
get diagnostics(): BrowserDiagnosticsInterface;
|
|
1340
|
+
get clock(): BrowserClockInterface;
|
|
1341
|
+
get opener(): BrowserPageInterface | undefined;
|
|
1342
|
+
get target(): string;
|
|
1343
|
+
get closed(): boolean;
|
|
1344
|
+
navigate(url: string, options?: BrowserNavigationOptions): Promise<BrowserNavigationResult>;
|
|
1345
|
+
reload(options?: BrowserNavigationOptions): Promise<BrowserNavigationResult>;
|
|
1346
|
+
back(options?: BrowserNavigationOptions): Promise<BrowserNavigationResult>;
|
|
1347
|
+
forward(options?: BrowserNavigationOptions): Promise<BrowserNavigationResult>;
|
|
1348
|
+
screenshot(options?: BrowserScreenshotOptions): Promise<BrowserScreenshotResult>;
|
|
1349
|
+
pdf(options?: BrowserPDFOptions): Promise<BrowserPDFResult>;
|
|
1350
|
+
save(path: string, bytes: Uint8Array): Promise<void>;
|
|
1351
|
+
frame(name: string): Promise<BrowserFrameInterface | undefined>;
|
|
1352
|
+
frames(): Promise<readonly BrowserFrameInterface[]>;
|
|
1353
|
+
snapshot(options?: BrowserSnapshotOptions): Promise<BrowserSnapshot>;
|
|
1354
|
+
codegen(options?: BrowserCodegenOptions): Promise<BrowserCodegenInterface>;
|
|
1355
|
+
destroy(): Promise<void>;
|
|
467
1356
|
close(): Promise<void>;
|
|
1357
|
+
protected assert(): void;
|
|
468
1358
|
}
|
|
469
1359
|
|
|
1360
|
+
/** One uncaught page exception. */
|
|
1361
|
+
export declare interface BrowserPageError {
|
|
1362
|
+
readonly message: string;
|
|
1363
|
+
readonly stack: readonly BrowserStackFrame[];
|
|
1364
|
+
readonly timestamp: number;
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
/** Typed page, frame, target, and user-visible browser events. */
|
|
1368
|
+
export declare type BrowserPageEventMap = {
|
|
1369
|
+
readonly navigate: readonly [url: string];
|
|
1370
|
+
readonly attach: readonly [frame: BrowserFrameInterface];
|
|
1371
|
+
readonly detach: readonly [frame: string];
|
|
1372
|
+
readonly popup: readonly [page: BrowserPageInterface];
|
|
1373
|
+
readonly dialog: readonly [dialog: BrowserDialogInterface];
|
|
1374
|
+
readonly chooser: readonly [chooser: BrowserFileChooserInterface];
|
|
1375
|
+
readonly download: readonly [download: BrowserDownloadInterface];
|
|
1376
|
+
readonly console: readonly [message: BrowserConsoleMessage];
|
|
1377
|
+
readonly error: readonly [error: BrowserPageError];
|
|
1378
|
+
readonly crash: readonly [];
|
|
1379
|
+
readonly worker: readonly [worker: BrowserWorkerInterface];
|
|
1380
|
+
readonly request: readonly [request: BrowserRequest];
|
|
1381
|
+
readonly response: readonly [response: BrowserResponse];
|
|
1382
|
+
readonly failure: readonly [failure: BrowserRequestFailure];
|
|
1383
|
+
readonly socket: readonly [socket: BrowserWebSocketInterface];
|
|
1384
|
+
readonly close: readonly [];
|
|
1385
|
+
};
|
|
1386
|
+
|
|
470
1387
|
/**
|
|
471
|
-
*
|
|
1388
|
+
* Abstraction over a single top-level browser page.
|
|
472
1389
|
*
|
|
473
1390
|
* @remarks
|
|
474
|
-
*
|
|
475
|
-
*
|
|
476
|
-
*
|
|
477
|
-
* - `
|
|
478
|
-
*
|
|
479
|
-
*
|
|
480
|
-
* - `
|
|
481
|
-
*
|
|
482
|
-
* - `
|
|
1391
|
+
* Inherits every {@link BrowserFrameInterface} document operation for the
|
|
1392
|
+
* main frame.
|
|
1393
|
+
*
|
|
1394
|
+
* - `closed` — true after `close()` is called
|
|
1395
|
+
* - `navigate` — go to a URL and wait for the specified load condition
|
|
1396
|
+
* - `screenshot` — capture a PNG or JPEG image of the page
|
|
1397
|
+
* - `frame` — look up a frame by name or URL in the page's flattened frame tree
|
|
1398
|
+
* - `frames` — list the page's flattened frame tree, main frame first
|
|
1399
|
+
* - `snapshot` — capture every attached document as serializable DOM data
|
|
1400
|
+
* - `codegen` — start (or return the existing) action recorder for this page
|
|
1401
|
+
* - `destroy` — release local resources and detach from the target
|
|
1402
|
+
* - `close` — close the remote target and release local resources
|
|
483
1403
|
*/
|
|
484
|
-
export declare interface
|
|
485
|
-
readonly
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
1404
|
+
export declare interface BrowserPageInterface extends BrowserFrameInterface {
|
|
1405
|
+
readonly emitter: EmitterInterface<BrowserPageEventMap>;
|
|
1406
|
+
readonly network: BrowserNetworkManagerInterface;
|
|
1407
|
+
readonly navigation: BrowserNavigationManagerInterface;
|
|
1408
|
+
readonly scripts: BrowserScriptManagerInterface;
|
|
1409
|
+
readonly accessibility: BrowserAccessibilityInterface;
|
|
1410
|
+
readonly diagnostics: BrowserDiagnosticsInterface;
|
|
1411
|
+
readonly clock: BrowserClockInterface;
|
|
1412
|
+
readonly opener: BrowserPageInterface | undefined;
|
|
1413
|
+
readonly target: string;
|
|
1414
|
+
readonly closed: boolean;
|
|
1415
|
+
navigate(url: string, options?: BrowserNavigationOptions): Promise<BrowserNavigationResult>;
|
|
1416
|
+
reload(options?: BrowserNavigationOptions): Promise<BrowserNavigationResult>;
|
|
1417
|
+
back(options?: BrowserNavigationOptions): Promise<BrowserNavigationResult>;
|
|
1418
|
+
forward(options?: BrowserNavigationOptions): Promise<BrowserNavigationResult>;
|
|
1419
|
+
screenshot(options?: BrowserScreenshotOptions): Promise<BrowserScreenshotResult>;
|
|
1420
|
+
pdf(options?: BrowserPDFOptions): Promise<BrowserPDFResult>;
|
|
1421
|
+
frame(name: string): Promise<BrowserFrameInterface | undefined>;
|
|
1422
|
+
frames(): Promise<readonly BrowserFrameInterface[]>;
|
|
1423
|
+
snapshot(options?: BrowserSnapshotOptions): Promise<BrowserSnapshot>;
|
|
1424
|
+
codegen(options?: BrowserCodegenOptions): Promise<BrowserCodegenInterface>;
|
|
1425
|
+
destroy(): Promise<void>;
|
|
491
1426
|
close(): Promise<void>;
|
|
492
1427
|
}
|
|
493
1428
|
|
|
494
1429
|
/**
|
|
495
|
-
* Options for creating a
|
|
1430
|
+
* Options for creating a browser page.
|
|
1431
|
+
*
|
|
1432
|
+
* @remarks
|
|
1433
|
+
* - `url` — navigate to this URL immediately after creation
|
|
1434
|
+
* - `viewport` — override the context-level default viewport
|
|
1435
|
+
* - `timeout` — navigation timeout for the initial URL
|
|
1436
|
+
*/
|
|
1437
|
+
export declare interface BrowserPageOptions {
|
|
1438
|
+
readonly url?: string;
|
|
1439
|
+
readonly viewport?: BrowserViewport;
|
|
1440
|
+
readonly timeout?: number;
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
/** Options for printing a Chromium page to PDF. */
|
|
1444
|
+
export declare interface BrowserPDFOptions {
|
|
1445
|
+
readonly path?: string;
|
|
1446
|
+
readonly landscape?: boolean;
|
|
1447
|
+
readonly background?: boolean;
|
|
1448
|
+
readonly scale?: number;
|
|
1449
|
+
readonly width?: number;
|
|
1450
|
+
readonly height?: number;
|
|
1451
|
+
readonly margin?: BrowserMargin;
|
|
1452
|
+
readonly ranges?: string;
|
|
1453
|
+
readonly header?: string;
|
|
1454
|
+
readonly footer?: string;
|
|
1455
|
+
readonly tagged?: boolean;
|
|
1456
|
+
readonly outline?: boolean;
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
/** Result of printing a page to PDF. */
|
|
1460
|
+
export declare interface BrowserPDFResult {
|
|
1461
|
+
readonly bytes: Uint8Array;
|
|
1462
|
+
readonly path: string | undefined;
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
/**
|
|
1466
|
+
* Validate and compile Page.printToPDF parameters.
|
|
1467
|
+
*
|
|
1468
|
+
* @param options - Public PDF options
|
|
1469
|
+
* @returns Protocol parameter record
|
|
1470
|
+
*/
|
|
1471
|
+
export declare function browserPDFToParams(options?: BrowserPDFOptions): Readonly<Record<string, unknown>>;
|
|
1472
|
+
|
|
1473
|
+
/**
|
|
1474
|
+
* Performance-domain metrics and sampled JavaScript CPU profiles.
|
|
1475
|
+
*/
|
|
1476
|
+
export declare class BrowserPerformance implements BrowserPerformanceInterface {
|
|
1477
|
+
#private;
|
|
1478
|
+
constructor(frame: BrowserFrameInterface);
|
|
1479
|
+
get active(): boolean;
|
|
1480
|
+
metrics(): Promise<readonly BrowserMetric[]>;
|
|
1481
|
+
start(interval?: number): Promise<void>;
|
|
1482
|
+
stop(): Promise<BrowserProfile>;
|
|
1483
|
+
destroy(): Promise<void>;
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
/** Performance metrics and CPU profile lifecycle. */
|
|
1487
|
+
export declare interface BrowserPerformanceInterface {
|
|
1488
|
+
readonly active: boolean;
|
|
1489
|
+
metrics(): Promise<readonly BrowserMetric[]>;
|
|
1490
|
+
start(interval?: number): Promise<void>;
|
|
1491
|
+
stop(): Promise<BrowserProfile>;
|
|
1492
|
+
destroy(): Promise<void>;
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
/**
|
|
1496
|
+
* Permission overrides isolated to one browser context.
|
|
1497
|
+
*/
|
|
1498
|
+
export declare class BrowserPermissionManager implements BrowserPermissionManagerInterface {
|
|
1499
|
+
#private;
|
|
1500
|
+
constructor(client: CDPClientInterface, context?: string);
|
|
1501
|
+
grant(permissions: readonly string[], origin?: string): Promise<void>;
|
|
1502
|
+
deny(permissions: readonly string[], origin?: string): Promise<void>;
|
|
1503
|
+
clear(): Promise<void>;
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
/** Permission override operations scoped to one browser context. */
|
|
1507
|
+
export declare interface BrowserPermissionManagerInterface {
|
|
1508
|
+
grant(permissions: readonly string[], origin?: string): Promise<void>;
|
|
1509
|
+
deny(permissions: readonly string[], origin?: string): Promise<void>;
|
|
1510
|
+
clear(): Promise<void>;
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
/** Point in viewport CSS pixels. */
|
|
1514
|
+
export declare interface BrowserPoint {
|
|
1515
|
+
readonly x: number;
|
|
1516
|
+
readonly y: number;
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
/** Sampled CPU profile. */
|
|
1520
|
+
export declare interface BrowserProfile {
|
|
1521
|
+
readonly start: number;
|
|
1522
|
+
readonly end: number;
|
|
1523
|
+
readonly nodes: readonly BrowserProfileNode[];
|
|
1524
|
+
readonly samples: readonly number[];
|
|
1525
|
+
readonly deltas: readonly number[];
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
/** JavaScript call frame from a CPU profile. */
|
|
1529
|
+
export declare interface BrowserProfileFrame {
|
|
1530
|
+
readonly function: string;
|
|
1531
|
+
readonly script: string;
|
|
1532
|
+
readonly url: string;
|
|
1533
|
+
readonly line: number;
|
|
1534
|
+
readonly column: number;
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
/** One node in a sampled CPU profile. */
|
|
1538
|
+
export declare interface BrowserProfileNode {
|
|
1539
|
+
readonly id: number;
|
|
1540
|
+
readonly frame: BrowserProfileFrame;
|
|
1541
|
+
readonly hit: number | undefined;
|
|
1542
|
+
readonly children: readonly number[];
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
/** Proxy settings used when creating an isolated browser context. */
|
|
1546
|
+
export declare interface BrowserProxy {
|
|
1547
|
+
readonly server: string;
|
|
1548
|
+
readonly bypass?: readonly string[];
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
/** Decoded content quad and its actionable center. */
|
|
1552
|
+
export declare interface BrowserQuad {
|
|
1553
|
+
readonly points: readonly [number, number, number, number, number, number, number, number];
|
|
1554
|
+
readonly center: BrowserPoint;
|
|
1555
|
+
}
|
|
1556
|
+
|
|
1557
|
+
/** Serializable selector query, including optional ancestry and filtering. */
|
|
1558
|
+
export declare interface BrowserQuery {
|
|
1559
|
+
readonly selector: BrowserSelector;
|
|
1560
|
+
readonly value: string;
|
|
1561
|
+
readonly name?: string;
|
|
1562
|
+
readonly exact?: boolean;
|
|
1563
|
+
readonly parent?: BrowserQuery;
|
|
1564
|
+
readonly filter?: BrowserLocatorFilter;
|
|
1565
|
+
readonly index?: number;
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
/** A rectangle in CSS pixels: x, y, width, height. */
|
|
1569
|
+
export declare type BrowserRect = readonly [x: number, y: number, width: number, height: number];
|
|
1570
|
+
|
|
1571
|
+
/** One observed browser request. */
|
|
1572
|
+
export declare interface BrowserRequest {
|
|
1573
|
+
readonly id: string;
|
|
1574
|
+
readonly loader: string | undefined;
|
|
1575
|
+
readonly frame: string | undefined;
|
|
1576
|
+
readonly url: string;
|
|
1577
|
+
readonly method: string;
|
|
1578
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
1579
|
+
readonly post: string | undefined;
|
|
1580
|
+
readonly resource: string | undefined;
|
|
1581
|
+
readonly timestamp: number | undefined;
|
|
1582
|
+
readonly walltime: number | undefined;
|
|
1583
|
+
readonly redirect: BrowserResponse | undefined;
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
/** One failed browser request. */
|
|
1587
|
+
export declare interface BrowserRequestFailure {
|
|
1588
|
+
readonly id: string;
|
|
1589
|
+
readonly error: string;
|
|
1590
|
+
readonly cancelled: boolean;
|
|
1591
|
+
readonly blocked: string | undefined;
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
/** One observed browser response. */
|
|
1595
|
+
export declare interface BrowserResponse {
|
|
1596
|
+
readonly id: string;
|
|
1597
|
+
readonly loader: string;
|
|
1598
|
+
readonly frame: string | undefined;
|
|
1599
|
+
readonly url: string;
|
|
1600
|
+
readonly status: number;
|
|
1601
|
+
readonly phrase: string;
|
|
1602
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
1603
|
+
readonly mime: string;
|
|
1604
|
+
readonly protocol: string;
|
|
1605
|
+
readonly address: string | undefined;
|
|
1606
|
+
readonly port: number | undefined;
|
|
1607
|
+
readonly cached: boolean;
|
|
1608
|
+
readonly worker: boolean;
|
|
1609
|
+
readonly timestamp: number;
|
|
1610
|
+
readonly timing: BrowserTiming | undefined;
|
|
1611
|
+
readonly security: BrowserSecurity | undefined;
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
/**
|
|
1615
|
+
* An `evaluate()`/`content()` result exceeded {@link BROWSER_RESULT_LIMIT}
|
|
1616
|
+
* and was rejected in-page before it could overflow the CDP transport frame.
|
|
1617
|
+
*/
|
|
1618
|
+
export declare class BrowserResultLimitError extends BrowserError {
|
|
1619
|
+
constructor(message: string, context?: Readonly<Record<string, unknown>>);
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
/** Options for role-based locator creation. */
|
|
1623
|
+
export declare interface BrowserRoleOptions {
|
|
1624
|
+
readonly name?: string;
|
|
1625
|
+
readonly exact?: boolean;
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
/**
|
|
1629
|
+
* One paused request that can be aborted, continued, or fulfilled exactly once.
|
|
1630
|
+
*/
|
|
1631
|
+
export declare class BrowserRoute implements BrowserRouteInterface {
|
|
1632
|
+
#private;
|
|
1633
|
+
constructor(frame: BrowserFrameInterface, id: string, request: BrowserRequest);
|
|
1634
|
+
get id(): string;
|
|
1635
|
+
get request(): BrowserRequest;
|
|
1636
|
+
get handled(): boolean;
|
|
1637
|
+
abort(reason?: string): Promise<void>;
|
|
1638
|
+
continue(options?: BrowserRouteContinueOptions): Promise<void>;
|
|
1639
|
+
fulfill(options: BrowserRouteFulfillOptions): Promise<void>;
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
/** Overrides supplied when continuing an intercepted request. */
|
|
1643
|
+
export declare interface BrowserRouteContinueOptions {
|
|
1644
|
+
readonly url?: string;
|
|
1645
|
+
readonly method?: string;
|
|
1646
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
1647
|
+
readonly post?: string;
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
/** One installed network route. */
|
|
1651
|
+
export declare interface BrowserRouteDefinition {
|
|
1652
|
+
readonly query: BrowserRouteQuery;
|
|
1653
|
+
readonly handler: BrowserRouteHandler;
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
/** Synthetic response supplied when fulfilling an intercepted request. */
|
|
1657
|
+
export declare interface BrowserRouteFulfillOptions {
|
|
1658
|
+
readonly status?: number;
|
|
1659
|
+
readonly phrase?: string;
|
|
1660
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
1661
|
+
readonly body?: string | Uint8Array;
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
/** Function invoked for a matching intercepted request. */
|
|
1665
|
+
export declare type BrowserRouteHandler = (route: BrowserRouteInterface) => void | Promise<void>;
|
|
1666
|
+
|
|
1667
|
+
/** One paused Fetch-domain request. */
|
|
1668
|
+
export declare interface BrowserRouteInterface {
|
|
1669
|
+
readonly id: string;
|
|
1670
|
+
readonly request: BrowserRequest;
|
|
1671
|
+
readonly handled: boolean;
|
|
1672
|
+
abort(reason?: string): Promise<void>;
|
|
1673
|
+
continue(options?: BrowserRouteContinueOptions): Promise<void>;
|
|
1674
|
+
fulfill(options: BrowserRouteFulfillOptions): Promise<void>;
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
/** Route matching criteria. Omitted fields match all values. */
|
|
1678
|
+
export declare interface BrowserRouteQuery {
|
|
1679
|
+
readonly url?: string;
|
|
1680
|
+
readonly method?: string;
|
|
1681
|
+
readonly resource?: string;
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
/** Cookie same-site policy understood by Chromium. */
|
|
1685
|
+
export declare type BrowserSameSite = 'Strict' | 'Lax' | 'None';
|
|
1686
|
+
|
|
1687
|
+
/**
|
|
1688
|
+
* Options for taking a page screenshot.
|
|
1689
|
+
*
|
|
1690
|
+
* @remarks
|
|
1691
|
+
* - `path` — file path to persist the screenshot to, via the page's writer
|
|
1692
|
+
* - `full` — capture the full scrollable page (default `false`)
|
|
1693
|
+
* - `type` — image format (default `'png'`)
|
|
1694
|
+
* - `quality` — JPEG quality 0–100 (ignored for PNG)
|
|
1695
|
+
*/
|
|
1696
|
+
export declare interface BrowserScreenshotOptions {
|
|
1697
|
+
readonly path?: string;
|
|
1698
|
+
readonly full?: boolean;
|
|
1699
|
+
readonly type?: 'png' | 'jpeg';
|
|
1700
|
+
readonly quality?: number;
|
|
1701
|
+
readonly clip?: BrowserRect;
|
|
1702
|
+
readonly transparent?: boolean;
|
|
1703
|
+
readonly animations?: boolean;
|
|
1704
|
+
readonly caret?: boolean;
|
|
1705
|
+
readonly scale?: BrowserScreenshotScale;
|
|
1706
|
+
readonly mask?: readonly BrowserLocatorInterface[];
|
|
1707
|
+
readonly color?: string;
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
/**
|
|
1711
|
+
* Result of a page screenshot.
|
|
1712
|
+
*
|
|
1713
|
+
* @remarks
|
|
1714
|
+
* - `bytes` — raw image bytes
|
|
1715
|
+
* - `path` — file path if persisted via the page's writer, otherwise undefined
|
|
1716
|
+
*/
|
|
1717
|
+
export declare interface BrowserScreenshotResult {
|
|
1718
|
+
readonly bytes: Uint8Array;
|
|
1719
|
+
readonly path: string | undefined;
|
|
1720
|
+
}
|
|
1721
|
+
|
|
1722
|
+
/** Screenshot coordinate scale. */
|
|
1723
|
+
export declare type BrowserScreenshotScale = 'css' | 'device';
|
|
1724
|
+
|
|
1725
|
+
/**
|
|
1726
|
+
* Validate and compile basic Page.captureScreenshot parameters.
|
|
1727
|
+
*
|
|
1728
|
+
* @param options - Public screenshot options
|
|
1729
|
+
* @returns Protocol parameter record
|
|
1730
|
+
*/
|
|
1731
|
+
export declare function browserScreenshotToParams(options?: BrowserScreenshotOptions): Readonly<Record<string, unknown>>;
|
|
1732
|
+
|
|
1733
|
+
/** JavaScript script coverage. */
|
|
1734
|
+
export declare interface BrowserScriptCoverage {
|
|
1735
|
+
readonly id: string;
|
|
1736
|
+
readonly url: string;
|
|
1737
|
+
readonly functions: readonly BrowserFunctionCoverage[];
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
/** One installed new-document script and its optional host binding owner. */
|
|
1741
|
+
export declare interface BrowserScriptEntry {
|
|
1742
|
+
readonly source: string;
|
|
1743
|
+
readonly binding: string | undefined;
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1746
|
+
/**
|
|
1747
|
+
* New-document scripts and promise-based host functions for one page.
|
|
1748
|
+
*/
|
|
1749
|
+
export declare class BrowserScriptManager implements BrowserScriptManagerInterface {
|
|
1750
|
+
#private;
|
|
1751
|
+
constructor(frame: BrowserFrameInterface);
|
|
1752
|
+
add(source: string): Promise<string>;
|
|
1753
|
+
remove(id: string): Promise<void>;
|
|
1754
|
+
expose(name: string, handler: BrowserBindingHandler): Promise<void>;
|
|
1755
|
+
revoke(name: string): Promise<void>;
|
|
1756
|
+
destroy(): Promise<void>;
|
|
1757
|
+
}
|
|
1758
|
+
|
|
1759
|
+
/** Initialization scripts and host bindings for one page. */
|
|
1760
|
+
export declare interface BrowserScriptManagerInterface {
|
|
1761
|
+
add(source: string): Promise<string>;
|
|
1762
|
+
remove(id: string): Promise<void>;
|
|
1763
|
+
expose(name: string, handler: BrowserBindingHandler): Promise<void>;
|
|
1764
|
+
revoke(name: string): Promise<void>;
|
|
1765
|
+
destroy(): Promise<void>;
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
/** TLS details supplied with a browser response. */
|
|
1769
|
+
export declare interface BrowserSecurity {
|
|
1770
|
+
readonly protocol: string;
|
|
1771
|
+
readonly issuer: string;
|
|
1772
|
+
readonly from: number;
|
|
1773
|
+
readonly to: number;
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
/** Selector axis supported by {@link BrowserSelectorManagerInterface}. */
|
|
1777
|
+
export declare type BrowserSelector = 'css' | 'role' | 'text' | 'label' | 'placeholder' | 'test';
|
|
1778
|
+
|
|
1779
|
+
/**
|
|
1780
|
+
* A selector-based lookup or wait timed out without the element appearing.
|
|
1781
|
+
*/
|
|
1782
|
+
export declare class BrowserSelectorError extends BrowserError {
|
|
1783
|
+
constructor(message: string, context?: Readonly<Record<string, unknown>>);
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
/**
|
|
1787
|
+
* Semantic locator factory for one frame.
|
|
1788
|
+
*/
|
|
1789
|
+
export declare class BrowserSelectorManager implements BrowserSelectorManagerInterface {
|
|
1790
|
+
#private;
|
|
1791
|
+
constructor(frame: BrowserFrameInterface);
|
|
1792
|
+
css(value: string): BrowserLocatorInterface;
|
|
1793
|
+
role(value: string, options?: BrowserRoleOptions): BrowserLocatorInterface;
|
|
1794
|
+
text(value: string, options?: BrowserTextOptions): BrowserLocatorInterface;
|
|
1795
|
+
label(value: string, options?: BrowserTextOptions): BrowserLocatorInterface;
|
|
1796
|
+
placeholder(value: string, options?: BrowserTextOptions): BrowserLocatorInterface;
|
|
1797
|
+
test(value: string): BrowserLocatorInterface;
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
/**
|
|
1801
|
+
* Locator factory grouped by selector semantics.
|
|
1802
|
+
*/
|
|
1803
|
+
export declare interface BrowserSelectorManagerInterface {
|
|
1804
|
+
css(value: string): BrowserLocatorInterface;
|
|
1805
|
+
role(value: string, options?: BrowserRoleOptions): BrowserLocatorInterface;
|
|
1806
|
+
text(value: string, options?: BrowserTextOptions): BrowserLocatorInterface;
|
|
1807
|
+
label(value: string, options?: BrowserTextOptions): BrowserLocatorInterface;
|
|
1808
|
+
placeholder(value: string, options?: BrowserTextOptions): BrowserLocatorInterface;
|
|
1809
|
+
test(value: string): BrowserLocatorInterface;
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
/** Resolve the current CDP session for a frame id. */
|
|
1813
|
+
export declare type BrowserSessionFunction = (frame: string) => Promise<string>;
|
|
1814
|
+
|
|
1815
|
+
/** A flattened, serializable snapshot of every document attached to a page. */
|
|
1816
|
+
export declare interface BrowserSnapshot {
|
|
1817
|
+
readonly documents: readonly BrowserDocument[];
|
|
1818
|
+
readonly styles: readonly string[];
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1821
|
+
/**
|
|
1822
|
+
* Options for capturing a browser DOM snapshot.
|
|
1823
|
+
*
|
|
1824
|
+
* @remarks
|
|
1825
|
+
* - `styles` — computed CSS property names to capture
|
|
1826
|
+
* - `paint` — include global paint order
|
|
1827
|
+
* - `rects` — include offset, scroll, and client rectangles
|
|
1828
|
+
* - `limit` — maximum decoded node count
|
|
1829
|
+
*/
|
|
1830
|
+
export declare interface BrowserSnapshotOptions {
|
|
1831
|
+
readonly styles?: readonly string[];
|
|
1832
|
+
readonly paint?: boolean;
|
|
1833
|
+
readonly rects?: boolean;
|
|
1834
|
+
readonly limit?: number;
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1837
|
+
/** One browser-side stack frame. */
|
|
1838
|
+
export declare interface BrowserStackFrame {
|
|
1839
|
+
readonly url: string;
|
|
1840
|
+
readonly function: string;
|
|
1841
|
+
readonly line: number;
|
|
1842
|
+
readonly column: number;
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
/** One key/value pair from web storage. */
|
|
1846
|
+
export declare interface BrowserStorageEntry {
|
|
1847
|
+
readonly name: string;
|
|
1848
|
+
readonly value: string;
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
/**
|
|
1852
|
+
* Portable cookie and web-storage state for one browser context.
|
|
1853
|
+
*/
|
|
1854
|
+
export declare class BrowserStorageManager implements BrowserStorageManagerInterface {
|
|
1855
|
+
#private;
|
|
1856
|
+
constructor(cookies: BrowserCookieManagerInterface, pages: () => readonly BrowserPageInterface[]);
|
|
1857
|
+
state(options?: BrowserStorageOptions): Promise<BrowserStorageState>;
|
|
1858
|
+
restore(state: BrowserStorageState): Promise<void>;
|
|
1859
|
+
clear(origin?: string): Promise<void>;
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
/** Storage-state import, export, and clearing operations. */
|
|
1863
|
+
export declare interface BrowserStorageManagerInterface {
|
|
1864
|
+
state(options?: BrowserStorageOptions): Promise<BrowserStorageState>;
|
|
1865
|
+
restore(state: BrowserStorageState): Promise<void>;
|
|
1866
|
+
clear(origin?: string): Promise<void>;
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
/** Options for collecting storage state from selected origins. */
|
|
1870
|
+
export declare interface BrowserStorageOptions {
|
|
1871
|
+
readonly origins?: readonly string[];
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
/** Origin-scoped local and session storage snapshot. */
|
|
1875
|
+
export declare interface BrowserStorageOrigin {
|
|
1876
|
+
readonly origin: string;
|
|
1877
|
+
readonly local: readonly BrowserStorageEntry[];
|
|
1878
|
+
readonly session: readonly BrowserStorageEntry[];
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1881
|
+
/** Portable browser authentication and storage snapshot. */
|
|
1882
|
+
export declare interface BrowserStorageState {
|
|
1883
|
+
readonly cookies: readonly BrowserCookieInput[];
|
|
1884
|
+
readonly origins: readonly BrowserStorageOrigin[];
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
/** One decoded IO stream read. */
|
|
1888
|
+
export declare interface BrowserStreamChunk {
|
|
1889
|
+
readonly bytes: Uint8Array;
|
|
1890
|
+
readonly eof: boolean;
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
/** CSS stylesheet coverage. */
|
|
1894
|
+
export declare interface BrowserStyleCoverage {
|
|
1895
|
+
readonly id: string;
|
|
1896
|
+
readonly ranges: readonly BrowserCoverageRange[];
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
/** Options for text-like locator creation. */
|
|
1900
|
+
export declare interface BrowserTextOptions {
|
|
1901
|
+
readonly exact?: boolean;
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1904
|
+
/** Options for locator text extraction. */
|
|
1905
|
+
export declare interface BrowserTextResultOptions {
|
|
1906
|
+
readonly all?: boolean;
|
|
1907
|
+
}
|
|
1908
|
+
|
|
1909
|
+
/** Network timing values in milliseconds relative to request time. */
|
|
1910
|
+
export declare interface BrowserTiming {
|
|
1911
|
+
readonly request: number;
|
|
1912
|
+
readonly proxy: BrowserTimingRange | undefined;
|
|
1913
|
+
readonly dns: BrowserTimingRange | undefined;
|
|
1914
|
+
readonly connect: BrowserTimingRange | undefined;
|
|
1915
|
+
readonly ssl: BrowserTimingRange | undefined;
|
|
1916
|
+
readonly send: BrowserTimingRange | undefined;
|
|
1917
|
+
readonly receive: number | undefined;
|
|
1918
|
+
}
|
|
1919
|
+
|
|
1920
|
+
/** Start/end pair for one network timing phase. */
|
|
1921
|
+
export declare interface BrowserTimingRange {
|
|
1922
|
+
readonly start: number;
|
|
1923
|
+
readonly end: number;
|
|
1924
|
+
}
|
|
1925
|
+
|
|
1926
|
+
/**
|
|
1927
|
+
* Trusted touch input through Chromium's CDP Input domain.
|
|
1928
|
+
*/
|
|
1929
|
+
export declare class BrowserTouch implements BrowserTouchInterface {
|
|
1930
|
+
#private;
|
|
1931
|
+
constructor(frame: BrowserFrameInterface);
|
|
1932
|
+
tap(point: BrowserPoint): Promise<void>;
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1935
|
+
/** Touch input operations bound to one frame target session. */
|
|
1936
|
+
export declare interface BrowserTouchInterface {
|
|
1937
|
+
tap(point: BrowserPoint): Promise<void>;
|
|
1938
|
+
}
|
|
1939
|
+
|
|
1940
|
+
/**
|
|
1941
|
+
* Chromium trace capture streamed through the IO domain.
|
|
1942
|
+
*/
|
|
1943
|
+
export declare class BrowserTracing implements BrowserTracingInterface {
|
|
1944
|
+
#private;
|
|
1945
|
+
constructor(frame: BrowserFrameInterface, writer?: ScreenshotWriterInterface);
|
|
1946
|
+
get active(): boolean;
|
|
1947
|
+
start(options?: BrowserTracingOptions): Promise<void>;
|
|
1948
|
+
stop(): Promise<BrowserTracingResult>;
|
|
1949
|
+
destroy(): Promise<void>;
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1952
|
+
/** Trace capture lifecycle. */
|
|
1953
|
+
export declare interface BrowserTracingInterface {
|
|
1954
|
+
readonly active: boolean;
|
|
1955
|
+
start(options?: BrowserTracingOptions): Promise<void>;
|
|
1956
|
+
stop(): Promise<BrowserTracingResult>;
|
|
1957
|
+
destroy(): Promise<void>;
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
/** Chromium trace capture options. */
|
|
1961
|
+
export declare interface BrowserTracingOptions {
|
|
1962
|
+
readonly path?: string;
|
|
1963
|
+
readonly categories?: readonly string[];
|
|
1964
|
+
readonly screenshots?: boolean;
|
|
1965
|
+
readonly sampling?: boolean;
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
/** Trace capture result. */
|
|
1969
|
+
export declare interface BrowserTracingResult {
|
|
1970
|
+
readonly bytes: Uint8Array;
|
|
1971
|
+
readonly path: string | undefined;
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
/** Options for setting files on a file input. */
|
|
1975
|
+
export declare interface BrowserUploadOptions extends BrowserActionOptions {
|
|
1976
|
+
readonly files: readonly string[];
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
/** User-agent metadata accepted by Chromium emulation. */
|
|
1980
|
+
export declare interface BrowserUserAgent {
|
|
1981
|
+
readonly value: string;
|
|
1982
|
+
readonly language?: string;
|
|
1983
|
+
readonly platform?: string;
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
/** Viewport dimensions for a browser page. */
|
|
1987
|
+
export declare interface BrowserViewport {
|
|
1988
|
+
readonly width: number;
|
|
1989
|
+
readonly height: number;
|
|
1990
|
+
readonly scale?: number;
|
|
1991
|
+
readonly mobile?: boolean;
|
|
1992
|
+
readonly touch?: boolean;
|
|
1993
|
+
readonly landscape?: boolean;
|
|
1994
|
+
}
|
|
1995
|
+
|
|
1996
|
+
/**
|
|
1997
|
+
* Options for waiting on an element.
|
|
1998
|
+
*
|
|
1999
|
+
* @remarks
|
|
2000
|
+
* - `timeout` — maximum time to wait in milliseconds
|
|
2001
|
+
* - `strict` — require the selector to resolve to exactly one element
|
|
2002
|
+
* - `state` — target state (default `'attached'`)
|
|
2003
|
+
*/
|
|
2004
|
+
export declare interface BrowserWaitOptions extends BrowserActionOptions {
|
|
2005
|
+
readonly state?: BrowserWaitState;
|
|
2006
|
+
}
|
|
2007
|
+
|
|
2008
|
+
/** Element state a frame or page can wait for. */
|
|
2009
|
+
export declare type BrowserWaitState = 'attached' | 'detached' | 'visible' | 'hidden';
|
|
2010
|
+
|
|
2011
|
+
/** Page load condition for navigation — the CDP load event awaited by `navigate()`. */
|
|
2012
|
+
export declare type BrowserWaitUntil = 'commit' | 'load' | 'domcontentloaded';
|
|
2013
|
+
|
|
2014
|
+
/**
|
|
2015
|
+
* Observable WebSocket connection reconstructed from Network-domain events.
|
|
2016
|
+
*/
|
|
2017
|
+
export declare class BrowserWebSocket implements BrowserWebSocketInterface {
|
|
2018
|
+
#private;
|
|
2019
|
+
constructor(id: string, url: string);
|
|
2020
|
+
get emitter(): EmitterInterface<BrowserWebSocketEventMap>;
|
|
2021
|
+
get id(): string;
|
|
2022
|
+
get url(): string;
|
|
2023
|
+
receive(frame: BrowserWebSocketFrame): void;
|
|
2024
|
+
transmit(frame: BrowserWebSocketFrame): void;
|
|
2025
|
+
fail(message: string): void;
|
|
2026
|
+
close(timestamp: number): void;
|
|
2027
|
+
}
|
|
2028
|
+
|
|
2029
|
+
/** WebSocket lifecycle events. */
|
|
2030
|
+
export declare type BrowserWebSocketEventMap = {
|
|
2031
|
+
readonly receive: readonly [frame: BrowserWebSocketFrame];
|
|
2032
|
+
readonly transmit: readonly [frame: BrowserWebSocketFrame];
|
|
2033
|
+
readonly error: readonly [message: string];
|
|
2034
|
+
readonly close: readonly [timestamp: number];
|
|
2035
|
+
};
|
|
2036
|
+
|
|
2037
|
+
/** WebSocket frame payload. */
|
|
2038
|
+
export declare interface BrowserWebSocketFrame {
|
|
2039
|
+
readonly opcode: number;
|
|
2040
|
+
readonly data: string;
|
|
2041
|
+
readonly masked: boolean;
|
|
2042
|
+
readonly timestamp: number;
|
|
2043
|
+
}
|
|
2044
|
+
|
|
2045
|
+
/** One observed WebSocket connection. */
|
|
2046
|
+
export declare interface BrowserWebSocketInterface {
|
|
2047
|
+
readonly emitter: EmitterInterface<BrowserWebSocketEventMap>;
|
|
2048
|
+
readonly id: string;
|
|
2049
|
+
readonly url: string;
|
|
2050
|
+
receive(frame: BrowserWebSocketFrame): void;
|
|
2051
|
+
transmit(frame: BrowserWebSocketFrame): void;
|
|
2052
|
+
fail(message: string): void;
|
|
2053
|
+
close(timestamp: number): void;
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
/**
|
|
2057
|
+
* Dedicated, shared, or service worker attached through a flattened target session.
|
|
2058
|
+
*/
|
|
2059
|
+
export declare class BrowserWorker implements BrowserWorkerInterface {
|
|
2060
|
+
#private;
|
|
2061
|
+
constructor(client: CDPClientInterface, session: string, id: string, url: string, category: BrowserWorkerCategory);
|
|
2062
|
+
get id(): string;
|
|
2063
|
+
get url(): string;
|
|
2064
|
+
get category(): BrowserWorkerCategory;
|
|
2065
|
+
evaluate(expression: string, timeout?: number): Promise<unknown>;
|
|
2066
|
+
send(method: string, params?: Readonly<Record<string, unknown>>): Promise<unknown>;
|
|
2067
|
+
detach(): void;
|
|
2068
|
+
close(): Promise<void>;
|
|
2069
|
+
}
|
|
2070
|
+
|
|
2071
|
+
/** Worker target category. */
|
|
2072
|
+
export declare type BrowserWorkerCategory = 'worker' | 'service_worker' | 'shared_worker';
|
|
2073
|
+
|
|
2074
|
+
/** Script worker attached to a page target. */
|
|
2075
|
+
export declare interface BrowserWorkerInterface {
|
|
2076
|
+
readonly id: string;
|
|
2077
|
+
readonly url: string;
|
|
2078
|
+
readonly category: BrowserWorkerCategory;
|
|
2079
|
+
evaluate(expression: string, timeout?: number): Promise<unknown>;
|
|
2080
|
+
send(method: string, params?: Readonly<Record<string, unknown>>): Promise<unknown>;
|
|
2081
|
+
detach(): void;
|
|
2082
|
+
close(): Promise<void>;
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
/** Decode UTF-8 bytes as text. */
|
|
2086
|
+
export declare function bytesToText(value: Uint8Array): string;
|
|
2087
|
+
|
|
2088
|
+
/**
|
|
2089
|
+
* Lightweight Chrome DevTools Protocol client over a {@link CDPTransportInterface}.
|
|
2090
|
+
*
|
|
2091
|
+
* @remarks
|
|
2092
|
+
* Sends JSON-RPC messages over the injected transport and dispatches
|
|
2093
|
+
* responses and events. The transport owns the connection itself
|
|
2094
|
+
* (WebSocket, pipe, or any other duplex channel); this class owns only
|
|
2095
|
+
* the JSON-RPC framing and id/session correlation.
|
|
2096
|
+
*
|
|
2097
|
+
* Supports session-scoped event subscriptions: when a sessionId is
|
|
2098
|
+
* provided to subscribe/unsubscribe, the handler only fires for CDP
|
|
2099
|
+
* events carrying that sessionId. Global subscriptions (no sessionId)
|
|
2100
|
+
* continue to see ALL events for backwards compatibility.
|
|
2101
|
+
*/
|
|
2102
|
+
export declare class CDPClient implements CDPClientInterface {
|
|
2103
|
+
#private;
|
|
2104
|
+
constructor(options: CDPClientOptions);
|
|
2105
|
+
get connected(): boolean;
|
|
2106
|
+
connect(): Promise<void>;
|
|
2107
|
+
/**
|
|
2108
|
+
* Close the transport and re-establish a fresh connection.
|
|
2109
|
+
*
|
|
2110
|
+
* @remarks
|
|
2111
|
+
* Client-level subscriptions (`subscribe`/`unsubscribe` registrations)
|
|
2112
|
+
* survive `close()` and remain active after the reconnect — only pending
|
|
2113
|
+
* in-flight requests are rejected. This lets a caller reconnect a dropped
|
|
2114
|
+
* transport without re-registering every handler.
|
|
2115
|
+
*/
|
|
2116
|
+
reconnect(): Promise<void>;
|
|
2117
|
+
send(method: string, params?: Readonly<Record<string, unknown>>, sessionId?: string, timeout?: number): Promise<unknown>;
|
|
2118
|
+
subscribe(method: string, handler: CDPHandler, sessionId?: string): void;
|
|
2119
|
+
unsubscribe(method: string, handler: CDPHandler, sessionId?: string): void;
|
|
2120
|
+
/**
|
|
2121
|
+
* Close the transport and reject all pending requests.
|
|
2122
|
+
*
|
|
2123
|
+
* @remarks
|
|
2124
|
+
* Subscriptions registered via `subscribe()` are client-level
|
|
2125
|
+
* registrations, not connection-level state — they survive `close()`
|
|
2126
|
+
* (and a subsequent `reconnect()`/`connect()`) and keep firing once the
|
|
2127
|
+
* transport is active again. Only pending requests are rejected here.
|
|
2128
|
+
* If `close()` is called while `connect()` is still awaiting
|
|
2129
|
+
* `transport.start()`, the in-flight connect is rejected and the
|
|
2130
|
+
* transport is closed deterministically once `start()` resolves.
|
|
2131
|
+
*/
|
|
2132
|
+
close(): Promise<void>;
|
|
2133
|
+
}
|
|
2134
|
+
|
|
2135
|
+
/**
|
|
2136
|
+
* Lightweight Chrome DevTools Protocol client over a {@link CDPTransportInterface}.
|
|
2137
|
+
*
|
|
2138
|
+
* @remarks
|
|
2139
|
+
* - `connected` — true while the transport is active
|
|
2140
|
+
* - `connect` — start the transport and begin dispatching
|
|
2141
|
+
* - `reconnect` — close and re-establish the transport
|
|
2142
|
+
* - `send` — issue a CDP method call, optionally session-scoped, optionally
|
|
2143
|
+
* bounded by a per-call timeout that overrides the client-wide default for
|
|
2144
|
+
* this one request
|
|
2145
|
+
* - `subscribe` / `unsubscribe` — register/remove a handler for a CDP event,
|
|
2146
|
+
* optionally session-scoped
|
|
2147
|
+
* - `close` — tear down the transport and reject all pending requests
|
|
2148
|
+
*/
|
|
2149
|
+
export declare interface CDPClientInterface {
|
|
2150
|
+
readonly connected: boolean;
|
|
2151
|
+
connect(): Promise<void>;
|
|
2152
|
+
reconnect(): Promise<void>;
|
|
2153
|
+
send(method: string, params?: Readonly<Record<string, unknown>>, sessionId?: string, timeout?: number): Promise<unknown>;
|
|
2154
|
+
subscribe(method: string, handler: CDPHandler, sessionId?: string): void;
|
|
2155
|
+
unsubscribe(method: string, handler: CDPHandler, sessionId?: string): void;
|
|
2156
|
+
close(): Promise<void>;
|
|
2157
|
+
}
|
|
2158
|
+
|
|
2159
|
+
/**
|
|
2160
|
+
* Options for creating a CDPClient.
|
|
2161
|
+
*
|
|
2162
|
+
* @remarks
|
|
2163
|
+
* - `transport` — the text pipe the client sends/receives JSON-RPC frames over
|
|
2164
|
+
* - `timeout` — ms before a pending request or connection attempt fails (default from constants)
|
|
2165
|
+
*/
|
|
2166
|
+
export declare interface CDPClientOptions {
|
|
2167
|
+
readonly transport: CDPTransportInterface;
|
|
2168
|
+
readonly timeout?: number;
|
|
2169
|
+
}
|
|
2170
|
+
|
|
2171
|
+
/**
|
|
2172
|
+
* A CDP request could not be sent or completed because the client was not in
|
|
2173
|
+
* a connectable state (not connected, closed while connecting, or the
|
|
2174
|
+
* connection dropped mid-request).
|
|
2175
|
+
*/
|
|
2176
|
+
export declare class CDPConnectionError extends BrowserError {
|
|
2177
|
+
constructor(message: string, context?: Readonly<Record<string, unknown>>);
|
|
2178
|
+
}
|
|
2179
|
+
|
|
2180
|
+
/**
|
|
2181
|
+
* A CDP request received an error response from the remote endpoint.
|
|
2182
|
+
*
|
|
2183
|
+
* @remarks
|
|
2184
|
+
* Carries the originating `method` plus the CDP error's own `code`,
|
|
2185
|
+
* `message`, and `data` (when present) in `context`, so callers can branch
|
|
2186
|
+
* on the protocol-level error instead of parsing the message string.
|
|
2187
|
+
*/
|
|
2188
|
+
export declare class CDPError extends BrowserError {
|
|
2189
|
+
constructor(message: string, context?: Readonly<Record<string, unknown>>);
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
/** Handler invoked for a subscribed CDP event with its params record. */
|
|
2193
|
+
export declare type CDPHandler = (params: Readonly<Record<string, unknown>>) => void;
|
|
2194
|
+
|
|
2195
|
+
/** One entry of the CDP `Target.getTargets` result. */
|
|
2196
|
+
export declare interface CDPTarget {
|
|
2197
|
+
readonly id: string;
|
|
2198
|
+
readonly type: string;
|
|
2199
|
+
readonly title: string;
|
|
2200
|
+
readonly url: string;
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2203
|
+
/**
|
|
2204
|
+
* A pending CDP request was not answered within its timeout window.
|
|
2205
|
+
*/
|
|
2206
|
+
export declare class CDPTimeoutError extends BrowserError {
|
|
2207
|
+
constructor(message: string, context?: Readonly<Record<string, unknown>>);
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2210
|
+
/**
|
|
2211
|
+
* Event map for a {@link CDPTransportInterface} — the raw text pipe a
|
|
2212
|
+
* {@link CDPClientInterface} sends and receives JSON-RPC frames over.
|
|
2213
|
+
*
|
|
2214
|
+
* @remarks
|
|
2215
|
+
* `message` carries one raw text frame; `close` signals the underlying
|
|
2216
|
+
* connection ended; `error` carries a transport-level fault (unknown shape —
|
|
2217
|
+
* narrow before use).
|
|
2218
|
+
*/
|
|
2219
|
+
export declare type CDPTransportEventMap = {
|
|
2220
|
+
readonly message: readonly [data: string];
|
|
2221
|
+
readonly close: readonly [];
|
|
2222
|
+
readonly error: readonly [error: unknown];
|
|
2223
|
+
};
|
|
2224
|
+
|
|
2225
|
+
/**
|
|
2226
|
+
* A dumb text transport CDPClient sends and receives JSON-RPC frames over.
|
|
2227
|
+
*
|
|
2228
|
+
* @remarks
|
|
2229
|
+
* The transport owns the connection (WebSocket, pipe, or any other duplex
|
|
2230
|
+
* channel) and the endpoint URL; it does no JSON framing of its own — that
|
|
2231
|
+
* stays in {@link CDPClientInterface}. Environment-specific transports
|
|
2232
|
+
* (a Node `WebSocket`, a browser `WebSocket`) live outside core and satisfy
|
|
2233
|
+
* this contract.
|
|
2234
|
+
*/
|
|
2235
|
+
export declare interface CDPTransportInterface {
|
|
2236
|
+
readonly emitter: EmitterInterface<CDPTransportEventMap>;
|
|
2237
|
+
start(): Promise<void>;
|
|
2238
|
+
send(data: string): Promise<void>;
|
|
2239
|
+
close(): Promise<void>;
|
|
2240
|
+
}
|
|
2241
|
+
|
|
2242
|
+
/**
|
|
2243
|
+
* Return direct children of a captured browser node.
|
|
2244
|
+
*
|
|
2245
|
+
* @remarks
|
|
2246
|
+
* Includes the root nodes of an iframe's linked content document. Shadow DOM
|
|
2247
|
+
* and template content already carry flattened parent indexes from CDP.
|
|
2248
|
+
*
|
|
2249
|
+
* @param snapshot - Captured browser snapshot
|
|
2250
|
+
* @param node - Parent node
|
|
2251
|
+
* @returns Direct children in snapshot order
|
|
2252
|
+
*/
|
|
2253
|
+
export declare function childrenOfBrowserNode(snapshot: BrowserSnapshot, node: BrowserNode): readonly BrowserNode[];
|
|
2254
|
+
|
|
2255
|
+
/**
|
|
2256
|
+
* Find the nearest matching node from the candidate through its ancestors.
|
|
2257
|
+
*
|
|
2258
|
+
* @param snapshot - Captured browser snapshot
|
|
2259
|
+
* @param node - Starting node, included in the search
|
|
2260
|
+
* @param predicate - Node predicate
|
|
2261
|
+
* @returns Closest matching node, or undefined
|
|
2262
|
+
*/
|
|
2263
|
+
export declare function closestBrowserNode(snapshot: BrowserSnapshot, node: BrowserNode, predicate: BrowserNodePredicate): BrowserNode | undefined;
|
|
2264
|
+
|
|
2265
|
+
/**
|
|
2266
|
+
* Resolve the nearest common ancestor of two captured browser nodes.
|
|
2267
|
+
*
|
|
2268
|
+
* @param snapshot - Captured browser snapshot
|
|
2269
|
+
* @param first - First node
|
|
2270
|
+
* @param second - Second node
|
|
2271
|
+
* @returns Common ancestor, or undefined
|
|
2272
|
+
*/
|
|
2273
|
+
export declare function commonAncestorOfBrowserNodes(snapshot: BrowserSnapshot, first: BrowserNode, second: BrowserNode): BrowserNode | undefined;
|
|
2274
|
+
|
|
2275
|
+
/**
|
|
2276
|
+
* Compile the element-side actionability pass used before trusted input.
|
|
2277
|
+
*
|
|
2278
|
+
* @param options - Checks required for the action
|
|
2279
|
+
* @returns Async `Runtime.callFunctionOn` function declaration
|
|
2280
|
+
*/
|
|
2281
|
+
export declare function compileActionabilityFunction(options: BrowserActionabilityOptions): string;
|
|
2282
|
+
|
|
2283
|
+
/**
|
|
2284
|
+
* Compile an attached-state locator wait.
|
|
2285
|
+
*/
|
|
2286
|
+
export declare function compileAttachedLocatorWaitExpression(query: BrowserQuery, strict: boolean, timeout: number): string;
|
|
2287
|
+
|
|
2288
|
+
/**
|
|
2289
|
+
* Compile an in-page wait for an attached selector.
|
|
2290
|
+
*
|
|
2291
|
+
* @param selector - CSS selector
|
|
2292
|
+
* @param strict - Whether more than one match is an error
|
|
2293
|
+
* @param timeout - Maximum wait in milliseconds
|
|
2294
|
+
* @returns Runtime expression resolving to whether the state was reached
|
|
2295
|
+
*/
|
|
2296
|
+
export declare function compileAttachedWaitExpression(selector: string, strict: boolean, timeout: number): string;
|
|
2297
|
+
|
|
2298
|
+
/**
|
|
2299
|
+
* Compile current-document cleanup for one page-side host binding facade.
|
|
2300
|
+
*
|
|
2301
|
+
* @param name - Binding identifier
|
|
2302
|
+
* @returns Runtime cleanup expression
|
|
2303
|
+
*/
|
|
2304
|
+
export declare function compileBrowserBindingCleanup(name: string): string;
|
|
2305
|
+
|
|
2306
|
+
/**
|
|
2307
|
+
* Compile delivery of a host binding result to one execution context.
|
|
2308
|
+
*
|
|
2309
|
+
* @param name - Binding identifier
|
|
2310
|
+
* @param id - Call identifier
|
|
2311
|
+
* @param success - Resolve rather than reject
|
|
2312
|
+
* @param value - Serializable result or error
|
|
2313
|
+
* @returns Runtime expression
|
|
2314
|
+
*/
|
|
2315
|
+
export declare function compileBrowserBindingResult(name: string, id: string, success: boolean, value: unknown): string;
|
|
2316
|
+
|
|
2317
|
+
/**
|
|
2318
|
+
* Compile the page-side promise facade for one Runtime binding.
|
|
2319
|
+
*
|
|
2320
|
+
* @param name - Binding identifier
|
|
2321
|
+
* @returns Self-installing script source
|
|
2322
|
+
*/
|
|
2323
|
+
export declare function compileBrowserBindingSource(name: string): string;
|
|
2324
|
+
|
|
2325
|
+
/**
|
|
2326
|
+
* Compile a strict, visibility-checked click expression.
|
|
2327
|
+
*
|
|
2328
|
+
* @param selector - CSS selector
|
|
2329
|
+
* @param strict - Whether more than one match is an error
|
|
2330
|
+
* @returns Runtime expression
|
|
2331
|
+
*/
|
|
2332
|
+
export declare function compileClickExpression(selector: string, strict: boolean): string;
|
|
2333
|
+
|
|
2334
|
+
/**
|
|
2335
|
+
* Compile recorded codegen actions into a replayable script.
|
|
2336
|
+
*
|
|
2337
|
+
* @remarks
|
|
2338
|
+
* Emits one statement per action against a `page` object shaped like
|
|
2339
|
+
* {@link BrowserPageInterface} (`page.navigate(...)`, `page.click(...)`, …).
|
|
2340
|
+
* Both target languages emit an `async function run(page)` body whose
|
|
2341
|
+
* statements are `await`-ed; `language` only toggles whether the `page`
|
|
2342
|
+
* parameter carries a TypeScript type annotation (default `'javascript'`).
|
|
2343
|
+
*
|
|
2344
|
+
* @param actions - Normalized actions to compile
|
|
2345
|
+
* @param options - Compilation options (target language)
|
|
2346
|
+
* @returns The compiled script source
|
|
2347
|
+
*/
|
|
2348
|
+
export declare function compileCodegenScript(actions: readonly BrowserCodegenAction[], options?: BrowserCodegenScriptOptions): string;
|
|
2349
|
+
|
|
2350
|
+
/**
|
|
2351
|
+
* Compile a detached-state locator wait.
|
|
2352
|
+
*/
|
|
2353
|
+
export declare function compileDetachedLocatorWaitExpression(query: BrowserQuery, strict: boolean, timeout: number): string;
|
|
2354
|
+
|
|
2355
|
+
/**
|
|
2356
|
+
* Compile an in-page wait for a detached selector.
|
|
2357
|
+
*
|
|
2358
|
+
* @param selector - CSS selector
|
|
2359
|
+
* @param strict - Whether more than one match is an error
|
|
2360
|
+
* @param timeout - Maximum wait in milliseconds
|
|
2361
|
+
* @returns Runtime expression resolving to whether the state was reached
|
|
2362
|
+
*/
|
|
2363
|
+
export declare function compileDetachedWaitExpression(selector: string, strict: boolean, timeout: number): string;
|
|
2364
|
+
|
|
2365
|
+
/**
|
|
2366
|
+
* Compile a strict, editable fill expression.
|
|
2367
|
+
*
|
|
2368
|
+
* @param selector - CSS selector
|
|
2369
|
+
* @param value - Value to assign
|
|
2370
|
+
* @param strict - Whether more than one match is an error
|
|
2371
|
+
* @returns Runtime expression
|
|
2372
|
+
*/
|
|
2373
|
+
export declare function compileFillExpression(selector: string, value: string, strict: boolean): string;
|
|
2374
|
+
|
|
2375
|
+
/**
|
|
2376
|
+
* Compile an auto-retrying in-page predicate wait.
|
|
2377
|
+
*
|
|
2378
|
+
* @param expression - Value or function expression
|
|
2379
|
+
* @param timeout - Maximum wait in milliseconds
|
|
2380
|
+
* @returns Promise expression resolving to the first truthy value or false
|
|
2381
|
+
*/
|
|
2382
|
+
export declare function compileFunctionWaitExpression(expression: string, timeout: number): string;
|
|
2383
|
+
|
|
2384
|
+
/**
|
|
2385
|
+
* Compile a hidden-state locator wait.
|
|
2386
|
+
*/
|
|
2387
|
+
export declare function compileHiddenLocatorWaitExpression(query: BrowserQuery, strict: boolean, timeout: number): string;
|
|
2388
|
+
|
|
2389
|
+
/**
|
|
2390
|
+
* Compile an in-page wait for a hidden selector.
|
|
2391
|
+
*
|
|
2392
|
+
* @param selector - CSS selector
|
|
2393
|
+
* @param strict - Whether more than one match is an error
|
|
2394
|
+
* @param timeout - Maximum wait in milliseconds
|
|
2395
|
+
* @returns Runtime expression resolving to whether the state was reached
|
|
2396
|
+
*/
|
|
2397
|
+
export declare function compileHiddenWaitExpression(selector: string, strict: boolean, timeout: number): string;
|
|
2398
|
+
|
|
2399
|
+
/**
|
|
2400
|
+
* Compile a deep locator query returning its first match.
|
|
2401
|
+
*
|
|
2402
|
+
* @param query - Serializable locator query
|
|
2403
|
+
* @returns Runtime expression returning one element or undefined
|
|
2404
|
+
*/
|
|
2405
|
+
export declare function compileLocatorExpression(query: BrowserQuery): string;
|
|
2406
|
+
|
|
2407
|
+
/**
|
|
2408
|
+
* Compile a deep, shadow-aware locator query returning every match.
|
|
2409
|
+
*
|
|
2410
|
+
* @param query - Serializable locator query
|
|
2411
|
+
* @returns Runtime expression returning an element array
|
|
2412
|
+
*/
|
|
2413
|
+
export declare function compileLocatorListExpression(query: BrowserQuery): string;
|
|
2414
|
+
|
|
2415
|
+
/**
|
|
2416
|
+
* Compile cleanup for temporary screenshot styles and masks.
|
|
2417
|
+
*
|
|
2418
|
+
* @param token - Preparation token
|
|
2419
|
+
* @returns Cleanup expression
|
|
2420
|
+
*/
|
|
2421
|
+
export declare function compileScreenshotCleanupExpression(token: string): string;
|
|
2422
|
+
|
|
2423
|
+
/**
|
|
2424
|
+
* Compile temporary animation, caret, and mask setup for a screenshot.
|
|
2425
|
+
*
|
|
2426
|
+
* @param options - Screenshot controls
|
|
2427
|
+
* @returns Setup expression or undefined when no preparation is required
|
|
2428
|
+
*/
|
|
2429
|
+
export declare function compileScreenshotPreparationExpression(options?: BrowserScreenshotOptions): string | undefined;
|
|
2430
|
+
|
|
2431
|
+
/**
|
|
2432
|
+
* Compile a strict select expression.
|
|
2433
|
+
*
|
|
2434
|
+
* @param selector - CSS selector
|
|
2435
|
+
* @param values - Option values to select
|
|
2436
|
+
* @param strict - Whether more than one match is an error
|
|
2437
|
+
* @returns Runtime expression
|
|
2438
|
+
*/
|
|
2439
|
+
export declare function compileSelectExpression(selector: string, values: readonly string[], strict: boolean): string;
|
|
2440
|
+
|
|
2441
|
+
/**
|
|
2442
|
+
* Compile an expression that clears local and session storage.
|
|
2443
|
+
*
|
|
2444
|
+
* @returns In-page clear expression
|
|
2445
|
+
*/
|
|
2446
|
+
export declare function compileStorageClearExpression(): string;
|
|
2447
|
+
|
|
2448
|
+
/**
|
|
2449
|
+
* Compile an expression that serializes local and session storage.
|
|
2450
|
+
*
|
|
2451
|
+
* @returns In-page storage expression
|
|
2452
|
+
*/
|
|
2453
|
+
export declare function compileStorageReadExpression(): string;
|
|
2454
|
+
|
|
2455
|
+
/**
|
|
2456
|
+
* Compile an expression that restores one origin's web storage.
|
|
2457
|
+
*
|
|
2458
|
+
* @param origin - Storage values to restore
|
|
2459
|
+
* @returns In-page restore expression
|
|
2460
|
+
*/
|
|
2461
|
+
export declare function compileStorageRestoreExpression(origin: BrowserStorageOrigin): string;
|
|
2462
|
+
|
|
2463
|
+
/**
|
|
2464
|
+
* Compile a visible-state locator wait.
|
|
2465
|
+
*/
|
|
2466
|
+
export declare function compileVisibleLocatorWaitExpression(query: BrowserQuery, strict: boolean, timeout: number): string;
|
|
2467
|
+
|
|
2468
|
+
/**
|
|
2469
|
+
* Compile an in-page wait for a visible selector.
|
|
2470
|
+
*
|
|
2471
|
+
* @param selector - CSS selector
|
|
2472
|
+
* @param strict - Whether more than one match is an error
|
|
2473
|
+
* @param timeout - Maximum wait in milliseconds
|
|
2474
|
+
* @returns Runtime expression resolving to whether the state was reached
|
|
2475
|
+
*/
|
|
2476
|
+
export declare function compileVisibleWaitExpression(selector: string, strict: boolean, timeout: number): string;
|
|
2477
|
+
|
|
2478
|
+
/**
|
|
2479
|
+
* Compute the CDP Input pressed-button bitmask.
|
|
2480
|
+
*
|
|
2481
|
+
* @param buttons - Currently pressed public mouse buttons
|
|
2482
|
+
* @returns Combined CDP pressed-button mask
|
|
2483
|
+
*/
|
|
2484
|
+
export declare function computeBrowserButtons(buttons: readonly BrowserMouseButton[]): number;
|
|
2485
|
+
|
|
2486
|
+
/**
|
|
2487
|
+
* Compute the CDP Input modifier bitmask.
|
|
2488
|
+
*
|
|
2489
|
+
* @param modifiers - Canonical modifier names
|
|
2490
|
+
* @returns Combined CDP modifier mask
|
|
2491
|
+
*/
|
|
2492
|
+
export declare function computeBrowserModifiers(modifiers: readonly string[]): number;
|
|
2493
|
+
|
|
2494
|
+
/**
|
|
2495
|
+
* Compute the edge count between two captured browser nodes.
|
|
2496
|
+
*
|
|
2497
|
+
* @param snapshot - Captured browser snapshot
|
|
2498
|
+
* @param first - First node
|
|
2499
|
+
* @param second - Second node
|
|
2500
|
+
* @returns Tree distance, or undefined when no common ancestor exists
|
|
2501
|
+
*/
|
|
2502
|
+
export declare function computeBrowserNodeDistance(snapshot: BrowserSnapshot, first: BrowserNode, second: BrowserNode): number | undefined;
|
|
2503
|
+
|
|
2504
|
+
/**
|
|
2505
|
+
* Concatenate byte chunks without Node-specific buffers.
|
|
2506
|
+
*
|
|
2507
|
+
* @param chunks - Byte arrays in source order
|
|
2508
|
+
* @returns Combined bytes
|
|
2509
|
+
*/
|
|
2510
|
+
export declare function concatBytes(chunks: readonly Uint8Array[]): Uint8Array;
|
|
2511
|
+
|
|
2512
|
+
/**
|
|
2513
|
+
* Convert a typed cookie input into Chromium protocol fields.
|
|
2514
|
+
*
|
|
2515
|
+
* @param cookie - Validated public cookie input
|
|
2516
|
+
* @returns Protocol cookie record
|
|
2517
|
+
*/
|
|
2518
|
+
export declare function cookieToProtocol(cookie: BrowserCookieInput): Readonly<Record<string, unknown>>;
|
|
2519
|
+
|
|
2520
|
+
/**
|
|
2521
|
+
* Build a standards-shaped HAR 1.2 entry from one observed exchange.
|
|
2522
|
+
*
|
|
2523
|
+
* @param pending - Request and optional response captured by the recorder
|
|
2524
|
+
* @param duration - Whole exchange duration in milliseconds
|
|
2525
|
+
* @param body - Optional decoded response body
|
|
2526
|
+
* @param error - Optional request failure description
|
|
2527
|
+
* @returns HAR 1.2 entry
|
|
2528
|
+
*/
|
|
2529
|
+
export declare function createBrowserHAREntry(pending: BrowserHARPending, duration: number, body?: Uint8Array, error?: string): BrowserHAREntry;
|
|
2530
|
+
|
|
2531
|
+
/**
|
|
2532
|
+
* Create a CDP client bound to the given transport.
|
|
2533
|
+
*
|
|
2534
|
+
* @param options - The transport (and optional timeout) the client uses
|
|
2535
|
+
* @returns A {@link CDPClientInterface}
|
|
2536
|
+
*
|
|
2537
|
+
* @example
|
|
2538
|
+
* ```ts
|
|
2539
|
+
* import { createCDPClient } from '@src/core'
|
|
2540
|
+
*
|
|
2541
|
+
* const client = createCDPClient({ transport })
|
|
2542
|
+
* await client.connect()
|
|
2543
|
+
* ```
|
|
2544
|
+
*/
|
|
2545
|
+
export declare function createCDPClient(options: CDPClientOptions): CDPClientInterface;
|
|
2546
|
+
|
|
2547
|
+
/**
|
|
2548
|
+
* Decode a base64-encoded string into raw bytes.
|
|
2549
|
+
*
|
|
2550
|
+
* @remarks
|
|
2551
|
+
* Pure JS implementation — no `Buffer`, no `atob` (DOM-only) — so it runs
|
|
2552
|
+
* identically in Node and browser environments. Whitespace and `=` padding
|
|
2553
|
+
* are ignored; invalid characters are skipped.
|
|
2554
|
+
*
|
|
2555
|
+
* @param text - Base64-encoded input string
|
|
2556
|
+
* @returns Decoded bytes
|
|
2557
|
+
*
|
|
2558
|
+
* @example
|
|
2559
|
+
* ```ts
|
|
2560
|
+
* decodeBase64('aGVsbG8=') // Uint8Array [104, 101, 108, 108, 111]
|
|
2561
|
+
* ```
|
|
2562
|
+
*/
|
|
2563
|
+
export declare function decodeBase64(text: string): Uint8Array;
|
|
2564
|
+
|
|
2565
|
+
/**
|
|
2566
|
+
* Decode flattened CDP node attributes.
|
|
2567
|
+
*
|
|
2568
|
+
* @param value - Candidate string-index array
|
|
2569
|
+
* @param strings - Snapshot string table
|
|
2570
|
+
* @returns Frozen attribute record
|
|
2571
|
+
*/
|
|
2572
|
+
export declare function decodeBrowserAttributes(value: unknown, strings: readonly string[]): Readonly<Record<string, string>>;
|
|
2573
|
+
|
|
2574
|
+
/**
|
|
2575
|
+
* Decode a CDP `DOMSnapshot.captureSnapshot` result.
|
|
2576
|
+
*
|
|
2577
|
+
* @param value - Unknown CDP result
|
|
2578
|
+
* @param styles - Requested computed-style names, in protocol order
|
|
2579
|
+
* @param limit - Maximum accepted node count
|
|
2580
|
+
* @returns A typed serializable browser snapshot
|
|
2581
|
+
*/
|
|
2582
|
+
export declare function decodeBrowserSnapshot(value: unknown, styles?: readonly string[], limit?: number): BrowserSnapshot;
|
|
2583
|
+
|
|
2584
|
+
/**
|
|
2585
|
+
* Decode CDP snapshot sparse boolean data.
|
|
2586
|
+
*
|
|
2587
|
+
* @param value - Sparse `{ index }` record
|
|
2588
|
+
* @returns Set of node indexes whose value is true
|
|
2589
|
+
*/
|
|
2590
|
+
export declare function decodeRareBooleanData(value: unknown): ReadonlySet<number>;
|
|
2591
|
+
|
|
2592
|
+
/**
|
|
2593
|
+
* Decode CDP snapshot sparse integer data.
|
|
2594
|
+
*
|
|
2595
|
+
* @param value - Sparse `{ index, value }` record
|
|
2596
|
+
* @returns Node-index to integer map
|
|
2597
|
+
*/
|
|
2598
|
+
export declare function decodeRareIntegerData(value: unknown): ReadonlyMap<number, number>;
|
|
2599
|
+
|
|
2600
|
+
/**
|
|
2601
|
+
* Decode CDP snapshot sparse string data.
|
|
2602
|
+
*
|
|
2603
|
+
* @param value - Sparse `{ index, value }` record
|
|
2604
|
+
* @param strings - Snapshot string table
|
|
2605
|
+
* @returns Node-index to string map
|
|
2606
|
+
*/
|
|
2607
|
+
export declare function decodeRareStringData(value: unknown, strings: readonly string[]): ReadonlyMap<number, string>;
|
|
2608
|
+
|
|
2609
|
+
/**
|
|
2610
|
+
* Lazily walk descendants of one captured node, excluding the node itself.
|
|
2611
|
+
*
|
|
2612
|
+
* @param snapshot - Captured browser snapshot
|
|
2613
|
+
* @param root - Root whose descendants are required
|
|
2614
|
+
* @returns A lazy descendant generator
|
|
2615
|
+
*/
|
|
2616
|
+
export declare function descendantsOfBrowserNode(snapshot: BrowserSnapshot, root: BrowserNode): Generator<BrowserNode, void, unknown>;
|
|
2617
|
+
|
|
2618
|
+
/**
|
|
2619
|
+
* Resolve the document containing a browser node.
|
|
2620
|
+
*
|
|
2621
|
+
* @param snapshot - Captured browser snapshot
|
|
2622
|
+
* @param node - Node whose document is required
|
|
2623
|
+
* @returns The containing document, or undefined
|
|
2624
|
+
*/
|
|
2625
|
+
export declare function documentOfBrowserNode(snapshot: BrowserSnapshot, node: BrowserNode): BrowserDocument | undefined;
|
|
2626
|
+
|
|
2627
|
+
/**
|
|
2628
|
+
* Encode raw bytes as base64 without relying on Node or DOM globals.
|
|
2629
|
+
*
|
|
2630
|
+
* @param bytes - Raw input bytes
|
|
2631
|
+
* @returns Base64 text
|
|
2632
|
+
*/
|
|
2633
|
+
export declare function encodeBase64(bytes: Uint8Array): string;
|
|
2634
|
+
|
|
2635
|
+
/**
|
|
2636
|
+
* Find the first matching descendant beneath one captured node.
|
|
2637
|
+
*
|
|
2638
|
+
* @param snapshot - Captured browser snapshot
|
|
2639
|
+
* @param root - Root whose descendants are searched
|
|
2640
|
+
* @param predicate - Node predicate
|
|
2641
|
+
* @returns First matching descendant, or undefined
|
|
2642
|
+
*/
|
|
2643
|
+
export declare function findBrowserDescendant(snapshot: BrowserSnapshot, root: BrowserNode, predicate: BrowserNodePredicate): BrowserNode | undefined;
|
|
2644
|
+
|
|
2645
|
+
/**
|
|
2646
|
+
* Find the first captured node satisfying a predicate.
|
|
2647
|
+
*
|
|
2648
|
+
* @param snapshot - Captured browser snapshot
|
|
2649
|
+
* @param predicate - Node predicate
|
|
2650
|
+
* @returns First matching node, or undefined
|
|
2651
|
+
*/
|
|
2652
|
+
export declare function findBrowserNode(snapshot: BrowserSnapshot, predicate: BrowserNodePredicate): BrowserNode | undefined;
|
|
2653
|
+
|
|
2654
|
+
/**
|
|
2655
|
+
* Find captured nodes satisfying a predicate.
|
|
2656
|
+
*
|
|
2657
|
+
* @param snapshot - Captured browser snapshot
|
|
2658
|
+
* @param predicate - Node predicate
|
|
2659
|
+
* @param limit - Optional maximum result count
|
|
2660
|
+
* @returns Matching nodes in snapshot order
|
|
2661
|
+
*/
|
|
2662
|
+
export declare function findBrowserNodes(snapshot: BrowserSnapshot, predicate: BrowserNodePredicate, limit?: number): readonly BrowserNode[];
|
|
2663
|
+
|
|
2664
|
+
/**
|
|
2665
|
+
* Return structural siblings after the supplied browser node.
|
|
2666
|
+
*
|
|
2667
|
+
* @param snapshot - Captured browser snapshot
|
|
2668
|
+
* @param node - Reference node
|
|
2669
|
+
* @returns Later siblings in structural order
|
|
2670
|
+
*/
|
|
2671
|
+
export declare function followingSiblingsOfBrowserNode(snapshot: BrowserSnapshot, node: BrowserNode): readonly BrowserNode[];
|
|
2672
|
+
|
|
2673
|
+
/**
|
|
2674
|
+
* Wrap a `Runtime.evaluate` expression so the IN-PAGE code stringifies its
|
|
2675
|
+
* own result and throws a recognizable error before an oversized result
|
|
2676
|
+
* would overflow the CDP transport frame.
|
|
2677
|
+
*
|
|
2678
|
+
* @remarks
|
|
2679
|
+
* A result whose `JSON.stringify` length exceeds `limit` throws
|
|
2680
|
+
* `Error('BROWSER_RESULT_LIMIT: <length>')` inside the page instead of being
|
|
2681
|
+
* returned — the caller maps that sentinel to a coded
|
|
2682
|
+
* {@link BrowserResultLimitError}. A non-serializable result (`undefined`,
|
|
2683
|
+
* a function, a symbol) makes `JSON.stringify` return `undefined`, so the
|
|
2684
|
+
* length check is skipped and today's undefined-passthrough behavior is
|
|
2685
|
+
* unchanged.
|
|
2686
|
+
*
|
|
2687
|
+
* The expression is placed on its own line inside the wrapper (rather than
|
|
2688
|
+
* inline with the guard code) so a trailing `//` line comment in the
|
|
2689
|
+
* expression cannot swallow the closing guard syntax that follows it.
|
|
2690
|
+
*
|
|
2691
|
+
* @param expression - The candidate JavaScript expression to evaluate
|
|
2692
|
+
* @param limit - Maximum serialized-character length (see {@link BROWSER_RESULT_LIMIT})
|
|
2693
|
+
* @returns The wrapped, guarded expression
|
|
2694
|
+
*/
|
|
2695
|
+
export declare function guardEvaluateExpression(expression: string, limit: number): string;
|
|
2696
|
+
|
|
2697
|
+
/**
|
|
2698
|
+
* Narrow an unknown value to BrowserError.
|
|
2699
|
+
*
|
|
2700
|
+
* @param value - Value to check
|
|
2701
|
+
* @returns True when value is a BrowserError instance
|
|
2702
|
+
*/
|
|
2703
|
+
export declare function isBrowserError(value: unknown): value is BrowserError;
|
|
2704
|
+
|
|
2705
|
+
/**
|
|
2706
|
+
* Test whether one captured node is below another across frame boundaries.
|
|
2707
|
+
*
|
|
2708
|
+
* @param snapshot - Captured browser snapshot
|
|
2709
|
+
* @param node - Candidate descendant
|
|
2710
|
+
* @param ancestor - Candidate ancestor
|
|
2711
|
+
* @returns Whether the relationship exists
|
|
2712
|
+
*/
|
|
2713
|
+
export declare function isBrowserNodeDescendant(snapshot: BrowserSnapshot, node: BrowserNode, ancestor: BrowserNode): boolean;
|
|
2714
|
+
|
|
2715
|
+
/**
|
|
2716
|
+
* Test whether a captured node has a non-empty rendered layout box.
|
|
2717
|
+
*
|
|
2718
|
+
* @param node - Captured browser node
|
|
2719
|
+
* @returns Whether the snapshot reports a visible layout box
|
|
2720
|
+
*/
|
|
2721
|
+
export declare function isBrowserNodeVisible(node: BrowserNode): boolean;
|
|
2722
|
+
|
|
2723
|
+
/**
|
|
2724
|
+
* Narrow an unknown value to BrowserResultLimitError.
|
|
2725
|
+
*
|
|
2726
|
+
* @param value - Value to check
|
|
2727
|
+
* @returns True when value is a BrowserResultLimitError instance
|
|
2728
|
+
*/
|
|
2729
|
+
export declare function isBrowserResultLimitError(value: unknown): value is BrowserResultLimitError;
|
|
2730
|
+
|
|
2731
|
+
/**
|
|
2732
|
+
* Narrow an unknown value to BrowserSelectorError.
|
|
2733
|
+
*
|
|
2734
|
+
* @param value - Value to check
|
|
2735
|
+
* @returns True when value is a BrowserSelectorError instance
|
|
2736
|
+
*/
|
|
2737
|
+
export declare function isBrowserSelectorError(value: unknown): value is BrowserSelectorError;
|
|
2738
|
+
|
|
2739
|
+
/**
|
|
2740
|
+
* Narrow an unknown value to CDPConnectionError.
|
|
2741
|
+
*
|
|
2742
|
+
* @param value - Value to check
|
|
2743
|
+
* @returns True when value is a CDPConnectionError instance
|
|
2744
|
+
*/
|
|
2745
|
+
export declare function isCDPConnectionError(value: unknown): value is CDPConnectionError;
|
|
2746
|
+
|
|
2747
|
+
/**
|
|
2748
|
+
* Narrow an unknown value to CDPError.
|
|
2749
|
+
*
|
|
2750
|
+
* @param value - Value to check
|
|
2751
|
+
* @returns True when value is a CDPError instance
|
|
2752
|
+
*/
|
|
2753
|
+
export declare function isCDPError(value: unknown): value is CDPError;
|
|
2754
|
+
|
|
2755
|
+
/**
|
|
2756
|
+
* Narrow an unknown value to CDPTimeoutError.
|
|
2757
|
+
*
|
|
2758
|
+
* @param value - Value to check
|
|
2759
|
+
* @returns True when value is a CDPTimeoutError instance
|
|
2760
|
+
*/
|
|
2761
|
+
export declare function isCDPTimeoutError(value: unknown): value is CDPTimeoutError;
|
|
2762
|
+
|
|
2763
|
+
/**
|
|
2764
|
+
* Normalize one key to CDP keyboard event data.
|
|
2765
|
+
*
|
|
2766
|
+
* @param value - Key value or canonical key name
|
|
2767
|
+
* @returns Normalized key data
|
|
2768
|
+
*/
|
|
2769
|
+
export declare function keyToBrowserInput(value: string): BrowserKey;
|
|
2770
|
+
|
|
2771
|
+
/**
|
|
2772
|
+
* Match a decoded cookie against one request URL.
|
|
2773
|
+
*
|
|
2774
|
+
* @param cookie - Decoded context cookie
|
|
2775
|
+
* @param value - Candidate absolute URL
|
|
2776
|
+
* @returns Whether domain, path, and secure constraints match
|
|
2777
|
+
*/
|
|
2778
|
+
export declare function matchesBrowserCookieURL(cookie: BrowserCookie, value: string): boolean;
|
|
2779
|
+
|
|
2780
|
+
/**
|
|
2781
|
+
* Test a captured node against a declarative query.
|
|
2782
|
+
*
|
|
2783
|
+
* @param node - Captured browser node
|
|
2784
|
+
* @param query - Fields every candidate must satisfy
|
|
2785
|
+
* @returns Whether the node matches
|
|
2786
|
+
*/
|
|
2787
|
+
export declare function matchesBrowserNode(node: BrowserNode, query: BrowserNodeQuery): boolean;
|
|
2788
|
+
|
|
2789
|
+
/**
|
|
2790
|
+
* Match a request against route criteria.
|
|
2791
|
+
*
|
|
2792
|
+
* @param request - Observed request
|
|
2793
|
+
* @param query - Match criteria
|
|
2794
|
+
* @returns Whether every supplied criterion matches
|
|
2795
|
+
*/
|
|
2796
|
+
export declare function matchesBrowserRoute(request: BrowserRequest, query: BrowserRouteQuery): boolean;
|
|
2797
|
+
|
|
2798
|
+
/**
|
|
2799
|
+
* Match a URL using Chromium-style `*` and `**` glob segments.
|
|
2800
|
+
*
|
|
2801
|
+
* @param url - Candidate URL
|
|
2802
|
+
* @param pattern - Glob pattern
|
|
2803
|
+
* @returns Whether the whole URL matches
|
|
2804
|
+
*/
|
|
2805
|
+
export declare function matchesBrowserURL(url: string, pattern: string): boolean;
|
|
2806
|
+
|
|
2807
|
+
/**
|
|
2808
|
+
* Convert typed media preferences to Chromium emulated media features.
|
|
2809
|
+
*
|
|
2810
|
+
* @param media - Public media configuration
|
|
2811
|
+
* @returns Protocol feature records
|
|
2812
|
+
*/
|
|
2813
|
+
export declare function mediaToFeatures(media: BrowserMedia): readonly Readonly<Record<string, string>>[];
|
|
2814
|
+
|
|
2815
|
+
/**
|
|
2816
|
+
* Build a deterministic, serializable path for a captured browser node.
|
|
2817
|
+
*
|
|
2818
|
+
* @param snapshot - Captured browser snapshot
|
|
2819
|
+
* @param node - Captured browser node
|
|
2820
|
+
* @returns Frame-qualified structural path
|
|
2821
|
+
*/
|
|
2822
|
+
export declare function nodeToPath(snapshot: BrowserSnapshot, node: BrowserNode): string;
|
|
2823
|
+
|
|
2824
|
+
/**
|
|
2825
|
+
* Normalize a raw list of recorded codegen actions.
|
|
2826
|
+
*
|
|
2827
|
+
* @remarks
|
|
2828
|
+
* Collapses consecutive `fill` actions on the same selector into the latest
|
|
2829
|
+
* value (a text input fires one `input` event per keystroke) so the
|
|
2830
|
+
* compiled script reflects the final typed value rather than every
|
|
2831
|
+
* intermediate keystroke.
|
|
2832
|
+
*
|
|
2833
|
+
* @param actions - Raw recorded actions, in capture order
|
|
2834
|
+
* @returns Normalized actions, in the same order
|
|
2835
|
+
*/
|
|
2836
|
+
export declare function normalizeCodegenActions(actions: readonly BrowserCodegenAction[]): readonly BrowserCodegenAction[];
|
|
2837
|
+
|
|
2838
|
+
/**
|
|
2839
|
+
* Resolve the structural parent of a captured browser node.
|
|
2840
|
+
*
|
|
2841
|
+
* @remarks
|
|
2842
|
+
* An iframe content-document root resolves to its owning iframe node.
|
|
2843
|
+
*
|
|
2844
|
+
* @param snapshot - Captured browser snapshot
|
|
2845
|
+
* @param node - Child node
|
|
2846
|
+
* @returns Parent node, or undefined for a top-level document root
|
|
2847
|
+
*/
|
|
2848
|
+
export declare function parentOfBrowserNode(snapshot: BrowserSnapshot, node: BrowserNode): BrowserNode | undefined;
|
|
2849
|
+
|
|
2850
|
+
/**
|
|
2851
|
+
* Parse a keyboard chord such as `Control+Shift+P`.
|
|
2852
|
+
*
|
|
2853
|
+
* @param value - Chord source
|
|
2854
|
+
* @returns Canonical modifiers and terminal key
|
|
2855
|
+
*/
|
|
2856
|
+
export declare function parseBrowserChord(value: string): BrowserChord;
|
|
2857
|
+
|
|
2858
|
+
/**
|
|
2859
|
+
* Parse a codegen binding payload into a typed action.
|
|
2860
|
+
*
|
|
2861
|
+
* @remarks
|
|
2862
|
+
* The in-page recorder script calls the CDP binding with a JSON string
|
|
2863
|
+
* payload shaped like a {@link BrowserCodegenAction}. Returns `undefined`
|
|
2864
|
+
* when the payload is not valid JSON or does not match a known action shape.
|
|
2865
|
+
*
|
|
2866
|
+
* @param payload - Raw binding call payload (the CDP `payload` param)
|
|
2867
|
+
* @returns The parsed action, or `undefined` when the payload is malformed
|
|
2868
|
+
*/
|
|
2869
|
+
export declare function parseCodegenActionPayload(payload: unknown): BrowserCodegenAction | undefined;
|
|
2870
|
+
|
|
2871
|
+
/**
|
|
2872
|
+
* Return structural siblings before the supplied browser node.
|
|
2873
|
+
*
|
|
2874
|
+
* @param snapshot - Captured browser snapshot
|
|
2875
|
+
* @param node - Reference node
|
|
2876
|
+
* @returns Earlier siblings in structural order
|
|
2877
|
+
*/
|
|
2878
|
+
export declare function precedingSiblingsOfBrowserNode(snapshot: BrowserSnapshot, node: BrowserNode): readonly BrowserNode[];
|
|
2879
|
+
|
|
2880
|
+
/**
|
|
2881
|
+
* Decode Accessibility-domain nodes into a flat serializable tree.
|
|
2882
|
+
*
|
|
2883
|
+
* @param value - Unknown full or partial AX-tree result
|
|
2884
|
+
* @returns Valid accessibility snapshot
|
|
2885
|
+
*/
|
|
2886
|
+
export declare function readBrowserAccessibility(value: unknown): BrowserAccessibilitySnapshot;
|
|
2887
|
+
|
|
2888
|
+
/**
|
|
2889
|
+
* Decode a string-valued Accessibility-domain AXValue.
|
|
2890
|
+
*
|
|
2891
|
+
* @param value - Unknown AX value
|
|
2892
|
+
* @returns String or undefined
|
|
2893
|
+
*/
|
|
2894
|
+
export declare function readBrowserAXString(value: unknown): string | undefined;
|
|
2895
|
+
|
|
2896
|
+
/**
|
|
2897
|
+
* Decode an Accessibility-domain AXValue.
|
|
2898
|
+
*
|
|
2899
|
+
* @param value - Unknown AX value
|
|
2900
|
+
* @returns Underlying value
|
|
2901
|
+
*/
|
|
2902
|
+
export declare function readBrowserAXValue(value: unknown): unknown;
|
|
2903
|
+
|
|
2904
|
+
/**
|
|
2905
|
+
* Decode one Runtime binding invocation.
|
|
2906
|
+
*
|
|
2907
|
+
* @param value - Unknown `Runtime.bindingCalled` parameters
|
|
2908
|
+
* @returns Valid call or undefined
|
|
2909
|
+
*/
|
|
2910
|
+
export declare function readBrowserBindingCall(value: unknown): BrowserBindingCall | undefined;
|
|
2911
|
+
|
|
2912
|
+
/**
|
|
2913
|
+
* Decode one `Runtime.consoleAPICalled` event.
|
|
2914
|
+
*
|
|
2915
|
+
* @param value - Unknown event parameters
|
|
2916
|
+
* @returns Console message or undefined
|
|
2917
|
+
*/
|
|
2918
|
+
export declare function readBrowserConsoleMessage(value: unknown): BrowserConsoleMessage | undefined;
|
|
2919
|
+
|
|
2920
|
+
/**
|
|
2921
|
+
* Decode one Chromium cookie.
|
|
2922
|
+
*
|
|
2923
|
+
* @param value - Unknown cookie record
|
|
2924
|
+
* @param index - Source array position for diagnostics
|
|
2925
|
+
* @returns Valid cookie
|
|
2926
|
+
*/
|
|
2927
|
+
export declare function readBrowserCookie(value: unknown, index: number): BrowserCookie;
|
|
2928
|
+
|
|
2929
|
+
/**
|
|
2930
|
+
* Decode an optional Chromium cookie partition key.
|
|
2931
|
+
*
|
|
2932
|
+
* @param value - Unknown partition value
|
|
2933
|
+
* @returns Partition key or undefined
|
|
2934
|
+
*/
|
|
2935
|
+
export declare function readBrowserCookiePartition(value: unknown): BrowserCookiePartition | undefined;
|
|
2936
|
+
|
|
2937
|
+
/**
|
|
2938
|
+
* Decode cookies returned by `Storage.getCookies`.
|
|
2939
|
+
*
|
|
2940
|
+
* @param value - Unknown protocol result
|
|
2941
|
+
* @returns Valid cookies
|
|
2942
|
+
*/
|
|
2943
|
+
export declare function readBrowserCookies(value: unknown): readonly BrowserCookie[];
|
|
2944
|
+
|
|
2945
|
+
/**
|
|
2946
|
+
* Decode coverage ranges.
|
|
2947
|
+
*
|
|
2948
|
+
* @param value - Unknown ranges
|
|
2949
|
+
* @param script - Script index for diagnostics
|
|
2950
|
+
* @returns Valid ranges
|
|
2951
|
+
*/
|
|
2952
|
+
export declare function readBrowserCoverageRanges(value: unknown, script: number): readonly BrowserCoverageRange[];
|
|
2953
|
+
|
|
2954
|
+
/**
|
|
2955
|
+
* Decode one `Browser.downloadProgress` event.
|
|
496
2956
|
*
|
|
497
|
-
* @
|
|
498
|
-
*
|
|
499
|
-
* - `timeout` — ms before a pending request or connection attempt fails (default from constants)
|
|
2957
|
+
* @param value - Unknown event parameters
|
|
2958
|
+
* @returns Download id and progress, or undefined
|
|
500
2959
|
*/
|
|
501
|
-
export declare
|
|
502
|
-
readonly transport: CDPTransportInterface;
|
|
503
|
-
readonly timeout?: number;
|
|
504
|
-
}
|
|
2960
|
+
export declare function readBrowserDownloadProgress(value: unknown): readonly [id: string, progress: BrowserDownloadProgress] | undefined;
|
|
505
2961
|
|
|
506
2962
|
/**
|
|
507
|
-
*
|
|
508
|
-
*
|
|
509
|
-
*
|
|
2963
|
+
* Decode one `Browser.downloadWillBegin` event.
|
|
2964
|
+
*
|
|
2965
|
+
* @param value - Unknown event parameters
|
|
2966
|
+
* @returns Download start or undefined
|
|
510
2967
|
*/
|
|
511
|
-
export declare
|
|
512
|
-
constructor(message: string, context?: Readonly<Record<string, unknown>>);
|
|
513
|
-
}
|
|
2968
|
+
export declare function readBrowserDownloadStart(value: unknown): BrowserDownloadStart | undefined;
|
|
514
2969
|
|
|
515
2970
|
/**
|
|
516
|
-
*
|
|
2971
|
+
* Decode a flattened CDP `Page.getFrameTree` result.
|
|
517
2972
|
*
|
|
518
|
-
* @
|
|
519
|
-
*
|
|
520
|
-
* `message`, and `data` (when present) in `context`, so callers can branch
|
|
521
|
-
* on the protocol-level error instead of parsing the message string.
|
|
2973
|
+
* @param value - Unknown CDP result
|
|
2974
|
+
* @returns Frame metadata in depth-first, main-frame-first order
|
|
522
2975
|
*/
|
|
523
|
-
export declare
|
|
524
|
-
constructor(message: string, context?: Readonly<Record<string, unknown>>);
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
/** Handler invoked for a subscribed CDP event with its params record. */
|
|
528
|
-
export declare type CDPHandler = (params: Readonly<Record<string, unknown>>) => void;
|
|
529
|
-
|
|
530
|
-
/** One entry of the CDP `Target.getTargets` result. */
|
|
531
|
-
export declare interface CDPTarget {
|
|
532
|
-
readonly id: string;
|
|
533
|
-
readonly type: string;
|
|
534
|
-
readonly title: string;
|
|
535
|
-
readonly url: string;
|
|
536
|
-
}
|
|
2976
|
+
export declare function readBrowserFrames(value: unknown): readonly BrowserFrameInfo[];
|
|
537
2977
|
|
|
538
2978
|
/**
|
|
539
|
-
*
|
|
2979
|
+
* Decode a Chromium Headers object into string values.
|
|
2980
|
+
*
|
|
2981
|
+
* @param value - Unknown headers
|
|
2982
|
+
* @returns Frozen-compatible header record
|
|
540
2983
|
*/
|
|
541
|
-
export declare
|
|
542
|
-
constructor(message: string, context?: Readonly<Record<string, unknown>>);
|
|
543
|
-
}
|
|
2984
|
+
export declare function readBrowserHeaders(value: unknown): Readonly<Record<string, string>>;
|
|
544
2985
|
|
|
545
2986
|
/**
|
|
546
|
-
*
|
|
547
|
-
* {@link CDPClientInterface} sends and receives JSON-RPC frames over.
|
|
2987
|
+
* Decode Performance-domain metrics.
|
|
548
2988
|
*
|
|
549
|
-
* @
|
|
550
|
-
*
|
|
551
|
-
* connection ended; `error` carries a transport-level fault (unknown shape —
|
|
552
|
-
* narrow before use).
|
|
2989
|
+
* @param value - Unknown metrics result
|
|
2990
|
+
* @returns Valid metrics
|
|
553
2991
|
*/
|
|
554
|
-
export declare
|
|
555
|
-
readonly message: readonly [data: string];
|
|
556
|
-
readonly close: readonly [];
|
|
557
|
-
readonly error: readonly [error: unknown];
|
|
558
|
-
};
|
|
2992
|
+
export declare function readBrowserMetrics(value: unknown): readonly BrowserMetric[];
|
|
559
2993
|
|
|
560
2994
|
/**
|
|
561
|
-
*
|
|
2995
|
+
* Decode one `Runtime.exceptionThrown` event.
|
|
562
2996
|
*
|
|
563
|
-
* @
|
|
564
|
-
*
|
|
565
|
-
* channel) and the endpoint URL; it does no JSON framing of its own — that
|
|
566
|
-
* stays in {@link CDPClientInterface}. Environment-specific transports
|
|
567
|
-
* (a Node `WebSocket`, a browser `WebSocket`) live outside core and satisfy
|
|
568
|
-
* this contract.
|
|
2997
|
+
* @param value - Unknown event parameters
|
|
2998
|
+
* @returns Page error or undefined
|
|
569
2999
|
*/
|
|
570
|
-
export declare
|
|
571
|
-
readonly emitter: EmitterInterface<CDPTransportEventMap>;
|
|
572
|
-
start(): Promise<void>;
|
|
573
|
-
send(data: string): Promise<void>;
|
|
574
|
-
close(): Promise<void>;
|
|
575
|
-
}
|
|
3000
|
+
export declare function readBrowserPageError(value: unknown): BrowserPageError | undefined;
|
|
576
3001
|
|
|
577
3002
|
/**
|
|
578
|
-
*
|
|
579
|
-
*
|
|
580
|
-
* @remarks
|
|
581
|
-
* Emits one statement per action against a `page` object shaped like
|
|
582
|
-
* {@link BrowserPageInterface} (`page.navigate(...)`, `page.click(...)`, …).
|
|
583
|
-
* Both target languages emit an `async function run(page)` body whose
|
|
584
|
-
* statements are `await`-ed; `language` only toggles whether the `page`
|
|
585
|
-
* parameter carries a TypeScript type annotation (default `'javascript'`).
|
|
3003
|
+
* Decode one CPU profile.
|
|
586
3004
|
*
|
|
587
|
-
* @param
|
|
588
|
-
* @
|
|
589
|
-
* @returns The compiled script source
|
|
3005
|
+
* @param value - Unknown `Profiler.stop` result
|
|
3006
|
+
* @returns Valid profile
|
|
590
3007
|
*/
|
|
591
|
-
export declare function
|
|
3008
|
+
export declare function readBrowserProfile(value: unknown): BrowserProfile;
|
|
592
3009
|
|
|
593
3010
|
/**
|
|
594
|
-
*
|
|
3011
|
+
* Decode a CPU profile call frame.
|
|
595
3012
|
*
|
|
596
|
-
* @param
|
|
597
|
-
* @
|
|
3013
|
+
* @param value - Unknown call frame
|
|
3014
|
+
* @param node - Node index for diagnostics
|
|
3015
|
+
* @returns Valid call frame
|
|
3016
|
+
*/
|
|
3017
|
+
export declare function readBrowserProfileFrame(value: unknown, node: number): BrowserProfileFrame;
|
|
3018
|
+
|
|
3019
|
+
/**
|
|
3020
|
+
* Decode the first `DOM.getContentQuads` quad and its center.
|
|
598
3021
|
*
|
|
599
|
-
* @
|
|
600
|
-
*
|
|
601
|
-
|
|
3022
|
+
* @param value - Unknown CDP result
|
|
3023
|
+
* @returns Decoded quad
|
|
3024
|
+
*/
|
|
3025
|
+
export declare function readBrowserQuad(value: unknown): BrowserQuad;
|
|
3026
|
+
|
|
3027
|
+
/**
|
|
3028
|
+
* Decode a CDP snapshot rectangle.
|
|
602
3029
|
*
|
|
603
|
-
*
|
|
604
|
-
*
|
|
605
|
-
* ```
|
|
3030
|
+
* @param value - Candidate four-number array
|
|
3031
|
+
* @returns A rectangle, or undefined
|
|
606
3032
|
*/
|
|
607
|
-
export declare function
|
|
3033
|
+
export declare function readBrowserRect(value: unknown): BrowserRect | undefined;
|
|
608
3034
|
|
|
609
3035
|
/**
|
|
610
|
-
* Decode a
|
|
3036
|
+
* Decode a Runtime remote object's printable value.
|
|
611
3037
|
*
|
|
612
|
-
* @
|
|
613
|
-
*
|
|
614
|
-
|
|
615
|
-
|
|
3038
|
+
* @param value - Unknown remote object
|
|
3039
|
+
* @returns By-value data or a description
|
|
3040
|
+
*/
|
|
3041
|
+
export declare function readBrowserRemoteValue(value: unknown): unknown;
|
|
3042
|
+
|
|
3043
|
+
/**
|
|
3044
|
+
* Decode one `Network.requestWillBeSent` or `Fetch.requestPaused` event.
|
|
616
3045
|
*
|
|
617
|
-
* @param
|
|
618
|
-
* @returns
|
|
3046
|
+
* @param value - Unknown event parameters
|
|
3047
|
+
* @returns Request or undefined
|
|
3048
|
+
*/
|
|
3049
|
+
export declare function readBrowserRequest(value: unknown): BrowserRequest | undefined;
|
|
3050
|
+
|
|
3051
|
+
/**
|
|
3052
|
+
* Decode one `Network.loadingFailed` event.
|
|
619
3053
|
*
|
|
620
|
-
* @
|
|
621
|
-
*
|
|
622
|
-
* decodeBase64('aGVsbG8=') // Uint8Array [104, 101, 108, 108, 111]
|
|
623
|
-
* ```
|
|
3054
|
+
* @param value - Unknown event parameters
|
|
3055
|
+
* @returns Failure or undefined
|
|
624
3056
|
*/
|
|
625
|
-
export declare function
|
|
3057
|
+
export declare function readBrowserRequestFailure(value: unknown): BrowserRequestFailure | undefined;
|
|
626
3058
|
|
|
627
3059
|
/**
|
|
628
|
-
*
|
|
629
|
-
* own result and throws a recognizable error before an oversized result
|
|
630
|
-
* would overflow the CDP transport frame.
|
|
3060
|
+
* Decode one `Network.responseReceived` event.
|
|
631
3061
|
*
|
|
632
|
-
* @
|
|
633
|
-
*
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
*
|
|
639
|
-
* unchanged.
|
|
3062
|
+
* @param value - Unknown event parameters
|
|
3063
|
+
* @returns Response or undefined
|
|
3064
|
+
*/
|
|
3065
|
+
export declare function readBrowserResponse(value: unknown): BrowserResponse | undefined;
|
|
3066
|
+
|
|
3067
|
+
/**
|
|
3068
|
+
* Decode one Chromium response object with its event identity.
|
|
640
3069
|
*
|
|
641
|
-
*
|
|
642
|
-
*
|
|
643
|
-
*
|
|
3070
|
+
* @param value - Unknown response object
|
|
3071
|
+
* @param id - Request id
|
|
3072
|
+
* @param loader - Loader id
|
|
3073
|
+
* @param frame - Optional frame id
|
|
3074
|
+
* @param timestamp - Monotonic event timestamp
|
|
3075
|
+
* @returns Response or undefined
|
|
3076
|
+
*/
|
|
3077
|
+
export declare function readBrowserResponseRecord(value: unknown, id: string, loader: string, frame: string | undefined, timestamp: number): BrowserResponse | undefined;
|
|
3078
|
+
|
|
3079
|
+
/**
|
|
3080
|
+
* Decode JavaScript precise coverage.
|
|
644
3081
|
*
|
|
645
|
-
* @param
|
|
646
|
-
* @
|
|
647
|
-
* @returns The wrapped, guarded expression
|
|
3082
|
+
* @param value - Unknown `Profiler.takePreciseCoverage` result
|
|
3083
|
+
* @returns Script coverage
|
|
648
3084
|
*/
|
|
649
|
-
export declare function
|
|
3085
|
+
export declare function readBrowserScriptCoverage(value: unknown): readonly BrowserScriptCoverage[];
|
|
650
3086
|
|
|
651
3087
|
/**
|
|
652
|
-
*
|
|
3088
|
+
* Decode `Page.addScriptToEvaluateOnNewDocument` result.
|
|
653
3089
|
*
|
|
654
|
-
* @param value -
|
|
655
|
-
* @returns
|
|
3090
|
+
* @param value - Unknown protocol result
|
|
3091
|
+
* @returns Script identifier
|
|
656
3092
|
*/
|
|
657
|
-
export declare function
|
|
3093
|
+
export declare function readBrowserScriptIdentifier(value: unknown): string;
|
|
658
3094
|
|
|
659
3095
|
/**
|
|
660
|
-
*
|
|
3096
|
+
* Decode Chromium TLS security details.
|
|
661
3097
|
*
|
|
662
|
-
* @param value -
|
|
663
|
-
* @returns
|
|
3098
|
+
* @param value - Unknown security details
|
|
3099
|
+
* @returns Security metadata or undefined
|
|
664
3100
|
*/
|
|
665
|
-
export declare function
|
|
3101
|
+
export declare function readBrowserSecurity(value: unknown): BrowserSecurity | undefined;
|
|
666
3102
|
|
|
667
3103
|
/**
|
|
668
|
-
*
|
|
3104
|
+
* Decode a Chromium runtime stack trace.
|
|
669
3105
|
*
|
|
670
|
-
* @param value -
|
|
671
|
-
* @returns
|
|
3106
|
+
* @param value - Unknown stack trace or call-frame list
|
|
3107
|
+
* @returns Valid stack frames
|
|
672
3108
|
*/
|
|
673
|
-
export declare function
|
|
3109
|
+
export declare function readBrowserStack(value: unknown): readonly BrowserStackFrame[];
|
|
674
3110
|
|
|
675
3111
|
/**
|
|
676
|
-
*
|
|
3112
|
+
* Decode a list of web-storage entries.
|
|
677
3113
|
*
|
|
678
|
-
* @param value -
|
|
679
|
-
* @
|
|
3114
|
+
* @param value - Unknown entry list
|
|
3115
|
+
* @param origin - Origin used for diagnostics
|
|
3116
|
+
* @param storage - Storage family used for diagnostics
|
|
3117
|
+
* @returns Valid key/value entries
|
|
680
3118
|
*/
|
|
681
|
-
export declare function
|
|
3119
|
+
export declare function readBrowserStorageEntries(value: unknown, origin: string, storage: 'local' | 'session'): readonly BrowserStorageEntry[];
|
|
682
3120
|
|
|
683
3121
|
/**
|
|
684
|
-
*
|
|
3122
|
+
* Decode one in-page web-storage snapshot.
|
|
685
3123
|
*
|
|
686
|
-
* @param value -
|
|
687
|
-
* @
|
|
3124
|
+
* @param value - Unknown evaluation result
|
|
3125
|
+
* @param origin - Origin represented by the result
|
|
3126
|
+
* @returns Valid origin storage
|
|
688
3127
|
*/
|
|
689
|
-
export declare function
|
|
3128
|
+
export declare function readBrowserStorageOrigin(value: unknown, origin: string): BrowserStorageOrigin;
|
|
690
3129
|
|
|
691
3130
|
/**
|
|
692
|
-
*
|
|
3131
|
+
* Decode one `IO.read` response.
|
|
693
3132
|
*
|
|
694
|
-
* @param value -
|
|
695
|
-
* @returns
|
|
3133
|
+
* @param value - Unknown protocol result
|
|
3134
|
+
* @returns Valid stream chunk
|
|
696
3135
|
*/
|
|
697
|
-
export declare function
|
|
3136
|
+
export declare function readBrowserStreamChunk(value: unknown): BrowserStreamChunk;
|
|
698
3137
|
|
|
699
3138
|
/**
|
|
700
|
-
*
|
|
3139
|
+
* Decode CSS rule usage.
|
|
701
3140
|
*
|
|
702
|
-
* @
|
|
703
|
-
*
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
3141
|
+
* @param value - Unknown `CSS.stopRuleUsageTracking` result
|
|
3142
|
+
* @returns Stylesheet coverage
|
|
3143
|
+
*/
|
|
3144
|
+
export declare function readBrowserStyleCoverage(value: unknown): readonly BrowserStyleCoverage[];
|
|
3145
|
+
|
|
3146
|
+
/**
|
|
3147
|
+
* Decode Chromium response timing.
|
|
707
3148
|
*
|
|
708
|
-
* @param
|
|
709
|
-
* @returns
|
|
3149
|
+
* @param value - Unknown timing object
|
|
3150
|
+
* @returns Timing or undefined
|
|
710
3151
|
*/
|
|
711
|
-
export declare function
|
|
3152
|
+
export declare function readBrowserTiming(value: unknown): BrowserTiming | undefined;
|
|
712
3153
|
|
|
713
3154
|
/**
|
|
714
|
-
*
|
|
3155
|
+
* Decode one start/end pair from Chromium network timing data.
|
|
715
3156
|
*
|
|
716
|
-
* @
|
|
717
|
-
*
|
|
718
|
-
*
|
|
719
|
-
*
|
|
3157
|
+
* @param value - Unknown timing object
|
|
3158
|
+
* @param start - Start field
|
|
3159
|
+
* @param end - End field
|
|
3160
|
+
* @returns Timing range or undefined
|
|
3161
|
+
*/
|
|
3162
|
+
export declare function readBrowserTimingRange(value: unknown, start: string, end: string): BrowserTimingRange | undefined;
|
|
3163
|
+
|
|
3164
|
+
/**
|
|
3165
|
+
* Decode one WebSocket frame event.
|
|
720
3166
|
*
|
|
721
|
-
* @param
|
|
722
|
-
* @returns
|
|
3167
|
+
* @param value - Unknown event parameters
|
|
3168
|
+
* @returns Frame or undefined
|
|
723
3169
|
*/
|
|
724
|
-
export declare function
|
|
3170
|
+
export declare function readBrowserWebSocketFrame(value: unknown): BrowserWebSocketFrame | undefined;
|
|
725
3171
|
|
|
726
3172
|
/**
|
|
727
3173
|
* Derive a `navigate` codegen action from a `Page.frameNavigated` CDP event.
|
|
@@ -736,6 +3182,40 @@ export declare function parseCodegenActionPayload(payload: unknown): BrowserCode
|
|
|
736
3182
|
*/
|
|
737
3183
|
export declare function readCodegenNavigateAction(params: Readonly<Record<string, unknown>>): BrowserCodegenAction | undefined;
|
|
738
3184
|
|
|
3185
|
+
/**
|
|
3186
|
+
* Decode one CDP `Runtime.evaluate` result.
|
|
3187
|
+
*
|
|
3188
|
+
* @param value - Unknown CDP result
|
|
3189
|
+
* @returns The returned by-value payload, or undefined
|
|
3190
|
+
*/
|
|
3191
|
+
export declare function readEvaluationResult(value: unknown): unknown;
|
|
3192
|
+
|
|
3193
|
+
/**
|
|
3194
|
+
* Read an unknown value as an all-number array.
|
|
3195
|
+
*
|
|
3196
|
+
* @param value - Candidate value
|
|
3197
|
+
* @returns The number array, or undefined
|
|
3198
|
+
*/
|
|
3199
|
+
export declare function readNumberArray(value: unknown): readonly number[] | undefined;
|
|
3200
|
+
|
|
3201
|
+
/**
|
|
3202
|
+
* Resolve one index from a CDP snapshot string table.
|
|
3203
|
+
*
|
|
3204
|
+
* @param strings - Snapshot string table
|
|
3205
|
+
* @param index - Candidate string index
|
|
3206
|
+
* @returns The resolved string, or undefined
|
|
3207
|
+
*/
|
|
3208
|
+
export declare function readSnapshotString(strings: readonly string[], index: unknown): string | undefined;
|
|
3209
|
+
|
|
3210
|
+
/**
|
|
3211
|
+
* Require an evaluated browser value to be a string.
|
|
3212
|
+
*
|
|
3213
|
+
* @param value - Candidate evaluated value
|
|
3214
|
+
* @param field - Human-readable field name used in the error
|
|
3215
|
+
* @returns The narrowed string
|
|
3216
|
+
*/
|
|
3217
|
+
export declare function requireBrowserString(value: unknown, field: string): string;
|
|
3218
|
+
|
|
739
3219
|
/**
|
|
740
3220
|
* Pluggable sink for persisting screenshot bytes to a path.
|
|
741
3221
|
*
|
|
@@ -748,4 +3228,121 @@ export declare interface ScreenshotWriterInterface {
|
|
|
748
3228
|
write(path: string, data: Uint8Array): Promise<void>;
|
|
749
3229
|
}
|
|
750
3230
|
|
|
3231
|
+
/**
|
|
3232
|
+
* Return every structural sibling except the supplied browser node.
|
|
3233
|
+
*
|
|
3234
|
+
* @param snapshot - Captured browser snapshot
|
|
3235
|
+
* @param node - Node whose siblings are required
|
|
3236
|
+
* @returns Siblings in structural order
|
|
3237
|
+
*/
|
|
3238
|
+
export declare function siblingsOfBrowserNode(snapshot: BrowserSnapshot, node: BrowserNode): readonly BrowserNode[];
|
|
3239
|
+
|
|
3240
|
+
/** Encode UTF-8 text as bytes. */
|
|
3241
|
+
export declare function textToBytes(value: string): Uint8Array;
|
|
3242
|
+
|
|
3243
|
+
/**
|
|
3244
|
+
* Validate Accessibility-domain snapshot bounds.
|
|
3245
|
+
*
|
|
3246
|
+
* @param options - Public accessibility snapshot options
|
|
3247
|
+
*/
|
|
3248
|
+
export declare function validateBrowserAccessibilityOptions(options?: BrowserAccessibilityOptions): void;
|
|
3249
|
+
|
|
3250
|
+
/**
|
|
3251
|
+
* Validate shared trusted-input options.
|
|
3252
|
+
*
|
|
3253
|
+
* @param options - Candidate action options
|
|
3254
|
+
*/
|
|
3255
|
+
export declare function validateBrowserActionOptions(options?: BrowserActionOptions): void;
|
|
3256
|
+
|
|
3257
|
+
/**
|
|
3258
|
+
* Validate isolated-context options before creating remote state.
|
|
3259
|
+
*
|
|
3260
|
+
* @param options - Public context configuration
|
|
3261
|
+
*/
|
|
3262
|
+
export declare function validateBrowserContextOptions(options?: BrowserContextOptions): void;
|
|
3263
|
+
|
|
3264
|
+
/**
|
|
3265
|
+
* Validate context emulation boundaries before partial application.
|
|
3266
|
+
*
|
|
3267
|
+
* @param options - Public emulation configuration
|
|
3268
|
+
*/
|
|
3269
|
+
export declare function validateBrowserEmulationOptions(options: BrowserEmulationOptions): void;
|
|
3270
|
+
|
|
3271
|
+
/**
|
|
3272
|
+
* Validate the HAR 1.2 fields required for deterministic replay.
|
|
3273
|
+
*
|
|
3274
|
+
* @param value - Candidate archive
|
|
3275
|
+
*/
|
|
3276
|
+
export declare function validateBrowserHAR(value: unknown): asserts value is BrowserHAR;
|
|
3277
|
+
|
|
3278
|
+
/**
|
|
3279
|
+
* Validate viewport input coordinates.
|
|
3280
|
+
*
|
|
3281
|
+
* @param point - Candidate point
|
|
3282
|
+
*/
|
|
3283
|
+
export declare function validateBrowserPoint(point: BrowserPoint): void;
|
|
3284
|
+
|
|
3285
|
+
/**
|
|
3286
|
+
* Validate a finite numeric range.
|
|
3287
|
+
*
|
|
3288
|
+
* @param value - Candidate number
|
|
3289
|
+
* @param field - Diagnostic field
|
|
3290
|
+
* @param minimum - Inclusive lower bound
|
|
3291
|
+
* @param maximum - Inclusive upper bound
|
|
3292
|
+
* @param inclusive - Whether the lower bound is inclusive
|
|
3293
|
+
*/
|
|
3294
|
+
export declare function validateBrowserRange(value: number, field: string, minimum: number, maximum: number, inclusive?: boolean): void;
|
|
3295
|
+
|
|
3296
|
+
/**
|
|
3297
|
+
* Validate a public browser timeout before protocol work begins.
|
|
3298
|
+
*
|
|
3299
|
+
* @param timeout - Timeout in milliseconds
|
|
3300
|
+
*/
|
|
3301
|
+
export declare function validateBrowserTimeout(timeout: number): void;
|
|
3302
|
+
|
|
3303
|
+
/**
|
|
3304
|
+
* Validate Chromium viewport metrics.
|
|
3305
|
+
*
|
|
3306
|
+
* @param viewport - Public viewport configuration
|
|
3307
|
+
*/
|
|
3308
|
+
export declare function validateBrowserViewport(viewport: BrowserViewport): void;
|
|
3309
|
+
|
|
3310
|
+
/**
|
|
3311
|
+
* Lazily walk one captured browser-node subtree in depth-first order.
|
|
3312
|
+
*
|
|
3313
|
+
* @param snapshot - Captured browser snapshot
|
|
3314
|
+
* @param root - Root node, included as the first result
|
|
3315
|
+
* @returns A lazy subtree generator
|
|
3316
|
+
*/
|
|
3317
|
+
export declare function walkBrowserNode(snapshot: BrowserSnapshot, root: BrowserNode): Generator<BrowserNode, void, unknown>;
|
|
3318
|
+
|
|
3319
|
+
/**
|
|
3320
|
+
* Lazily walk one captured browser-node subtree in breadth-first order.
|
|
3321
|
+
*
|
|
3322
|
+
* @param snapshot - Captured browser snapshot
|
|
3323
|
+
* @param root - Root node, included as the first result
|
|
3324
|
+
* @returns A lazy breadth-first subtree generator
|
|
3325
|
+
*/
|
|
3326
|
+
export declare function walkBrowserNodeBreadthFirst(snapshot: BrowserSnapshot, root: BrowserNode): Generator<BrowserNode, void, unknown>;
|
|
3327
|
+
|
|
3328
|
+
/**
|
|
3329
|
+
* Lazily walk every captured browser node in structural depth-first order.
|
|
3330
|
+
*
|
|
3331
|
+
* @remarks
|
|
3332
|
+
* Iframe content documents are entered at their owner element. Orphaned or
|
|
3333
|
+
* cyclic protocol nodes are still yielded once through an identity guard.
|
|
3334
|
+
*
|
|
3335
|
+
* @param snapshot - Captured browser snapshot
|
|
3336
|
+
* @returns A lazy node generator
|
|
3337
|
+
*/
|
|
3338
|
+
export declare function walkBrowserSnapshot(snapshot: BrowserSnapshot): Generator<BrowserNode, void, unknown>;
|
|
3339
|
+
|
|
3340
|
+
/**
|
|
3341
|
+
* Lazily walk every captured node in structural breadth-first order.
|
|
3342
|
+
*
|
|
3343
|
+
* @param snapshot - Captured browser snapshot
|
|
3344
|
+
* @returns A lazy breadth-first generator
|
|
3345
|
+
*/
|
|
3346
|
+
export declare function walkBrowserSnapshotBreadthFirst(snapshot: BrowserSnapshot): Generator<BrowserNode, void, unknown>;
|
|
3347
|
+
|
|
751
3348
|
export { }
|