@orkestrel/browser 0.0.14 → 0.0.15
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 +3 -3
- package/dist/src/core/index.cjs +2574 -2355
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +1185 -720
- package/dist/src/core/index.d.ts +1185 -720
- package/dist/src/core/index.js +2544 -2322
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +218 -190
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +159 -110
- package/dist/src/server/index.d.ts +159 -110
- package/dist/src/server/index.js +212 -181
- package/dist/src/server/index.js.map +1 -1
- package/package.json +15 -15
|
@@ -2,26 +2,17 @@ import { EmitterErrorHandler } from '@orkestrel/emitter';
|
|
|
2
2
|
import { EmitterHooks } from '@orkestrel/emitter';
|
|
3
3
|
import { EmitterInterface } from '@orkestrel/emitter';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* Read one captured node attribute.
|
|
7
|
-
*
|
|
8
|
-
* @param node - Captured browser node
|
|
9
|
-
* @param name - Attribute name
|
|
10
|
-
* @returns Attribute value, or undefined
|
|
11
|
-
*/
|
|
12
|
-
export declare function attributeOfBrowserNode(node: BrowserNode, name: string): string | undefined;
|
|
13
|
-
|
|
14
|
-
/** Base64 alphabet, index-ordered, used to build {@link BASE64_LOOKUP}. */
|
|
5
|
+
/** Holds the index-ordered base64 alphabet used to build {@link BASE64_LOOKUP}. */
|
|
15
6
|
export declare const BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
16
7
|
|
|
17
|
-
/**
|
|
8
|
+
/** Maps each base64 character to its 6-bit value, derived from {@link BASE64_CHARS}. */
|
|
18
9
|
export declare const BASE64_LOOKUP: Readonly<Record<string, number>>;
|
|
19
10
|
|
|
20
|
-
/**
|
|
11
|
+
/** Names the CDP runtime binding the codegen recorder script calls into. */
|
|
21
12
|
export declare const BROWSER_CODEGEN_BINDING_NAME = "__orkestrelBrowserCodegen";
|
|
22
13
|
|
|
23
14
|
/**
|
|
24
|
-
*
|
|
15
|
+
* Holds the in-page recorder script injected through `Page.addScriptToEvaluateOnNewDocument`
|
|
25
16
|
* and `Runtime.evaluate`.
|
|
26
17
|
*
|
|
27
18
|
* @remarks
|
|
@@ -34,32 +25,39 @@ export declare const BROWSER_CODEGEN_BINDING_NAME = "__orkestrelBrowserCodegen";
|
|
|
34
25
|
*/
|
|
35
26
|
export declare const BROWSER_CODEGEN_SOURCE: string;
|
|
36
27
|
|
|
37
|
-
/**
|
|
28
|
+
/** Sets the default timeout in milliseconds for browser connection, requests, and navigation. */
|
|
38
29
|
export declare const BROWSER_DEFAULT_TIMEOUT_MS = 30000;
|
|
39
30
|
|
|
40
|
-
/**
|
|
31
|
+
/** Sets the default viewport height in pixels. */
|
|
41
32
|
export declare const BROWSER_DEFAULT_VIEWPORT_HEIGHT = 720;
|
|
42
33
|
|
|
43
|
-
/**
|
|
34
|
+
/** Sets the default viewport width in pixels. */
|
|
44
35
|
export declare const BROWSER_DEFAULT_VIEWPORT_WIDTH = 1280;
|
|
45
36
|
|
|
46
|
-
/**
|
|
37
|
+
/** Names the isolated world used for iframe evaluation. */
|
|
47
38
|
export declare const BROWSER_FRAME_WORLD_NAME = "__orkestrelBrowserFrame";
|
|
48
39
|
|
|
49
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Names the tool identity embedded in HAR 1.2 documents.
|
|
42
|
+
*
|
|
43
|
+
* @remarks
|
|
44
|
+
* `version` is this package's own released version. A parity test in
|
|
45
|
+
* `tests/src/core/BrowserHARManager.test.ts` compares it against the manifest,
|
|
46
|
+
* so the archive stamp cannot drift away from the release that wrote it.
|
|
47
|
+
*/
|
|
50
48
|
export declare const BROWSER_HAR_CREATOR: Readonly<{
|
|
51
49
|
name: "@orkestrel/browser";
|
|
52
|
-
version: "0.0.
|
|
50
|
+
version: "0.0.15";
|
|
53
51
|
}>;
|
|
54
52
|
|
|
55
|
-
/**
|
|
53
|
+
/** Maps a canonical modifier name to its CDP Input modifier bit value. */
|
|
56
54
|
export declare const BROWSER_KEY_MODIFIERS: Readonly<Record<string, number>>;
|
|
57
55
|
|
|
58
|
-
/** CDP Input pressed-button bit
|
|
56
|
+
/** Maps each public mouse button to its CDP Input pressed-button bit value. */
|
|
59
57
|
export declare const BROWSER_MOUSE_BUTTON_MASKS: Readonly<Record<BrowserMouseButton, number>>;
|
|
60
58
|
|
|
61
59
|
/**
|
|
62
|
-
*
|
|
60
|
+
* Caps the serialized-character length for an `evaluate()`/`content()` result,
|
|
63
61
|
* enforced IN-PAGE before the result is returned to CDP.
|
|
64
62
|
*
|
|
65
63
|
* @remarks
|
|
@@ -89,7 +87,7 @@ export declare const BROWSER_RESULT_LIMIT = 2500000;
|
|
|
89
87
|
export declare const BROWSER_RESULT_LIMIT_PATTERN: RegExp;
|
|
90
88
|
|
|
91
89
|
/**
|
|
92
|
-
*
|
|
90
|
+
* Names the distinctive prefix for the in-page result-limit sentinel error, immediately
|
|
93
91
|
* followed by the serialized length.
|
|
94
92
|
*
|
|
95
93
|
* @remarks
|
|
@@ -100,17 +98,17 @@ export declare const BROWSER_RESULT_LIMIT_PATTERN: RegExp;
|
|
|
100
98
|
*/
|
|
101
99
|
export declare const BROWSER_RESULT_LIMIT_SENTINEL_PREFIX = "[[ORKESTREL_BROWSER_RESULT_LIMIT]]";
|
|
102
100
|
|
|
103
|
-
/**
|
|
101
|
+
/** Names the attribute that tags temporary screenshot styles and masks. */
|
|
104
102
|
export declare const BROWSER_SCREENSHOT_ATTRIBUTE = "data-orkestrel-screenshot";
|
|
105
103
|
|
|
106
|
-
/**
|
|
104
|
+
/** Sets the default maximum node count accepted from a decoded CDP DOM snapshot. */
|
|
107
105
|
export declare const BROWSER_SNAPSHOT_NODE_LIMIT = 100000;
|
|
108
106
|
|
|
109
|
-
/**
|
|
107
|
+
/** Sets the number of animation frames whose element bounds must agree before trusted input. */
|
|
110
108
|
export declare const BROWSER_STABLE_FRAME_COUNT = 2;
|
|
111
109
|
|
|
112
110
|
/**
|
|
113
|
-
*
|
|
111
|
+
* Bounds (in milliseconds) the best-effort `Page.stopLoading` call issued
|
|
114
112
|
* after a failed `navigate()`.
|
|
115
113
|
*
|
|
116
114
|
* @remarks
|
|
@@ -121,14 +119,33 @@ export declare const BROWSER_STABLE_FRAME_COUNT = 2;
|
|
|
121
119
|
*/
|
|
122
120
|
export declare const BROWSER_STOP_LOADING_TIMEOUT_MS = 1000;
|
|
123
121
|
|
|
124
|
-
/**
|
|
122
|
+
/** Names the attribute the semantic test-id selector uses. */
|
|
125
123
|
export declare const BROWSER_TEST_ID_ATTRIBUTE = "data-testid";
|
|
126
124
|
|
|
127
|
-
/**
|
|
125
|
+
/**
|
|
126
|
+
* Holds the in-page visibility predicate source, over a `style` computed style and a
|
|
127
|
+
* `rect` bounding box already in scope at the interpolation site.
|
|
128
|
+
*
|
|
129
|
+
* @remarks
|
|
130
|
+
* Every compiled expression that decides whether an element is visible
|
|
131
|
+
* interpolates this one source, so what "visible" means has a single
|
|
132
|
+
* definition rather than one copy per compiler.
|
|
133
|
+
*/
|
|
134
|
+
export declare const BROWSER_VISIBILITY_SOURCE = "style.display !== 'none' && style.visibility !== 'hidden' && style.visibility !== 'collapse' && rect.width > 0 && rect.height > 0";
|
|
135
|
+
|
|
136
|
+
/** Sets the poll interval in milliseconds while waiting for a selector to appear. */
|
|
128
137
|
export declare const BROWSER_WAIT_POLL_INTERVAL_MS = 100;
|
|
129
138
|
|
|
130
139
|
/**
|
|
131
|
-
* Chromium Accessibility-domain snapshots for one page.
|
|
140
|
+
* Captures Chromium Accessibility-domain snapshots for one page.
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```ts
|
|
144
|
+
* import { BrowserAccessibility } from '@orkestrel/browser'
|
|
145
|
+
*
|
|
146
|
+
* const accessibility = new BrowserAccessibility(page)
|
|
147
|
+
* const tree = await accessibility.snapshot({ depth: 3 }) // { roots, nodes }
|
|
148
|
+
* ```
|
|
132
149
|
*/
|
|
133
150
|
export declare class BrowserAccessibility implements BrowserAccessibilityInterface {
|
|
134
151
|
#private;
|
|
@@ -136,24 +153,24 @@ export declare class BrowserAccessibility implements BrowserAccessibilityInterfa
|
|
|
136
153
|
snapshot(options?: BrowserAccessibilityOptions): Promise<BrowserAccessibilitySnapshot>;
|
|
137
154
|
}
|
|
138
155
|
|
|
139
|
-
/**
|
|
156
|
+
/** Inspects the accessibility tree. */
|
|
140
157
|
export declare interface BrowserAccessibilityInterface {
|
|
141
158
|
snapshot(options?: BrowserAccessibilityOptions): Promise<BrowserAccessibilitySnapshot>;
|
|
142
159
|
}
|
|
143
160
|
|
|
144
|
-
/**
|
|
161
|
+
/** Describes the options for an accessibility snapshot. */
|
|
145
162
|
export declare interface BrowserAccessibilityOptions {
|
|
146
163
|
readonly root?: number;
|
|
147
164
|
readonly depth?: number;
|
|
148
165
|
}
|
|
149
166
|
|
|
150
|
-
/**
|
|
167
|
+
/** Describes a serializable accessibility-tree snapshot. */
|
|
151
168
|
export declare interface BrowserAccessibilitySnapshot {
|
|
152
169
|
readonly roots: readonly string[];
|
|
153
170
|
readonly nodes: readonly BrowserAXNode[];
|
|
154
171
|
}
|
|
155
172
|
|
|
156
|
-
/**
|
|
173
|
+
/** Describes the actionability checks performed before locator input. */
|
|
157
174
|
export declare interface BrowserActionabilityOptions {
|
|
158
175
|
readonly visible?: boolean;
|
|
159
176
|
readonly stable?: boolean;
|
|
@@ -164,24 +181,22 @@ export declare interface BrowserActionabilityOptions {
|
|
|
164
181
|
}
|
|
165
182
|
|
|
166
183
|
/**
|
|
167
|
-
*
|
|
184
|
+
* Describes the options for element interaction (click, fill, select, wait).
|
|
168
185
|
*
|
|
169
186
|
* @remarks
|
|
170
187
|
* - `timeout` — maximum time to wait for the selector in milliseconds
|
|
188
|
+
* - `strict` — require the selector to resolve to exactly one element
|
|
189
|
+
* - `force` — skip the actionability checks
|
|
190
|
+
* - `trial` — run the checks and stop before dispatching input
|
|
171
191
|
*/
|
|
172
192
|
export declare interface BrowserActionOptions {
|
|
173
193
|
readonly timeout?: number;
|
|
174
194
|
readonly strict?: boolean;
|
|
175
195
|
readonly force?: boolean;
|
|
176
196
|
readonly trial?: boolean;
|
|
177
|
-
readonly delay?: number;
|
|
178
|
-
readonly button?: BrowserMouseButton;
|
|
179
|
-
readonly count?: number;
|
|
180
|
-
readonly position?: BrowserPoint;
|
|
181
|
-
readonly steps?: number;
|
|
182
197
|
}
|
|
183
198
|
|
|
184
|
-
/**
|
|
199
|
+
/** Represents one decoded Chromium accessibility node. */
|
|
185
200
|
export declare interface BrowserAXNode {
|
|
186
201
|
readonly id: string;
|
|
187
202
|
readonly parent: string | undefined;
|
|
@@ -196,7 +211,7 @@ export declare interface BrowserAXNode {
|
|
|
196
211
|
readonly properties: Readonly<Record<string, unknown>>;
|
|
197
212
|
}
|
|
198
213
|
|
|
199
|
-
/**
|
|
214
|
+
/** Describes a decoded page-to-host binding call. */
|
|
200
215
|
export declare interface BrowserBindingCall {
|
|
201
216
|
readonly id: string;
|
|
202
217
|
readonly name: string;
|
|
@@ -204,17 +219,39 @@ export declare interface BrowserBindingCall {
|
|
|
204
219
|
readonly context: number;
|
|
205
220
|
}
|
|
206
221
|
|
|
207
|
-
/**
|
|
222
|
+
/** Runs a host function exposed into page JavaScript. */
|
|
208
223
|
export declare type BrowserBindingHandler = (...args: unknown[]) => unknown | Promise<unknown>;
|
|
209
224
|
|
|
210
|
-
/**
|
|
225
|
+
/** Describes a parsed keyboard chord. */
|
|
211
226
|
export declare interface BrowserChord {
|
|
212
227
|
readonly modifiers: readonly string[];
|
|
213
228
|
readonly key: string;
|
|
214
229
|
}
|
|
215
230
|
|
|
216
231
|
/**
|
|
217
|
-
*
|
|
232
|
+
* Describes the options for a trusted mouse click.
|
|
233
|
+
*
|
|
234
|
+
* @remarks
|
|
235
|
+
* - `button` — pressed mouse button (default `'left'`)
|
|
236
|
+
* - `count` — click count reported to the page (default `1`)
|
|
237
|
+
*/
|
|
238
|
+
export declare interface BrowserClickOptions extends BrowserInputOptions {
|
|
239
|
+
readonly button?: BrowserMouseButton;
|
|
240
|
+
readonly count?: number;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Controls the Chromium virtual-time budget for deterministic page timers.
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* ```ts
|
|
248
|
+
* import { BrowserClock } from '@orkestrel/browser'
|
|
249
|
+
*
|
|
250
|
+
* const clock = new BrowserClock(page)
|
|
251
|
+
* await clock.install(Date.UTC(2026, 0, 1))
|
|
252
|
+
* await clock.advance(5_000)
|
|
253
|
+
* await clock.uninstall()
|
|
254
|
+
* ```
|
|
218
255
|
*/
|
|
219
256
|
export declare class BrowserClock implements BrowserClockInterface {
|
|
220
257
|
#private;
|
|
@@ -227,7 +264,7 @@ export declare class BrowserClock implements BrowserClockInterface {
|
|
|
227
264
|
uninstall(): Promise<void>;
|
|
228
265
|
}
|
|
229
266
|
|
|
230
|
-
/** Chromium virtual
|
|
267
|
+
/** Controls Chromium virtual time for deterministic page timers. */
|
|
231
268
|
export declare interface BrowserClockInterface {
|
|
232
269
|
readonly installed: boolean;
|
|
233
270
|
install(time?: number): Promise<void>;
|
|
@@ -239,10 +276,20 @@ export declare interface BrowserClockInterface {
|
|
|
239
276
|
|
|
240
277
|
/**
|
|
241
278
|
* Records page navigation and form interactions and compiles replayable scripts.
|
|
279
|
+
*
|
|
280
|
+
* @example
|
|
281
|
+
* ```ts
|
|
282
|
+
* import { BrowserCodegen } from '@orkestrel/browser'
|
|
283
|
+
*
|
|
284
|
+
* const codegen = new BrowserCodegen(client, 'session-1')
|
|
285
|
+
* await codegen.start()
|
|
286
|
+
* const actions = await codegen.stop()
|
|
287
|
+
* const script = codegen.script({ language: 'typescript' })
|
|
288
|
+
* ```
|
|
242
289
|
*/
|
|
243
290
|
export declare class BrowserCodegen implements BrowserCodegenInterface {
|
|
244
291
|
#private;
|
|
245
|
-
constructor(client: CDPClientInterface,
|
|
292
|
+
constructor(client: CDPClientInterface, session: string, options?: BrowserCodegenOptions);
|
|
246
293
|
get emitter(): EmitterInterface<BrowserCodegenEventMap>;
|
|
247
294
|
get started(): boolean;
|
|
248
295
|
start(): Promise<void>;
|
|
@@ -253,7 +300,7 @@ export declare class BrowserCodegen implements BrowserCodegenInterface {
|
|
|
253
300
|
destroy(): Promise<void>;
|
|
254
301
|
}
|
|
255
302
|
|
|
256
|
-
/**
|
|
303
|
+
/** Represents one recorded browser action captured during a codegen session. */
|
|
257
304
|
export declare type BrowserCodegenAction = {
|
|
258
305
|
readonly action: 'navigate';
|
|
259
306
|
readonly url: string;
|
|
@@ -271,7 +318,7 @@ export declare type BrowserCodegenAction = {
|
|
|
271
318
|
};
|
|
272
319
|
|
|
273
320
|
/**
|
|
274
|
-
*
|
|
321
|
+
* Maps the events a {@link BrowserCodegenInterface} emits.
|
|
275
322
|
*
|
|
276
323
|
* @remarks
|
|
277
324
|
* - `start` — recording started
|
|
@@ -311,11 +358,11 @@ export declare interface BrowserCodegenInterface {
|
|
|
311
358
|
destroy(): Promise<void>;
|
|
312
359
|
}
|
|
313
360
|
|
|
314
|
-
/**
|
|
361
|
+
/** Names the target language for a compiled codegen script. */
|
|
315
362
|
export declare type BrowserCodegenLanguage = 'javascript' | 'typescript';
|
|
316
363
|
|
|
317
364
|
/**
|
|
318
|
-
*
|
|
365
|
+
* Describes the options for creating a BrowserCodegen recorder.
|
|
319
366
|
*
|
|
320
367
|
* @remarks
|
|
321
368
|
* - `on` — initial event listeners wired at construction
|
|
@@ -327,7 +374,7 @@ export declare interface BrowserCodegenOptions {
|
|
|
327
374
|
}
|
|
328
375
|
|
|
329
376
|
/**
|
|
330
|
-
*
|
|
377
|
+
* Describes the options for compiling recorded actions into a script.
|
|
331
378
|
*
|
|
332
379
|
* @remarks
|
|
333
380
|
* - `language` — target output language (default `'javascript'`)
|
|
@@ -336,7 +383,7 @@ export declare interface BrowserCodegenScriptOptions {
|
|
|
336
383
|
readonly language?: BrowserCodegenLanguage;
|
|
337
384
|
}
|
|
338
385
|
|
|
339
|
-
/**
|
|
386
|
+
/** Represents one console API call. */
|
|
340
387
|
export declare interface BrowserConsoleMessage {
|
|
341
388
|
readonly level: string;
|
|
342
389
|
readonly text: string;
|
|
@@ -346,7 +393,7 @@ export declare interface BrowserConsoleMessage {
|
|
|
346
393
|
}
|
|
347
394
|
|
|
348
395
|
/**
|
|
349
|
-
*
|
|
396
|
+
* Describes the result of page content extraction.
|
|
350
397
|
*
|
|
351
398
|
* @remarks
|
|
352
399
|
* - `url` — current page URL after navigation
|
|
@@ -363,10 +410,19 @@ export declare interface BrowserContentResult {
|
|
|
363
410
|
|
|
364
411
|
/**
|
|
365
412
|
* Owns pages and shared state inside one Chromium browser context.
|
|
413
|
+
*
|
|
414
|
+
* @example
|
|
415
|
+
* ```ts
|
|
416
|
+
* import { BrowserContext } from '@orkestrel/browser'
|
|
417
|
+
*
|
|
418
|
+
* const context = new BrowserContext(client)
|
|
419
|
+
* const page = await context.create({ url: 'https://example.com' })
|
|
420
|
+
* await context.destroy()
|
|
421
|
+
* ```
|
|
366
422
|
*/
|
|
367
423
|
export declare class BrowserContext implements BrowserContextInterface {
|
|
368
424
|
#private;
|
|
369
|
-
constructor(client: CDPClientInterface, id?: string, viewport?: BrowserViewport, writer?:
|
|
425
|
+
constructor(client: CDPClientInterface, id?: string, viewport?: BrowserViewport, writer?: BrowserWriterInterface, emulation?: BrowserEmulationOptions, downloads?: BrowserDownloadOptions, options?: BrowserContextOptions);
|
|
370
426
|
get emitter(): EmitterInterface<BrowserContextEventMap>;
|
|
371
427
|
get id(): string | undefined;
|
|
372
428
|
get cookies(): BrowserCookieManagerInterface;
|
|
@@ -381,14 +437,14 @@ export declare class BrowserContext implements BrowserContextInterface {
|
|
|
381
437
|
close(): Promise<void>;
|
|
382
438
|
}
|
|
383
439
|
|
|
384
|
-
/**
|
|
440
|
+
/** Maps the browser-context lifecycle events. */
|
|
385
441
|
export declare type BrowserContextEventMap = {
|
|
386
442
|
readonly page: readonly [page: BrowserPageInterface];
|
|
387
443
|
readonly close: readonly [];
|
|
388
444
|
};
|
|
389
445
|
|
|
390
446
|
/**
|
|
391
|
-
*
|
|
447
|
+
* Represents an isolated browser session over a CDP browser context.
|
|
392
448
|
*
|
|
393
449
|
* @remarks
|
|
394
450
|
* Follows the manager accessor pattern:
|
|
@@ -416,15 +472,27 @@ export declare interface BrowserContextInterface {
|
|
|
416
472
|
close(): Promise<void>;
|
|
417
473
|
}
|
|
418
474
|
|
|
419
|
-
/**
|
|
475
|
+
/**
|
|
476
|
+
* Describes the options for creating and configuring an isolated browser context.
|
|
477
|
+
*
|
|
478
|
+
* @remarks
|
|
479
|
+
* - `on` — initial event listeners wired at construction
|
|
480
|
+
* - `error` — observer error handler forwarded to the emitter
|
|
481
|
+
* - `proxy` — proxy server and bypass list for the context
|
|
482
|
+
* - `origins` — origins granted universal network access
|
|
483
|
+
* - `downloads` — download policy for the context
|
|
484
|
+
* - `emulation` — emulation overrides inherited by every page of the context
|
|
485
|
+
*/
|
|
420
486
|
export declare interface BrowserContextOptions {
|
|
487
|
+
readonly on?: EmitterHooks<BrowserContextEventMap>;
|
|
488
|
+
readonly error?: EmitterErrorHandler;
|
|
421
489
|
readonly proxy?: BrowserProxy;
|
|
422
490
|
readonly origins?: readonly string[];
|
|
423
491
|
readonly downloads?: BrowserDownloadOptions;
|
|
424
492
|
readonly emulation?: BrowserEmulationOptions;
|
|
425
493
|
}
|
|
426
494
|
|
|
427
|
-
/**
|
|
495
|
+
/** Represents one cookie returned from a browser context. */
|
|
428
496
|
export declare interface BrowserCookie {
|
|
429
497
|
readonly name: string;
|
|
430
498
|
readonly value: string;
|
|
@@ -437,14 +505,14 @@ export declare interface BrowserCookie {
|
|
|
437
505
|
readonly partition: BrowserCookiePartition | undefined;
|
|
438
506
|
}
|
|
439
507
|
|
|
440
|
-
/**
|
|
508
|
+
/** Describes optional narrowing criteria for clearing context cookies. */
|
|
441
509
|
export declare interface BrowserCookieFilter {
|
|
442
510
|
readonly name?: string;
|
|
443
511
|
readonly domain?: string;
|
|
444
512
|
readonly path?: string;
|
|
445
513
|
}
|
|
446
514
|
|
|
447
|
-
/**
|
|
515
|
+
/** Describes the input used to create or replace a browser cookie. */
|
|
448
516
|
export declare interface BrowserCookieInput {
|
|
449
517
|
readonly name: string;
|
|
450
518
|
readonly value: string;
|
|
@@ -460,31 +528,49 @@ export declare interface BrowserCookieInput {
|
|
|
460
528
|
}
|
|
461
529
|
|
|
462
530
|
/**
|
|
463
|
-
*
|
|
531
|
+
* Performs cookie operations isolated to one browser context.
|
|
532
|
+
*
|
|
533
|
+
* @example
|
|
534
|
+
* ```ts
|
|
535
|
+
* import { BrowserCookieManager } from '@orkestrel/browser'
|
|
536
|
+
*
|
|
537
|
+
* const cookies = new BrowserCookieManager(client)
|
|
538
|
+
* await cookies.set([{ name: 'session', value: 'value', url: 'https://example.com/' }])
|
|
539
|
+
* const current = await cookies.cookies(['https://example.com/'])
|
|
540
|
+
* ```
|
|
464
541
|
*/
|
|
465
542
|
export declare class BrowserCookieManager implements BrowserCookieManagerInterface {
|
|
466
543
|
#private;
|
|
467
544
|
constructor(client: CDPClientInterface, context?: string);
|
|
468
|
-
|
|
545
|
+
cookies(urls?: readonly string[]): Promise<readonly BrowserCookie[]>;
|
|
469
546
|
set(cookies: readonly BrowserCookieInput[]): Promise<void>;
|
|
470
547
|
clear(filter?: BrowserCookieFilter): Promise<void>;
|
|
471
548
|
}
|
|
472
549
|
|
|
473
|
-
/**
|
|
550
|
+
/** Provides cookie operations scoped to one browser context. */
|
|
474
551
|
export declare interface BrowserCookieManagerInterface {
|
|
475
|
-
|
|
552
|
+
cookies(urls?: readonly string[]): Promise<readonly BrowserCookie[]>;
|
|
476
553
|
set(cookies: readonly BrowserCookieInput[]): Promise<void>;
|
|
477
554
|
clear(filter?: BrowserCookieFilter): Promise<void>;
|
|
478
555
|
}
|
|
479
556
|
|
|
480
|
-
/**
|
|
557
|
+
/** Describes a cookie partition key used by CHIPS-partitioned cookies. */
|
|
481
558
|
export declare interface BrowserCookiePartition {
|
|
482
559
|
readonly site: string;
|
|
483
560
|
readonly ancestor?: boolean;
|
|
484
561
|
}
|
|
485
562
|
|
|
486
563
|
/**
|
|
487
|
-
* JavaScript precise coverage and CSS rule usage for one page target.
|
|
564
|
+
* Collects JavaScript precise coverage and CSS rule usage for one page target.
|
|
565
|
+
*
|
|
566
|
+
* @example
|
|
567
|
+
* ```ts
|
|
568
|
+
* import { BrowserCoverage } from '@orkestrel/browser'
|
|
569
|
+
*
|
|
570
|
+
* const coverage = new BrowserCoverage(page)
|
|
571
|
+
* await coverage.start({ javascript: true, css: true })
|
|
572
|
+
* const usage = await coverage.stop() // { scripts, styles }
|
|
573
|
+
* ```
|
|
488
574
|
*/
|
|
489
575
|
export declare class BrowserCoverage implements BrowserCoverageInterface {
|
|
490
576
|
#private;
|
|
@@ -495,7 +581,7 @@ export declare class BrowserCoverage implements BrowserCoverageInterface {
|
|
|
495
581
|
destroy(): Promise<void>;
|
|
496
582
|
}
|
|
497
583
|
|
|
498
|
-
/**
|
|
584
|
+
/** Drives the coverage capture lifecycle. */
|
|
499
585
|
export declare interface BrowserCoverageInterface {
|
|
500
586
|
readonly active: boolean;
|
|
501
587
|
start(options?: BrowserCoverageOptions): Promise<void>;
|
|
@@ -503,69 +589,67 @@ export declare interface BrowserCoverageInterface {
|
|
|
503
589
|
destroy(): Promise<void>;
|
|
504
590
|
}
|
|
505
591
|
|
|
506
|
-
/**
|
|
592
|
+
/** Describes the options for a coverage capture. */
|
|
507
593
|
export declare interface BrowserCoverageOptions {
|
|
508
594
|
readonly javascript?: boolean;
|
|
509
595
|
readonly css?: boolean;
|
|
510
596
|
readonly detailed?: boolean;
|
|
511
597
|
}
|
|
512
598
|
|
|
513
|
-
/**
|
|
599
|
+
/** Describes a source range reported by JavaScript or CSS coverage. */
|
|
514
600
|
export declare interface BrowserCoverageRange {
|
|
515
601
|
readonly start: number;
|
|
516
602
|
readonly end: number;
|
|
517
603
|
readonly count: number;
|
|
518
604
|
}
|
|
519
605
|
|
|
520
|
-
/**
|
|
606
|
+
/** Describes combined JavaScript and CSS usage. */
|
|
521
607
|
export declare interface BrowserCoverageResult {
|
|
522
608
|
readonly scripts: readonly BrowserScriptCoverage[];
|
|
523
609
|
readonly styles: readonly BrowserStyleCoverage[];
|
|
524
610
|
}
|
|
525
611
|
|
|
526
|
-
/** HTTP basic-auth credentials applied to context pages. */
|
|
612
|
+
/** Describes the HTTP basic-auth credentials applied to context pages. */
|
|
527
613
|
export declare interface BrowserCredentials {
|
|
528
614
|
readonly username: string;
|
|
529
615
|
readonly password: string;
|
|
530
616
|
}
|
|
531
617
|
|
|
532
618
|
/**
|
|
533
|
-
*
|
|
619
|
+
* Groups the diagnostic subentities beneath one page.
|
|
620
|
+
*
|
|
621
|
+
* @example
|
|
622
|
+
* ```ts
|
|
623
|
+
* import { BrowserDiagnostics } from '@orkestrel/browser'
|
|
624
|
+
*
|
|
625
|
+
* const diagnostics = new BrowserDiagnostics(page)
|
|
626
|
+
* const metrics = await diagnostics.performance.metrics()
|
|
627
|
+
* await diagnostics.destroy()
|
|
628
|
+
* ```
|
|
534
629
|
*/
|
|
535
630
|
export declare class BrowserDiagnostics implements BrowserDiagnosticsInterface {
|
|
536
631
|
#private;
|
|
537
|
-
constructor(frame: BrowserFrameInterface, writer?:
|
|
632
|
+
constructor(frame: BrowserFrameInterface, writer?: BrowserWriterInterface);
|
|
538
633
|
get tracing(): BrowserTracingInterface;
|
|
539
634
|
get coverage(): BrowserCoverageInterface;
|
|
540
635
|
get performance(): BrowserPerformanceInterface;
|
|
636
|
+
get profiler(): BrowserProfilerInterface;
|
|
541
637
|
destroy(): Promise<void>;
|
|
542
638
|
}
|
|
543
639
|
|
|
544
|
-
/**
|
|
640
|
+
/** Groups the diagnostics by capability. */
|
|
545
641
|
export declare interface BrowserDiagnosticsInterface {
|
|
546
642
|
readonly tracing: BrowserTracingInterface;
|
|
547
643
|
readonly coverage: BrowserCoverageInterface;
|
|
548
644
|
readonly performance: BrowserPerformanceInterface;
|
|
645
|
+
readonly profiler: BrowserProfilerInterface;
|
|
549
646
|
destroy(): Promise<void>;
|
|
550
647
|
}
|
|
551
648
|
|
|
552
|
-
/**
|
|
553
|
-
* One JavaScript dialog awaiting a user decision.
|
|
554
|
-
*/
|
|
555
|
-
export declare class BrowserDialog implements BrowserDialogInterface {
|
|
556
|
-
#private;
|
|
557
|
-
constructor(frame: BrowserFrameInterface, category: BrowserDialogCategory, message: string, value: string);
|
|
558
|
-
get category(): BrowserDialogCategory;
|
|
559
|
-
get message(): string;
|
|
560
|
-
get default(): string;
|
|
561
|
-
accept(value?: string): Promise<void>;
|
|
562
|
-
dismiss(): Promise<void>;
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
/** JavaScript dialog category reported by Chromium. */
|
|
649
|
+
/** Names a JavaScript dialog category reported by Chromium. */
|
|
566
650
|
export declare type BrowserDialogCategory = 'alert' | 'confirm' | 'prompt' | 'beforeunload';
|
|
567
651
|
|
|
568
|
-
/**
|
|
652
|
+
/** Represents one active JavaScript dialog. */
|
|
569
653
|
export declare interface BrowserDialogInterface {
|
|
570
654
|
readonly category: BrowserDialogCategory;
|
|
571
655
|
readonly message: string;
|
|
@@ -574,7 +658,7 @@ export declare interface BrowserDialogInterface {
|
|
|
574
658
|
dismiss(): Promise<void>;
|
|
575
659
|
}
|
|
576
660
|
|
|
577
|
-
/**
|
|
661
|
+
/** Represents one document captured in a CDP DOM snapshot. */
|
|
578
662
|
export declare interface BrowserDocument {
|
|
579
663
|
readonly index: number;
|
|
580
664
|
readonly frame: string;
|
|
@@ -586,32 +670,21 @@ export declare interface BrowserDocument {
|
|
|
586
670
|
readonly height: number | undefined;
|
|
587
671
|
}
|
|
588
672
|
|
|
589
|
-
/**
|
|
590
|
-
* One Chromium download and its progress lifecycle.
|
|
591
|
-
*/
|
|
592
|
-
export declare class BrowserDownload implements BrowserDownloadInterface {
|
|
593
|
-
#private;
|
|
594
|
-
constructor(client: CDPClientInterface, id: string, url: string, name: string, context?: string);
|
|
595
|
-
get emitter(): EmitterInterface<BrowserDownloadEventMap>;
|
|
596
|
-
get id(): string;
|
|
597
|
-
get url(): string;
|
|
598
|
-
get name(): string;
|
|
599
|
-
get status(): BrowserDownloadStatus;
|
|
600
|
-
get received(): number;
|
|
601
|
-
get total(): number;
|
|
602
|
-
get path(): string | undefined;
|
|
603
|
-
cancel(): Promise<void>;
|
|
604
|
-
update(progress: BrowserDownloadProgress): void;
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
/** Download progress events. */
|
|
673
|
+
/** Maps the download progress events. */
|
|
608
674
|
export declare type BrowserDownloadEventMap = {
|
|
609
675
|
readonly progress: readonly [received: number, total: number];
|
|
610
676
|
readonly complete: readonly [path: string | undefined];
|
|
611
677
|
readonly cancel: readonly [];
|
|
612
678
|
};
|
|
613
679
|
|
|
614
|
-
/**
|
|
680
|
+
/**
|
|
681
|
+
* Represents one context download tracked through Chromium's Browser domain.
|
|
682
|
+
*
|
|
683
|
+
* @remarks
|
|
684
|
+
* Progress arrives from the owning page, which drives the concrete
|
|
685
|
+
* `BrowserDownload`. `update` is on this contract because the class exposes
|
|
686
|
+
* exactly its interface methods.
|
|
687
|
+
*/
|
|
615
688
|
export declare interface BrowserDownloadInterface {
|
|
616
689
|
readonly emitter: EmitterInterface<BrowserDownloadEventMap>;
|
|
617
690
|
readonly id: string;
|
|
@@ -622,16 +695,17 @@ export declare interface BrowserDownloadInterface {
|
|
|
622
695
|
readonly total: number;
|
|
623
696
|
readonly path: string | undefined;
|
|
624
697
|
cancel(): Promise<void>;
|
|
698
|
+
/** Records one step of the download's progress. The owning page drives it. */
|
|
625
699
|
update(progress: BrowserDownloadProgress): void;
|
|
626
700
|
}
|
|
627
701
|
|
|
628
|
-
/**
|
|
702
|
+
/** Describes the download policy for a browser context. */
|
|
629
703
|
export declare interface BrowserDownloadOptions {
|
|
630
704
|
readonly path: string;
|
|
631
705
|
readonly named?: boolean;
|
|
632
706
|
}
|
|
633
707
|
|
|
634
|
-
/**
|
|
708
|
+
/** Describes a protocol-neutral download progress update. */
|
|
635
709
|
export declare interface BrowserDownloadProgress {
|
|
636
710
|
readonly status: BrowserDownloadStatus;
|
|
637
711
|
readonly received: number;
|
|
@@ -639,7 +713,7 @@ export declare interface BrowserDownloadProgress {
|
|
|
639
713
|
readonly path?: string;
|
|
640
714
|
}
|
|
641
715
|
|
|
642
|
-
/**
|
|
716
|
+
/** Describes a decoded `Browser.downloadWillBegin` event. */
|
|
643
717
|
export declare interface BrowserDownloadStart {
|
|
644
718
|
readonly id: string;
|
|
645
719
|
readonly url: string;
|
|
@@ -647,28 +721,49 @@ export declare interface BrowserDownloadStart {
|
|
|
647
721
|
readonly frame: string;
|
|
648
722
|
}
|
|
649
723
|
|
|
650
|
-
/**
|
|
724
|
+
/** Names a download lifecycle phase. */
|
|
651
725
|
export declare type BrowserDownloadStatus = 'pending' | 'complete' | 'cancelled';
|
|
652
726
|
|
|
653
727
|
/**
|
|
654
|
-
*
|
|
728
|
+
* Describes the options for a trusted mouse drag.
|
|
729
|
+
*
|
|
730
|
+
* @remarks
|
|
731
|
+
* - `button` — pressed mouse button (default `'left'`)
|
|
732
|
+
* - `steps` — interpolated move events between start and end (default `10`)
|
|
733
|
+
*/
|
|
734
|
+
export declare interface BrowserDragOptions extends BrowserInputOptions {
|
|
735
|
+
readonly button?: BrowserMouseButton;
|
|
736
|
+
readonly steps?: number;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* Applies rendering, identity, location, and network emulation for context pages.
|
|
741
|
+
*
|
|
742
|
+
* @example
|
|
743
|
+
* ```ts
|
|
744
|
+
* import { BrowserEmulationManager } from '@orkestrel/browser'
|
|
745
|
+
*
|
|
746
|
+
* const emulation = new BrowserEmulationManager(() => context.pages())
|
|
747
|
+
* await emulation.apply({ locale: 'en-US', media: { scheme: 'dark' } })
|
|
748
|
+
* await emulation.clear()
|
|
749
|
+
* ```
|
|
655
750
|
*/
|
|
656
751
|
export declare class BrowserEmulationManager implements BrowserEmulationManagerInterface {
|
|
657
752
|
#private;
|
|
658
|
-
constructor(pages:
|
|
753
|
+
constructor(pages: BrowserPagesFunction, options?: BrowserEmulationOptions);
|
|
659
754
|
apply(options: BrowserEmulationOptions): Promise<void>;
|
|
660
755
|
clear(): Promise<void>;
|
|
661
756
|
attach(page: BrowserPageInterface): Promise<void>;
|
|
662
757
|
}
|
|
663
758
|
|
|
664
|
-
/**
|
|
759
|
+
/** Configures context-scoped emulation. */
|
|
665
760
|
export declare interface BrowserEmulationManagerInterface {
|
|
666
761
|
apply(options: BrowserEmulationOptions): Promise<void>;
|
|
667
762
|
clear(): Promise<void>;
|
|
668
763
|
attach(page: BrowserPageInterface): Promise<void>;
|
|
669
764
|
}
|
|
670
765
|
|
|
671
|
-
/**
|
|
766
|
+
/** Describes network and rendering overrides inherited by context pages. */
|
|
672
767
|
export declare interface BrowserEmulationOptions {
|
|
673
768
|
readonly viewport?: BrowserViewport;
|
|
674
769
|
readonly user?: BrowserUserAgent;
|
|
@@ -682,10 +777,10 @@ export declare interface BrowserEmulationOptions {
|
|
|
682
777
|
}
|
|
683
778
|
|
|
684
779
|
/**
|
|
685
|
-
*
|
|
780
|
+
* Represents the base error for all browser automation operations.
|
|
686
781
|
*
|
|
687
782
|
* @remarks
|
|
688
|
-
* Carries a machine-readable `code` and optional `context`
|
|
783
|
+
* Carries a machine-readable `code` and optional `context` so
|
|
689
784
|
* callers can branch in a `catch` without parsing message strings.
|
|
690
785
|
*/
|
|
691
786
|
export declare class BrowserError extends Error {
|
|
@@ -694,30 +789,24 @@ export declare class BrowserError extends Error {
|
|
|
694
789
|
constructor(message: string, code?: string, context?: Readonly<Record<string, unknown>>);
|
|
695
790
|
}
|
|
696
791
|
|
|
697
|
-
/**
|
|
698
|
-
* One intercepted file input selection.
|
|
699
|
-
*/
|
|
700
|
-
export declare class BrowserFileChooser implements BrowserFileChooserInterface {
|
|
701
|
-
#private;
|
|
702
|
-
constructor(frame: BrowserFrameInterface, backend: number, multiple: boolean);
|
|
703
|
-
get multiple(): boolean;
|
|
704
|
-
upload(files: readonly string[]): Promise<void>;
|
|
705
|
-
cancel(): Promise<void>;
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
/** One intercepted file chooser. */
|
|
792
|
+
/** Represents one intercepted file chooser. */
|
|
709
793
|
export declare interface BrowserFileChooserInterface {
|
|
710
794
|
readonly multiple: boolean;
|
|
711
795
|
upload(files: readonly string[]): Promise<void>;
|
|
712
796
|
cancel(): Promise<void>;
|
|
713
797
|
}
|
|
714
798
|
|
|
715
|
-
/** Options for filtering a locator. */
|
|
716
|
-
export declare interface BrowserFilterOptions extends BrowserLocatorFilter {
|
|
717
|
-
}
|
|
718
|
-
|
|
719
799
|
/**
|
|
720
|
-
*
|
|
800
|
+
* Represents one attached document frame, evaluated through its own CDP execution world.
|
|
801
|
+
*
|
|
802
|
+
* @example
|
|
803
|
+
* ```ts
|
|
804
|
+
* import { BrowserFrame } from '@orkestrel/browser'
|
|
805
|
+
*
|
|
806
|
+
* const frame = new BrowserFrame(client, 'session-1', 'frame-1', 'https://example.com')
|
|
807
|
+
* await frame.fill('[name=email]', 'ada@example.com')
|
|
808
|
+
* const title = await frame.title()
|
|
809
|
+
* ```
|
|
721
810
|
*/
|
|
722
811
|
export declare class BrowserFrame implements BrowserFrameInterface {
|
|
723
812
|
#private;
|
|
@@ -739,7 +828,7 @@ export declare class BrowserFrame implements BrowserFrameInterface {
|
|
|
739
828
|
evaluate(expression: string, timeout?: number): Promise<unknown>;
|
|
740
829
|
handle(expression: string): Promise<BrowserHandleInterface>;
|
|
741
830
|
wait(selector: string, options?: BrowserWaitOptions): Promise<void>;
|
|
742
|
-
send(method: string, params?: Readonly<Record<string, unknown>>,
|
|
831
|
+
send(method: string, params?: Readonly<Record<string, unknown>>, options?: BrowserSendOptions): Promise<unknown>;
|
|
743
832
|
subscribe(method: string, handler: CDPHandler): Promise<void>;
|
|
744
833
|
unsubscribe(method: string, handler: CDPHandler): Promise<void>;
|
|
745
834
|
save(path: string, _bytes: Uint8Array): Promise<void>;
|
|
@@ -748,7 +837,7 @@ export declare class BrowserFrame implements BrowserFrameInterface {
|
|
|
748
837
|
}
|
|
749
838
|
|
|
750
839
|
/**
|
|
751
|
-
*
|
|
840
|
+
* Describes serializable frame metadata decoded from CDP `Page.getFrameTree`.
|
|
752
841
|
*
|
|
753
842
|
* @remarks
|
|
754
843
|
* - `id` — the frame's CDP frame id
|
|
@@ -764,7 +853,7 @@ export declare interface BrowserFrameInfo {
|
|
|
764
853
|
}
|
|
765
854
|
|
|
766
855
|
/**
|
|
767
|
-
*
|
|
856
|
+
* Provides the operations shared by a top-level page and an iframe document.
|
|
768
857
|
*
|
|
769
858
|
* @remarks
|
|
770
859
|
* - `id` — CDP frame id
|
|
@@ -801,7 +890,7 @@ export declare interface BrowserFrameInterface {
|
|
|
801
890
|
evaluate(expression: string, timeout?: number): Promise<unknown>;
|
|
802
891
|
handle(expression: string): Promise<BrowserHandleInterface>;
|
|
803
892
|
wait(selector: string, options?: BrowserWaitOptions): Promise<void>;
|
|
804
|
-
send(method: string, params?: Readonly<Record<string, unknown>>,
|
|
893
|
+
send(method: string, params?: Readonly<Record<string, unknown>>, options?: BrowserSendOptions): Promise<unknown>;
|
|
805
894
|
subscribe(method: string, handler: CDPHandler): Promise<void>;
|
|
806
895
|
unsubscribe(method: string, handler: CDPHandler): Promise<void>;
|
|
807
896
|
save(path: string, bytes: Uint8Array): Promise<void>;
|
|
@@ -809,14 +898,14 @@ export declare interface BrowserFrameInterface {
|
|
|
809
898
|
update(url: string): void;
|
|
810
899
|
}
|
|
811
900
|
|
|
812
|
-
/**
|
|
901
|
+
/** Describes function coverage inside one script. */
|
|
813
902
|
export declare interface BrowserFunctionCoverage {
|
|
814
903
|
readonly name: string;
|
|
815
904
|
readonly ranges: readonly BrowserCoverageRange[];
|
|
816
905
|
readonly block: boolean;
|
|
817
906
|
}
|
|
818
907
|
|
|
819
|
-
/**
|
|
908
|
+
/** Describes a geographic location override. */
|
|
820
909
|
export declare interface BrowserGeolocation {
|
|
821
910
|
readonly latitude: number;
|
|
822
911
|
readonly longitude: number;
|
|
@@ -824,21 +913,7 @@ export declare interface BrowserGeolocation {
|
|
|
824
913
|
}
|
|
825
914
|
|
|
826
915
|
/**
|
|
827
|
-
*
|
|
828
|
-
*/
|
|
829
|
-
export declare class BrowserHandle implements BrowserHandleInterface {
|
|
830
|
-
#private;
|
|
831
|
-
constructor(client: CDPClientInterface, session: string, id: string);
|
|
832
|
-
get id(): string;
|
|
833
|
-
value(): Promise<unknown>;
|
|
834
|
-
call(declaration: string, args?: readonly unknown[]): Promise<unknown>;
|
|
835
|
-
property(name: string): Promise<BrowserHandleInterface | undefined>;
|
|
836
|
-
properties(): Promise<Readonly<Record<string, unknown>>>;
|
|
837
|
-
dispose(): Promise<void>;
|
|
838
|
-
}
|
|
839
|
-
|
|
840
|
-
/**
|
|
841
|
-
* A remote JavaScript object retained in one frame execution context.
|
|
916
|
+
* Represents a remote JavaScript object retained in one frame execution context.
|
|
842
917
|
*/
|
|
843
918
|
export declare interface BrowserHandleInterface {
|
|
844
919
|
readonly id: string;
|
|
@@ -849,12 +924,12 @@ export declare interface BrowserHandleInterface {
|
|
|
849
924
|
dispose(): Promise<void>;
|
|
850
925
|
}
|
|
851
926
|
|
|
852
|
-
/**
|
|
927
|
+
/** Describes the standards-shaped HAR 1.2 document produced by the network manager. */
|
|
853
928
|
export declare interface BrowserHAR {
|
|
854
929
|
readonly log: BrowserHARLog;
|
|
855
930
|
}
|
|
856
931
|
|
|
857
|
-
/**
|
|
932
|
+
/** Describes response body metadata in an HTTP archive. */
|
|
858
933
|
export declare interface BrowserHARContent {
|
|
859
934
|
readonly size: number;
|
|
860
935
|
readonly mimeType: string;
|
|
@@ -863,7 +938,7 @@ export declare interface BrowserHARContent {
|
|
|
863
938
|
}
|
|
864
939
|
|
|
865
940
|
/**
|
|
866
|
-
*
|
|
941
|
+
* Represents one cookie in an HTTP archive.
|
|
867
942
|
*
|
|
868
943
|
* @remarks
|
|
869
944
|
* HAR data preserves the official HAR 1.2 JSON field names. These compound
|
|
@@ -878,13 +953,13 @@ export declare interface BrowserHARCookie extends BrowserHARValue {
|
|
|
878
953
|
readonly secure?: boolean;
|
|
879
954
|
}
|
|
880
955
|
|
|
881
|
-
/**
|
|
956
|
+
/** Describes the tool identity embedded in an HTTP archive. */
|
|
882
957
|
export declare interface BrowserHARCreator {
|
|
883
958
|
readonly name: string;
|
|
884
959
|
readonly version: string;
|
|
885
960
|
}
|
|
886
961
|
|
|
887
|
-
/**
|
|
962
|
+
/** Represents one completed HTTP exchange in a HAR recording. */
|
|
888
963
|
export declare interface BrowserHAREntry {
|
|
889
964
|
readonly startedDateTime: string;
|
|
890
965
|
readonly time: number;
|
|
@@ -895,14 +970,14 @@ export declare interface BrowserHAREntry {
|
|
|
895
970
|
}
|
|
896
971
|
|
|
897
972
|
/**
|
|
898
|
-
*
|
|
973
|
+
* Converts HAR name/value headers into a Fetch-domain header record.
|
|
899
974
|
*
|
|
900
975
|
* @param headers - HAR header entries
|
|
901
976
|
* @returns Header record with later duplicate names replacing earlier values
|
|
902
977
|
*/
|
|
903
978
|
export declare function browserHARHeadersToRecord(headers: readonly BrowserHARValue[]): Readonly<Record<string, string>>;
|
|
904
979
|
|
|
905
|
-
/** HAR 1.2 log object. */
|
|
980
|
+
/** Describes the HAR 1.2 log object. */
|
|
906
981
|
export declare interface BrowserHARLog {
|
|
907
982
|
readonly version: '1.2';
|
|
908
983
|
readonly creator: BrowserHARCreator;
|
|
@@ -910,11 +985,20 @@ export declare interface BrowserHARLog {
|
|
|
910
985
|
}
|
|
911
986
|
|
|
912
987
|
/**
|
|
913
|
-
*
|
|
988
|
+
* Records and replays HTTP archives over one page network manager.
|
|
989
|
+
*
|
|
990
|
+
* @example
|
|
991
|
+
* ```ts
|
|
992
|
+
* import { BrowserHARManager } from '@orkestrel/browser'
|
|
993
|
+
*
|
|
994
|
+
* const har = new BrowserHARManager(page.network)
|
|
995
|
+
* await har.start({ content: true })
|
|
996
|
+
* const archive = await har.stop() // { log: { version: '1.2', creator, entries } }
|
|
997
|
+
* ```
|
|
914
998
|
*/
|
|
915
999
|
export declare class BrowserHARManager implements BrowserHARManagerInterface {
|
|
916
1000
|
#private;
|
|
917
|
-
constructor(network: BrowserNetworkManagerInterface, writer?:
|
|
1001
|
+
constructor(network: BrowserNetworkManagerInterface, writer?: BrowserWriterInterface);
|
|
918
1002
|
get recording(): boolean;
|
|
919
1003
|
start(options?: BrowserHAROptions): Promise<void>;
|
|
920
1004
|
stop(): Promise<BrowserHAR>;
|
|
@@ -922,7 +1006,7 @@ export declare class BrowserHARManager implements BrowserHARManagerInterface {
|
|
|
922
1006
|
clear(): Promise<void>;
|
|
923
1007
|
}
|
|
924
1008
|
|
|
925
|
-
/** HAR recording and replay operations. */
|
|
1009
|
+
/** Provides HAR recording and replay operations. */
|
|
926
1010
|
export declare interface BrowserHARManagerInterface {
|
|
927
1011
|
readonly recording: boolean;
|
|
928
1012
|
start(options?: BrowserHAROptions): Promise<void>;
|
|
@@ -931,31 +1015,31 @@ export declare interface BrowserHARManagerInterface {
|
|
|
931
1015
|
clear(): Promise<void>;
|
|
932
1016
|
}
|
|
933
1017
|
|
|
934
|
-
/** HAR recording
|
|
1018
|
+
/** Describes the options for a HAR recording. */
|
|
935
1019
|
export declare interface BrowserHAROptions {
|
|
936
1020
|
readonly path?: string;
|
|
937
1021
|
readonly content?: boolean;
|
|
938
1022
|
}
|
|
939
1023
|
|
|
940
|
-
/**
|
|
1024
|
+
/** Holds recording state until a request finishes; a new value replaces it on each update. */
|
|
941
1025
|
export declare interface BrowserHARPending {
|
|
942
1026
|
readonly request: BrowserRequest;
|
|
943
1027
|
readonly started: number;
|
|
944
1028
|
readonly response: BrowserResponse | undefined;
|
|
945
1029
|
}
|
|
946
1030
|
|
|
947
|
-
/**
|
|
1031
|
+
/** Describes request body metadata in an HTTP archive. */
|
|
948
1032
|
export declare interface BrowserHARPost {
|
|
949
1033
|
readonly mimeType: string;
|
|
950
1034
|
readonly text: string;
|
|
951
1035
|
}
|
|
952
1036
|
|
|
953
|
-
/** HAR replay behavior. */
|
|
1037
|
+
/** Describes HAR replay behavior. */
|
|
954
1038
|
export declare interface BrowserHARReplayOptions {
|
|
955
1039
|
readonly fallback?: boolean;
|
|
956
1040
|
}
|
|
957
1041
|
|
|
958
|
-
/** HAR 1.2 request entry. */
|
|
1042
|
+
/** Describes a HAR 1.2 request entry. */
|
|
959
1043
|
export declare interface BrowserHARRequest {
|
|
960
1044
|
readonly method: string;
|
|
961
1045
|
readonly url: string;
|
|
@@ -968,7 +1052,7 @@ export declare interface BrowserHARRequest {
|
|
|
968
1052
|
readonly bodySize: number;
|
|
969
1053
|
}
|
|
970
1054
|
|
|
971
|
-
/** HAR 1.2 response entry. */
|
|
1055
|
+
/** Describes a HAR 1.2 response entry. */
|
|
972
1056
|
export declare interface BrowserHARResponse {
|
|
973
1057
|
readonly status: number;
|
|
974
1058
|
readonly statusText: string;
|
|
@@ -981,7 +1065,7 @@ export declare interface BrowserHARResponse {
|
|
|
981
1065
|
readonly bodySize: number;
|
|
982
1066
|
}
|
|
983
1067
|
|
|
984
|
-
/** HAR 1.2 phase timings in milliseconds. */
|
|
1068
|
+
/** Holds HAR 1.2 phase timings in milliseconds. */
|
|
985
1069
|
export declare interface BrowserHARTimings {
|
|
986
1070
|
readonly blocked: number;
|
|
987
1071
|
readonly dns: number;
|
|
@@ -992,21 +1076,31 @@ export declare interface BrowserHARTimings {
|
|
|
992
1076
|
readonly ssl: number;
|
|
993
1077
|
}
|
|
994
1078
|
|
|
995
|
-
/**
|
|
1079
|
+
/** Represents one name/value pair in an HTTP archive. */
|
|
996
1080
|
export declare interface BrowserHARValue {
|
|
997
1081
|
readonly name: string;
|
|
998
1082
|
readonly value: string;
|
|
999
1083
|
}
|
|
1000
1084
|
|
|
1001
1085
|
/**
|
|
1002
|
-
*
|
|
1086
|
+
* Converts a header record to Fetch-domain name/value entries.
|
|
1003
1087
|
*
|
|
1004
1088
|
* @param headers - Header record
|
|
1005
1089
|
* @returns Protocol header entries
|
|
1006
1090
|
*/
|
|
1007
1091
|
export declare function browserHeadersToProtocol(headers: Readonly<Record<string, string>>): ReadonlyArray<Readonly<Record<string, string>>>;
|
|
1008
1092
|
|
|
1009
|
-
/**
|
|
1093
|
+
/**
|
|
1094
|
+
* Describes the options shared by every trusted input operation.
|
|
1095
|
+
*
|
|
1096
|
+
* @remarks
|
|
1097
|
+
* - `delay` — milliseconds between the transitions the operation dispatches
|
|
1098
|
+
*/
|
|
1099
|
+
export declare interface BrowserInputOptions {
|
|
1100
|
+
readonly delay?: number;
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
/** Describes normalized CDP keyboard key data. */
|
|
1010
1104
|
export declare interface BrowserKey {
|
|
1011
1105
|
readonly key: string;
|
|
1012
1106
|
readonly code: string;
|
|
@@ -1015,28 +1109,37 @@ export declare interface BrowserKey {
|
|
|
1015
1109
|
}
|
|
1016
1110
|
|
|
1017
1111
|
/**
|
|
1018
|
-
*
|
|
1112
|
+
* Sends trusted keyboard input through Chromium's CDP Input domain.
|
|
1113
|
+
*
|
|
1114
|
+
* @example
|
|
1115
|
+
* ```ts
|
|
1116
|
+
* import { BrowserKeyboard } from '@orkestrel/browser'
|
|
1117
|
+
*
|
|
1118
|
+
* const keyboard = new BrowserKeyboard(page)
|
|
1119
|
+
* await keyboard.type('orkestrel', { delay: 10 })
|
|
1120
|
+
* await keyboard.press('Control+Enter')
|
|
1121
|
+
* ```
|
|
1019
1122
|
*/
|
|
1020
1123
|
export declare class BrowserKeyboard implements BrowserKeyboardInterface {
|
|
1021
1124
|
#private;
|
|
1022
1125
|
constructor(frame: BrowserFrameInterface);
|
|
1023
1126
|
down(value: string): Promise<void>;
|
|
1024
1127
|
up(value: string): Promise<void>;
|
|
1025
|
-
press(value: string, options?:
|
|
1026
|
-
type(value: string, options?:
|
|
1128
|
+
press(value: string, options?: BrowserInputOptions): Promise<void>;
|
|
1129
|
+
type(value: string, options?: BrowserInputOptions): Promise<void>;
|
|
1027
1130
|
insert(value: string): Promise<void>;
|
|
1028
1131
|
}
|
|
1029
1132
|
|
|
1030
|
-
/**
|
|
1133
|
+
/** Provides keyboard input operations bound to one frame target session. */
|
|
1031
1134
|
export declare interface BrowserKeyboardInterface {
|
|
1032
1135
|
down(key: string): Promise<void>;
|
|
1033
1136
|
up(key: string): Promise<void>;
|
|
1034
|
-
press(key: string, options?:
|
|
1035
|
-
type(value: string, options?:
|
|
1137
|
+
press(key: string, options?: BrowserInputOptions): Promise<void>;
|
|
1138
|
+
type(value: string, options?: BrowserInputOptions): Promise<void>;
|
|
1036
1139
|
insert(value: string): Promise<void>;
|
|
1037
1140
|
}
|
|
1038
1141
|
|
|
1039
|
-
/**
|
|
1142
|
+
/** Describes layout data associated with one captured DOM node. */
|
|
1040
1143
|
export declare interface BrowserLayout {
|
|
1041
1144
|
readonly bounds: BrowserRect | undefined;
|
|
1042
1145
|
readonly styles: Readonly<Record<string, string>>;
|
|
@@ -1048,7 +1151,16 @@ export declare interface BrowserLayout {
|
|
|
1048
1151
|
}
|
|
1049
1152
|
|
|
1050
1153
|
/**
|
|
1051
|
-
*
|
|
1154
|
+
* Represents a reusable strict semantic locator over one frame.
|
|
1155
|
+
*
|
|
1156
|
+
* @example
|
|
1157
|
+
* ```ts
|
|
1158
|
+
* import { BrowserLocator } from '@orkestrel/browser'
|
|
1159
|
+
*
|
|
1160
|
+
* const save = new BrowserLocator(page, { selector: 'role', value: 'button', name: 'Save' })
|
|
1161
|
+
* await save.click({ count: 2 })
|
|
1162
|
+
* const label = await save.text()
|
|
1163
|
+
* ```
|
|
1052
1164
|
*/
|
|
1053
1165
|
export declare class BrowserLocator implements BrowserLocatorInterface {
|
|
1054
1166
|
#private;
|
|
@@ -1056,24 +1168,25 @@ export declare class BrowserLocator implements BrowserLocatorInterface {
|
|
|
1056
1168
|
get frame(): BrowserFrameInterface;
|
|
1057
1169
|
get query(): BrowserQuery;
|
|
1058
1170
|
locator(selector: string): BrowserLocatorInterface;
|
|
1059
|
-
filter(options:
|
|
1171
|
+
filter(options: BrowserLocatorFilter): BrowserLocatorInterface;
|
|
1060
1172
|
first(): BrowserLocatorInterface;
|
|
1061
1173
|
last(): BrowserLocatorInterface;
|
|
1062
1174
|
item(index: number): BrowserLocatorInterface;
|
|
1063
1175
|
count(): Promise<number>;
|
|
1064
1176
|
all(): Promise<readonly BrowserLocatorInterface[]>;
|
|
1065
|
-
click(options?:
|
|
1177
|
+
click(options?: BrowserLocatorClickOptions): Promise<void>;
|
|
1066
1178
|
fill(value: string, options?: BrowserActionOptions): Promise<void>;
|
|
1067
1179
|
select(values: readonly string[], options?: BrowserActionOptions): Promise<void>;
|
|
1068
|
-
check(options?:
|
|
1069
|
-
uncheck(options?:
|
|
1070
|
-
hover(options?:
|
|
1180
|
+
check(options?: BrowserLocatorClickOptions): Promise<void>;
|
|
1181
|
+
uncheck(options?: BrowserLocatorClickOptions): Promise<void>;
|
|
1182
|
+
hover(options?: BrowserPointerOptions): Promise<void>;
|
|
1071
1183
|
focus(options?: BrowserActionOptions): Promise<void>;
|
|
1072
|
-
press(key: string, options?:
|
|
1073
|
-
type(value: string, options?:
|
|
1184
|
+
press(key: string, options?: BrowserLocatorTypeOptions): Promise<void>;
|
|
1185
|
+
type(value: string, options?: BrowserLocatorTypeOptions): Promise<void>;
|
|
1074
1186
|
clear(options?: BrowserActionOptions): Promise<void>;
|
|
1075
1187
|
wait(options?: BrowserWaitOptions): Promise<void>;
|
|
1076
|
-
text(
|
|
1188
|
+
text(): Promise<string>;
|
|
1189
|
+
texts(): Promise<readonly string[]>;
|
|
1077
1190
|
html(): Promise<string>;
|
|
1078
1191
|
value(): Promise<string>;
|
|
1079
1192
|
attribute(name: string): Promise<string | undefined>;
|
|
@@ -1082,10 +1195,18 @@ export declare class BrowserLocator implements BrowserLocatorInterface {
|
|
|
1082
1195
|
editable(): Promise<boolean>;
|
|
1083
1196
|
screenshot(options?: BrowserScreenshotOptions): Promise<BrowserScreenshotResult>;
|
|
1084
1197
|
upload(options: BrowserUploadOptions): Promise<void>;
|
|
1085
|
-
drag(target: BrowserLocatorInterface, options?:
|
|
1198
|
+
drag(target: BrowserLocatorInterface, options?: BrowserLocatorDragOptions): Promise<void>;
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
/** Describes the options for a locator click, combining element resolution with mouse input. */
|
|
1202
|
+
export declare interface BrowserLocatorClickOptions extends BrowserPointerOptions, BrowserClickOptions {
|
|
1086
1203
|
}
|
|
1087
1204
|
|
|
1088
|
-
/**
|
|
1205
|
+
/** Describes the options for a locator drag, combining element resolution with mouse input. */
|
|
1206
|
+
export declare interface BrowserLocatorDragOptions extends BrowserPointerOptions, BrowserDragOptions {
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
/** Describes a declarative locator filter applied after selector resolution. */
|
|
1089
1210
|
export declare interface BrowserLocatorFilter {
|
|
1090
1211
|
readonly text?: string;
|
|
1091
1212
|
readonly exact?: boolean;
|
|
@@ -1093,30 +1214,31 @@ export declare interface BrowserLocatorFilter {
|
|
|
1093
1214
|
}
|
|
1094
1215
|
|
|
1095
1216
|
/**
|
|
1096
|
-
*
|
|
1217
|
+
* Represents a reusable strict locator over one frame.
|
|
1097
1218
|
*/
|
|
1098
1219
|
export declare interface BrowserLocatorInterface {
|
|
1099
1220
|
readonly frame: BrowserFrameInterface;
|
|
1100
1221
|
readonly query: BrowserQuery;
|
|
1101
1222
|
locator(selector: string): BrowserLocatorInterface;
|
|
1102
|
-
filter(options:
|
|
1223
|
+
filter(options: BrowserLocatorFilter): BrowserLocatorInterface;
|
|
1103
1224
|
first(): BrowserLocatorInterface;
|
|
1104
1225
|
last(): BrowserLocatorInterface;
|
|
1105
1226
|
item(index: number): BrowserLocatorInterface;
|
|
1106
1227
|
count(): Promise<number>;
|
|
1107
1228
|
all(): Promise<readonly BrowserLocatorInterface[]>;
|
|
1108
|
-
click(options?:
|
|
1229
|
+
click(options?: BrowserLocatorClickOptions): Promise<void>;
|
|
1109
1230
|
fill(value: string, options?: BrowserActionOptions): Promise<void>;
|
|
1110
1231
|
select(values: readonly string[], options?: BrowserActionOptions): Promise<void>;
|
|
1111
|
-
check(options?:
|
|
1112
|
-
uncheck(options?:
|
|
1113
|
-
hover(options?:
|
|
1232
|
+
check(options?: BrowserLocatorClickOptions): Promise<void>;
|
|
1233
|
+
uncheck(options?: BrowserLocatorClickOptions): Promise<void>;
|
|
1234
|
+
hover(options?: BrowserPointerOptions): Promise<void>;
|
|
1114
1235
|
focus(options?: BrowserActionOptions): Promise<void>;
|
|
1115
|
-
press(key: string, options?:
|
|
1116
|
-
type(value: string, options?:
|
|
1236
|
+
press(key: string, options?: BrowserLocatorTypeOptions): Promise<void>;
|
|
1237
|
+
type(value: string, options?: BrowserLocatorTypeOptions): Promise<void>;
|
|
1117
1238
|
clear(options?: BrowserActionOptions): Promise<void>;
|
|
1118
1239
|
wait(options?: BrowserWaitOptions): Promise<void>;
|
|
1119
|
-
text(
|
|
1240
|
+
text(): Promise<string>;
|
|
1241
|
+
texts(): Promise<readonly string[]>;
|
|
1120
1242
|
html(): Promise<string>;
|
|
1121
1243
|
value(): Promise<string>;
|
|
1122
1244
|
attribute(name: string): Promise<string | undefined>;
|
|
@@ -1125,10 +1247,14 @@ export declare interface BrowserLocatorInterface {
|
|
|
1125
1247
|
editable(): Promise<boolean>;
|
|
1126
1248
|
screenshot(options?: BrowserScreenshotOptions): Promise<BrowserScreenshotResult>;
|
|
1127
1249
|
upload(options: BrowserUploadOptions): Promise<void>;
|
|
1128
|
-
drag(target: BrowserLocatorInterface, options?:
|
|
1250
|
+
drag(target: BrowserLocatorInterface, options?: BrowserLocatorDragOptions): Promise<void>;
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
/** Describes the options for locator keyboard entry, combining element resolution with key input. */
|
|
1254
|
+
export declare interface BrowserLocatorTypeOptions extends BrowserActionOptions, BrowserInputOptions {
|
|
1129
1255
|
}
|
|
1130
1256
|
|
|
1131
|
-
/**
|
|
1257
|
+
/** Describes the paper margin lengths accepted by Chromium print-to-PDF. */
|
|
1132
1258
|
export declare interface BrowserMargin {
|
|
1133
1259
|
readonly top?: number;
|
|
1134
1260
|
readonly right?: number;
|
|
@@ -1136,23 +1262,41 @@ export declare interface BrowserMargin {
|
|
|
1136
1262
|
readonly left?: number;
|
|
1137
1263
|
}
|
|
1138
1264
|
|
|
1139
|
-
/**
|
|
1265
|
+
/**
|
|
1266
|
+
* Describes browser color and media feature overrides.
|
|
1267
|
+
*
|
|
1268
|
+
* @remarks
|
|
1269
|
+
* - `output` — emulated output medium, mirroring the CSS `media` type
|
|
1270
|
+
* - `scheme` — emulated `prefers-color-scheme` value
|
|
1271
|
+
* - `contrast` — emulated `prefers-contrast` value
|
|
1272
|
+
* - `motion` — emulated `prefers-reduced-motion` value
|
|
1273
|
+
* - `colors` — emulated `forced-colors` value, keeping the CSS feature's word
|
|
1274
|
+
*/
|
|
1140
1275
|
export declare interface BrowserMedia {
|
|
1141
|
-
readonly
|
|
1142
|
-
readonly
|
|
1276
|
+
readonly output?: 'screen' | 'print';
|
|
1277
|
+
readonly scheme?: 'light' | 'dark' | 'no-preference';
|
|
1143
1278
|
readonly contrast?: 'more' | 'less' | 'no-preference';
|
|
1144
1279
|
readonly motion?: 'reduce' | 'no-preference';
|
|
1145
1280
|
readonly colors?: 'active' | 'none';
|
|
1146
1281
|
}
|
|
1147
1282
|
|
|
1148
|
-
/**
|
|
1283
|
+
/** Represents one Performance-domain metric. */
|
|
1149
1284
|
export declare interface BrowserMetric {
|
|
1150
1285
|
readonly name: string;
|
|
1151
1286
|
readonly value: number;
|
|
1152
1287
|
}
|
|
1153
1288
|
|
|
1154
1289
|
/**
|
|
1155
|
-
*
|
|
1290
|
+
* Sends trusted mouse input through Chromium's CDP Input domain.
|
|
1291
|
+
*
|
|
1292
|
+
* @example
|
|
1293
|
+
* ```ts
|
|
1294
|
+
* import { BrowserMouse } from '@orkestrel/browser'
|
|
1295
|
+
*
|
|
1296
|
+
* const mouse = new BrowserMouse(page)
|
|
1297
|
+
* await mouse.click({ x: 50, y: 20 }, { button: 'left', count: 2 })
|
|
1298
|
+
* await mouse.drag({ x: 10, y: 10 }, { x: 90, y: 90 }, { steps: 20 })
|
|
1299
|
+
* ```
|
|
1156
1300
|
*/
|
|
1157
1301
|
export declare class BrowserMouse implements BrowserMouseInterface {
|
|
1158
1302
|
#private;
|
|
@@ -1160,26 +1304,35 @@ export declare class BrowserMouse implements BrowserMouseInterface {
|
|
|
1160
1304
|
move(point: BrowserPoint): Promise<void>;
|
|
1161
1305
|
down(button?: BrowserMouseButton, count?: number): Promise<void>;
|
|
1162
1306
|
up(button?: BrowserMouseButton, count?: number): Promise<void>;
|
|
1163
|
-
click(point: BrowserPoint, options?:
|
|
1164
|
-
drag(start: BrowserPoint, end: BrowserPoint, options?:
|
|
1307
|
+
click(point: BrowserPoint, options?: BrowserClickOptions): Promise<void>;
|
|
1308
|
+
drag(start: BrowserPoint, end: BrowserPoint, options?: BrowserDragOptions): Promise<void>;
|
|
1165
1309
|
wheel(delta: BrowserPoint): Promise<void>;
|
|
1166
1310
|
}
|
|
1167
1311
|
|
|
1168
|
-
/**
|
|
1312
|
+
/** Names a mouse button understood by Chromium's Input domain. */
|
|
1169
1313
|
export declare type BrowserMouseButton = 'left' | 'middle' | 'right' | 'back' | 'forward';
|
|
1170
1314
|
|
|
1171
|
-
/**
|
|
1315
|
+
/** Provides mouse input operations bound to one frame target session. */
|
|
1172
1316
|
export declare interface BrowserMouseInterface {
|
|
1173
1317
|
move(point: BrowserPoint): Promise<void>;
|
|
1174
1318
|
down(button?: BrowserMouseButton, count?: number): Promise<void>;
|
|
1175
1319
|
up(button?: BrowserMouseButton, count?: number): Promise<void>;
|
|
1176
|
-
click(point: BrowserPoint, options?:
|
|
1177
|
-
drag(start: BrowserPoint, end: BrowserPoint, options?:
|
|
1320
|
+
click(point: BrowserPoint, options?: BrowserClickOptions): Promise<void>;
|
|
1321
|
+
drag(start: BrowserPoint, end: BrowserPoint, options?: BrowserDragOptions): Promise<void>;
|
|
1178
1322
|
wheel(delta: BrowserPoint): Promise<void>;
|
|
1179
1323
|
}
|
|
1180
1324
|
|
|
1181
1325
|
/**
|
|
1182
|
-
* URL and page-predicate waits resilient to ordinary navigation events.
|
|
1326
|
+
* Runs URL and page-predicate waits resilient to ordinary navigation events.
|
|
1327
|
+
*
|
|
1328
|
+
* @example
|
|
1329
|
+
* ```ts
|
|
1330
|
+
* import { BrowserNavigationManager } from '@orkestrel/browser'
|
|
1331
|
+
*
|
|
1332
|
+
* const navigation = new BrowserNavigationManager(page)
|
|
1333
|
+
* const url = await navigation.wait('https://example.com/checkout', { timeout: 5_000 })
|
|
1334
|
+
* await navigation.until('document.readyState === "complete"')
|
|
1335
|
+
* ```
|
|
1183
1336
|
*/
|
|
1184
1337
|
export declare class BrowserNavigationManager implements BrowserNavigationManagerInterface {
|
|
1185
1338
|
#private;
|
|
@@ -1188,14 +1341,14 @@ export declare class BrowserNavigationManager implements BrowserNavigationManage
|
|
|
1188
1341
|
until(expression: string, options?: BrowserNavigationWaitOptions): Promise<unknown>;
|
|
1189
1342
|
}
|
|
1190
1343
|
|
|
1191
|
-
/** URL and in-page predicate waits associated with one page. */
|
|
1344
|
+
/** Provides URL and in-page predicate waits associated with one page. */
|
|
1192
1345
|
export declare interface BrowserNavigationManagerInterface {
|
|
1193
1346
|
wait(pattern: string, options?: BrowserNavigationWaitOptions): Promise<string>;
|
|
1194
1347
|
until(expression: string, options?: BrowserNavigationWaitOptions): Promise<unknown>;
|
|
1195
1348
|
}
|
|
1196
1349
|
|
|
1197
1350
|
/**
|
|
1198
|
-
*
|
|
1351
|
+
* Describes the options for page navigation.
|
|
1199
1352
|
*
|
|
1200
1353
|
* @remarks
|
|
1201
1354
|
* - `condition` — page load condition to wait for (default `'load'`)
|
|
@@ -1207,14 +1360,14 @@ export declare interface BrowserNavigationOptions {
|
|
|
1207
1360
|
readonly timeout?: number;
|
|
1208
1361
|
}
|
|
1209
1362
|
|
|
1210
|
-
/**
|
|
1363
|
+
/** Describes the outcome of a top-level navigation command. */
|
|
1211
1364
|
export declare interface BrowserNavigationResult {
|
|
1212
1365
|
readonly url: string;
|
|
1213
1366
|
readonly response: BrowserResponse | undefined;
|
|
1214
1367
|
readonly same: boolean;
|
|
1215
1368
|
}
|
|
1216
1369
|
|
|
1217
|
-
/**
|
|
1370
|
+
/** Represents one pending URL-pattern wait. */
|
|
1218
1371
|
export declare interface BrowserNavigationWait {
|
|
1219
1372
|
readonly pattern: string;
|
|
1220
1373
|
readonly timer: ReturnType<typeof setTimeout>;
|
|
@@ -1222,17 +1375,17 @@ export declare interface BrowserNavigationWait {
|
|
|
1222
1375
|
readonly reject: (error: unknown) => void;
|
|
1223
1376
|
}
|
|
1224
1377
|
|
|
1225
|
-
/**
|
|
1378
|
+
/** Describes the options for URL and predicate waits. */
|
|
1226
1379
|
export declare interface BrowserNavigationWaitOptions {
|
|
1227
1380
|
readonly timeout?: number;
|
|
1228
1381
|
}
|
|
1229
1382
|
|
|
1230
|
-
/**
|
|
1383
|
+
/** Holds the state retained while correlating navigation with Network events. */
|
|
1231
1384
|
export declare interface BrowserNavigationWatch {
|
|
1232
|
-
readonly responses: BrowserResponse[];
|
|
1385
|
+
readonly responses: readonly BrowserResponse[];
|
|
1233
1386
|
}
|
|
1234
1387
|
|
|
1235
|
-
/**
|
|
1388
|
+
/** Maps the network events a page's network manager emits. */
|
|
1236
1389
|
export declare type BrowserNetworkEventMap = {
|
|
1237
1390
|
readonly request: readonly [request: BrowserRequest];
|
|
1238
1391
|
readonly response: readonly [response: BrowserResponse];
|
|
@@ -1242,11 +1395,21 @@ export declare type BrowserNetworkEventMap = {
|
|
|
1242
1395
|
};
|
|
1243
1396
|
|
|
1244
1397
|
/**
|
|
1245
|
-
*
|
|
1398
|
+
* Drives the page-scoped Network and Fetch domain lifecycle.
|
|
1399
|
+
*
|
|
1400
|
+
* @example
|
|
1401
|
+
* ```ts
|
|
1402
|
+
* import { BrowserNetworkManager } from '@orkestrel/browser'
|
|
1403
|
+
*
|
|
1404
|
+
* const network = new BrowserNetworkManager(page)
|
|
1405
|
+
* await network.start()
|
|
1406
|
+
* network.emitter.on('response', (response) => log(response.status))
|
|
1407
|
+
* await network.destroy()
|
|
1408
|
+
* ```
|
|
1246
1409
|
*/
|
|
1247
1410
|
export declare class BrowserNetworkManager implements BrowserNetworkManagerInterface {
|
|
1248
1411
|
#private;
|
|
1249
|
-
constructor(frame: BrowserFrameInterface, writer?:
|
|
1412
|
+
constructor(frame: BrowserFrameInterface, writer?: BrowserWriterInterface);
|
|
1250
1413
|
get emitter(): EmitterInterface<BrowserNetworkEventMap>;
|
|
1251
1414
|
get har(): BrowserHARManagerInterface;
|
|
1252
1415
|
start(): Promise<void>;
|
|
@@ -1261,7 +1424,7 @@ export declare class BrowserNetworkManager implements BrowserNetworkManagerInter
|
|
|
1261
1424
|
destroy(): Promise<void>;
|
|
1262
1425
|
}
|
|
1263
1426
|
|
|
1264
|
-
/**
|
|
1427
|
+
/** Provides page-scoped network observation and interception. */
|
|
1265
1428
|
export declare interface BrowserNetworkManagerInterface {
|
|
1266
1429
|
readonly emitter: EmitterInterface<BrowserNetworkEventMap>;
|
|
1267
1430
|
readonly har: BrowserHARManagerInterface;
|
|
@@ -1277,14 +1440,20 @@ export declare interface BrowserNetworkManagerInterface {
|
|
|
1277
1440
|
destroy(): Promise<void>;
|
|
1278
1441
|
}
|
|
1279
1442
|
|
|
1280
|
-
/**
|
|
1443
|
+
/**
|
|
1444
|
+
* Represents one serializable DOM node decoded from a CDP DOM snapshot.
|
|
1445
|
+
*
|
|
1446
|
+
* @remarks
|
|
1447
|
+
* `category` mirrors the DOM `nodeType` value — `1` for an element, `3` for
|
|
1448
|
+
* text, `9` for a document, and the rest of the DOM node categories.
|
|
1449
|
+
*/
|
|
1281
1450
|
export declare interface BrowserNode {
|
|
1282
1451
|
readonly document: number;
|
|
1283
1452
|
readonly frame: string;
|
|
1284
1453
|
readonly index: number;
|
|
1285
1454
|
readonly id: number | undefined;
|
|
1286
1455
|
readonly parent: number | undefined;
|
|
1287
|
-
readonly
|
|
1456
|
+
readonly category: number;
|
|
1288
1457
|
readonly name: string;
|
|
1289
1458
|
readonly value: string;
|
|
1290
1459
|
readonly attributes: Readonly<Record<string, string>>;
|
|
@@ -1301,11 +1470,11 @@ export declare interface BrowserNode {
|
|
|
1301
1470
|
readonly layout: BrowserLayout | undefined;
|
|
1302
1471
|
}
|
|
1303
1472
|
|
|
1304
|
-
/**
|
|
1473
|
+
/** Names the predicate form accepted by {@link BrowserSnapshotInterface} find, filter, and closest methods. */
|
|
1305
1474
|
export declare type BrowserNodePredicate = (node: BrowserNode) => boolean;
|
|
1306
1475
|
|
|
1307
1476
|
/**
|
|
1308
|
-
*
|
|
1477
|
+
* Describes a declarative browser-node matcher used by {@link matchesBrowserNode}.
|
|
1309
1478
|
*
|
|
1310
1479
|
* @remarks
|
|
1311
1480
|
* Every supplied field must match. `name` is case-insensitive, `text`
|
|
@@ -1322,11 +1491,31 @@ export declare interface BrowserNodeQuery {
|
|
|
1322
1491
|
}
|
|
1323
1492
|
|
|
1324
1493
|
/**
|
|
1325
|
-
*
|
|
1494
|
+
* Collects every option a trusted-input operation can carry.
|
|
1495
|
+
*
|
|
1496
|
+
* @remarks
|
|
1497
|
+
* The intersection of each option type that carries a bounded key, so one
|
|
1498
|
+
* validator answers for a locator click, a locator drag, a mouse click, a
|
|
1499
|
+
* mouse drag, and keyboard entry alike.
|
|
1500
|
+
*/
|
|
1501
|
+
export declare type BrowserOperationOptions = BrowserPointerOptions & BrowserClickOptions & BrowserDragOptions;
|
|
1502
|
+
|
|
1503
|
+
/**
|
|
1504
|
+
* Represents a top-level browser page, including its target lifecycle and child frames.
|
|
1505
|
+
*
|
|
1506
|
+
* @example
|
|
1507
|
+
* ```ts
|
|
1508
|
+
* import { BrowserPage } from '@orkestrel/browser'
|
|
1509
|
+
*
|
|
1510
|
+
* const page = new BrowserPage(client, 'target-1', 'session-1')
|
|
1511
|
+
* await page.navigate('https://example.com')
|
|
1512
|
+
* const shot = await page.screenshot({ format: 'png' })
|
|
1513
|
+
* await page.close()
|
|
1514
|
+
* ```
|
|
1326
1515
|
*/
|
|
1327
1516
|
export declare class BrowserPage extends BrowserFrame implements BrowserPageInterface {
|
|
1328
1517
|
#private;
|
|
1329
|
-
constructor(client: CDPClientInterface, targetId: string, sessionId: string, writer?:
|
|
1518
|
+
constructor(client: CDPClientInterface, targetId: string, sessionId: string, writer?: BrowserWriterInterface, url?: string, frameId?: string, contextId?: string, opener?: BrowserPageInterface, options?: BrowserPageOptions);
|
|
1330
1519
|
get emitter(): EmitterInterface<BrowserPageEventMap>;
|
|
1331
1520
|
get network(): BrowserNetworkManagerInterface;
|
|
1332
1521
|
get navigation(): BrowserNavigationManagerInterface;
|
|
@@ -1353,14 +1542,14 @@ export declare class BrowserPage extends BrowserFrame implements BrowserPageInte
|
|
|
1353
1542
|
assert(): void;
|
|
1354
1543
|
}
|
|
1355
1544
|
|
|
1356
|
-
/**
|
|
1545
|
+
/** Represents one uncaught page exception. */
|
|
1357
1546
|
export declare interface BrowserPageError {
|
|
1358
1547
|
readonly message: string;
|
|
1359
1548
|
readonly stack: readonly BrowserStackFrame[];
|
|
1360
1549
|
readonly timestamp: number;
|
|
1361
1550
|
}
|
|
1362
1551
|
|
|
1363
|
-
/**
|
|
1552
|
+
/** Maps the typed page, frame, target, and user-visible browser events. */
|
|
1364
1553
|
export declare type BrowserPageEventMap = {
|
|
1365
1554
|
readonly navigate: readonly [url: string];
|
|
1366
1555
|
readonly attach: readonly [frame: BrowserFrameInterface];
|
|
@@ -1381,7 +1570,7 @@ export declare type BrowserPageEventMap = {
|
|
|
1381
1570
|
};
|
|
1382
1571
|
|
|
1383
1572
|
/**
|
|
1384
|
-
*
|
|
1573
|
+
* Abstracts a single top-level browser page.
|
|
1385
1574
|
*
|
|
1386
1575
|
* @remarks
|
|
1387
1576
|
* Inherits every {@link BrowserFrameInterface} document operation for the
|
|
@@ -1423,20 +1612,27 @@ export declare interface BrowserPageInterface extends BrowserFrameInterface {
|
|
|
1423
1612
|
}
|
|
1424
1613
|
|
|
1425
1614
|
/**
|
|
1426
|
-
*
|
|
1615
|
+
* Describes the options for creating a browser page.
|
|
1427
1616
|
*
|
|
1428
1617
|
* @remarks
|
|
1618
|
+
* - `on` — initial event listeners wired at construction
|
|
1619
|
+
* - `error` — observer error handler forwarded to the emitter
|
|
1429
1620
|
* - `url` — navigate to this URL immediately after creation
|
|
1430
1621
|
* - `viewport` — override the context-level default viewport
|
|
1431
1622
|
* - `timeout` — navigation timeout for the initial URL
|
|
1432
1623
|
*/
|
|
1433
1624
|
export declare interface BrowserPageOptions {
|
|
1625
|
+
readonly on?: EmitterHooks<BrowserPageEventMap>;
|
|
1626
|
+
readonly error?: EmitterErrorHandler;
|
|
1434
1627
|
readonly url?: string;
|
|
1435
1628
|
readonly viewport?: BrowserViewport;
|
|
1436
1629
|
readonly timeout?: number;
|
|
1437
1630
|
}
|
|
1438
1631
|
|
|
1439
|
-
/**
|
|
1632
|
+
/** Returns the context's live pages at call time. */
|
|
1633
|
+
export declare type BrowserPagesFunction = () => readonly BrowserPageInterface[];
|
|
1634
|
+
|
|
1635
|
+
/** Describes the options for printing a Chromium page to PDF. */
|
|
1440
1636
|
export declare interface BrowserPDFOptions {
|
|
1441
1637
|
readonly path?: string;
|
|
1442
1638
|
readonly landscape?: boolean;
|
|
@@ -1452,14 +1648,14 @@ export declare interface BrowserPDFOptions {
|
|
|
1452
1648
|
readonly outline?: boolean;
|
|
1453
1649
|
}
|
|
1454
1650
|
|
|
1455
|
-
/**
|
|
1651
|
+
/** Describes the result of printing a page to PDF. */
|
|
1456
1652
|
export declare interface BrowserPDFResult {
|
|
1457
1653
|
readonly bytes: Uint8Array;
|
|
1458
1654
|
readonly path: string | undefined;
|
|
1459
1655
|
}
|
|
1460
1656
|
|
|
1461
1657
|
/**
|
|
1462
|
-
*
|
|
1658
|
+
* Validates and compiles Page.printToPDF parameters.
|
|
1463
1659
|
*
|
|
1464
1660
|
* @param options - Public PDF options
|
|
1465
1661
|
* @returns Protocol parameter record
|
|
@@ -1467,29 +1663,45 @@ export declare interface BrowserPDFResult {
|
|
|
1467
1663
|
export declare function browserPDFToParams(options?: BrowserPDFOptions): Readonly<Record<string, unknown>>;
|
|
1468
1664
|
|
|
1469
1665
|
/**
|
|
1470
|
-
* Performance-domain metrics
|
|
1666
|
+
* Reads Performance-domain metrics for one frame.
|
|
1667
|
+
*
|
|
1668
|
+
* @example
|
|
1669
|
+
* ```ts
|
|
1670
|
+
* import { BrowserPerformance } from '@orkestrel/browser'
|
|
1671
|
+
*
|
|
1672
|
+
* const performance = new BrowserPerformance(page)
|
|
1673
|
+
* const metrics = await performance.metrics() // readonly BrowserMetric[]
|
|
1674
|
+
* ```
|
|
1471
1675
|
*/
|
|
1472
1676
|
export declare class BrowserPerformance implements BrowserPerformanceInterface {
|
|
1473
1677
|
#private;
|
|
1474
1678
|
constructor(frame: BrowserFrameInterface);
|
|
1475
|
-
get active(): boolean;
|
|
1476
1679
|
metrics(): Promise<readonly BrowserMetric[]>;
|
|
1477
|
-
start(interval?: number): Promise<void>;
|
|
1478
|
-
stop(): Promise<BrowserProfile>;
|
|
1479
|
-
destroy(): Promise<void>;
|
|
1480
1680
|
}
|
|
1481
1681
|
|
|
1482
|
-
/**
|
|
1682
|
+
/**
|
|
1683
|
+
* Reads Performance-domain metrics.
|
|
1684
|
+
*
|
|
1685
|
+
* @remarks
|
|
1686
|
+
* Each call enables the Performance domain and disables it again, so the
|
|
1687
|
+
* reader holds no protocol state and needs no teardown. Sampled CPU profiling
|
|
1688
|
+
* is {@link BrowserProfilerInterface}, its peer under `diagnostics`.
|
|
1689
|
+
*/
|
|
1483
1690
|
export declare interface BrowserPerformanceInterface {
|
|
1484
|
-
readonly active: boolean;
|
|
1485
1691
|
metrics(): Promise<readonly BrowserMetric[]>;
|
|
1486
|
-
start(interval?: number): Promise<void>;
|
|
1487
|
-
stop(): Promise<BrowserProfile>;
|
|
1488
|
-
destroy(): Promise<void>;
|
|
1489
1692
|
}
|
|
1490
1693
|
|
|
1491
1694
|
/**
|
|
1492
|
-
*
|
|
1695
|
+
* Applies permission overrides isolated to one browser context.
|
|
1696
|
+
*
|
|
1697
|
+
* @example
|
|
1698
|
+
* ```ts
|
|
1699
|
+
* import { BrowserPermissionManager } from '@orkestrel/browser'
|
|
1700
|
+
*
|
|
1701
|
+
* const permissions = new BrowserPermissionManager(client)
|
|
1702
|
+
* await permissions.grant(['geolocation'], 'https://example.com')
|
|
1703
|
+
* await permissions.clear()
|
|
1704
|
+
* ```
|
|
1493
1705
|
*/
|
|
1494
1706
|
export declare class BrowserPermissionManager implements BrowserPermissionManagerInterface {
|
|
1495
1707
|
#private;
|
|
@@ -1499,20 +1711,30 @@ export declare class BrowserPermissionManager implements BrowserPermissionManage
|
|
|
1499
1711
|
clear(): Promise<void>;
|
|
1500
1712
|
}
|
|
1501
1713
|
|
|
1502
|
-
/**
|
|
1714
|
+
/** Provides permission override operations scoped to one browser context. */
|
|
1503
1715
|
export declare interface BrowserPermissionManagerInterface {
|
|
1504
1716
|
grant(permissions: readonly string[], origin?: string): Promise<void>;
|
|
1505
1717
|
deny(permissions: readonly string[], origin?: string): Promise<void>;
|
|
1506
1718
|
clear(): Promise<void>;
|
|
1507
1719
|
}
|
|
1508
1720
|
|
|
1509
|
-
/**
|
|
1721
|
+
/** Describes a point in viewport CSS pixels. */
|
|
1510
1722
|
export declare interface BrowserPoint {
|
|
1511
1723
|
readonly x: number;
|
|
1512
1724
|
readonly y: number;
|
|
1513
1725
|
}
|
|
1514
1726
|
|
|
1515
|
-
/**
|
|
1727
|
+
/**
|
|
1728
|
+
* Describes the options for a locator operation that aims at a point inside the element.
|
|
1729
|
+
*
|
|
1730
|
+
* @remarks
|
|
1731
|
+
* - `position` — offset from the element's top-left corner, in CSS pixels
|
|
1732
|
+
*/
|
|
1733
|
+
export declare interface BrowserPointerOptions extends BrowserActionOptions {
|
|
1734
|
+
readonly position?: BrowserPoint;
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
/** Describes a sampled CPU profile. */
|
|
1516
1738
|
export declare interface BrowserProfile {
|
|
1517
1739
|
readonly start: number;
|
|
1518
1740
|
readonly end: number;
|
|
@@ -1521,7 +1743,7 @@ export declare interface BrowserProfile {
|
|
|
1521
1743
|
readonly deltas: readonly number[];
|
|
1522
1744
|
}
|
|
1523
1745
|
|
|
1524
|
-
/** JavaScript call frame from a CPU profile. */
|
|
1746
|
+
/** Describes a JavaScript call frame from a CPU profile. */
|
|
1525
1747
|
export declare interface BrowserProfileFrame {
|
|
1526
1748
|
readonly function: string;
|
|
1527
1749
|
readonly script: string;
|
|
@@ -1530,7 +1752,7 @@ export declare interface BrowserProfileFrame {
|
|
|
1530
1752
|
readonly column: number;
|
|
1531
1753
|
}
|
|
1532
1754
|
|
|
1533
|
-
/**
|
|
1755
|
+
/** Represents one node in a sampled CPU profile. */
|
|
1534
1756
|
export declare interface BrowserProfileNode {
|
|
1535
1757
|
readonly id: number;
|
|
1536
1758
|
readonly frame: BrowserProfileFrame;
|
|
@@ -1538,19 +1760,48 @@ export declare interface BrowserProfileNode {
|
|
|
1538
1760
|
readonly children: readonly number[];
|
|
1539
1761
|
}
|
|
1540
1762
|
|
|
1541
|
-
/**
|
|
1763
|
+
/**
|
|
1764
|
+
* Records sampled JavaScript CPU profiles over one frame's Profiler domain.
|
|
1765
|
+
*
|
|
1766
|
+
* @example
|
|
1767
|
+
* ```ts
|
|
1768
|
+
* import { BrowserProfiler } from '@orkestrel/browser'
|
|
1769
|
+
*
|
|
1770
|
+
* const profiler = new BrowserProfiler(page)
|
|
1771
|
+
* await profiler.start(100)
|
|
1772
|
+
* const profile = await profiler.stop() // { start, end, nodes, samples, deltas }
|
|
1773
|
+
* ```
|
|
1774
|
+
*/
|
|
1775
|
+
export declare class BrowserProfiler implements BrowserProfilerInterface {
|
|
1776
|
+
#private;
|
|
1777
|
+
constructor(frame: BrowserFrameInterface);
|
|
1778
|
+
get active(): boolean;
|
|
1779
|
+
start(interval?: number): Promise<void>;
|
|
1780
|
+
stop(): Promise<BrowserProfile>;
|
|
1781
|
+
destroy(): Promise<void>;
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
/** Drives the sampled CPU profile lifecycle. */
|
|
1785
|
+
export declare interface BrowserProfilerInterface {
|
|
1786
|
+
readonly active: boolean;
|
|
1787
|
+
start(interval?: number): Promise<void>;
|
|
1788
|
+
stop(): Promise<BrowserProfile>;
|
|
1789
|
+
destroy(): Promise<void>;
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
/** Describes proxy settings used when creating an isolated browser context. */
|
|
1542
1793
|
export declare interface BrowserProxy {
|
|
1543
1794
|
readonly server: string;
|
|
1544
1795
|
readonly bypass?: readonly string[];
|
|
1545
1796
|
}
|
|
1546
1797
|
|
|
1547
|
-
/**
|
|
1798
|
+
/** Describes a decoded content quad and its actionable center. */
|
|
1548
1799
|
export declare interface BrowserQuad {
|
|
1549
1800
|
readonly points: readonly [number, number, number, number, number, number, number, number];
|
|
1550
1801
|
readonly center: BrowserPoint;
|
|
1551
1802
|
}
|
|
1552
1803
|
|
|
1553
|
-
/**
|
|
1804
|
+
/** Describes a serializable selector query, including optional ancestry and filtering. */
|
|
1554
1805
|
export declare interface BrowserQuery {
|
|
1555
1806
|
readonly selector: BrowserSelector;
|
|
1556
1807
|
readonly value: string;
|
|
@@ -1561,10 +1812,10 @@ export declare interface BrowserQuery {
|
|
|
1561
1812
|
readonly index?: number;
|
|
1562
1813
|
}
|
|
1563
1814
|
|
|
1564
|
-
/**
|
|
1815
|
+
/** Represents a rectangle in CSS pixels: x, y, width, height. */
|
|
1565
1816
|
export declare type BrowserRect = readonly [x: number, y: number, width: number, height: number];
|
|
1566
1817
|
|
|
1567
|
-
/**
|
|
1818
|
+
/** Represents one observed browser request. */
|
|
1568
1819
|
export declare interface BrowserRequest {
|
|
1569
1820
|
readonly id: string;
|
|
1570
1821
|
readonly loader: string | undefined;
|
|
@@ -1579,7 +1830,7 @@ export declare interface BrowserRequest {
|
|
|
1579
1830
|
readonly redirect: BrowserResponse | undefined;
|
|
1580
1831
|
}
|
|
1581
1832
|
|
|
1582
|
-
/**
|
|
1833
|
+
/** Represents one failed browser request. */
|
|
1583
1834
|
export declare interface BrowserRequestFailure {
|
|
1584
1835
|
readonly id: string;
|
|
1585
1836
|
readonly error: string;
|
|
@@ -1587,7 +1838,7 @@ export declare interface BrowserRequestFailure {
|
|
|
1587
1838
|
readonly blocked: string | undefined;
|
|
1588
1839
|
}
|
|
1589
1840
|
|
|
1590
|
-
/**
|
|
1841
|
+
/** Represents one observed browser response. */
|
|
1591
1842
|
export declare interface BrowserResponse {
|
|
1592
1843
|
readonly id: string;
|
|
1593
1844
|
readonly loader: string;
|
|
@@ -1608,34 +1859,20 @@ export declare interface BrowserResponse {
|
|
|
1608
1859
|
}
|
|
1609
1860
|
|
|
1610
1861
|
/**
|
|
1611
|
-
*
|
|
1862
|
+
* Reports that an `evaluate()`/`content()` result exceeded {@link BROWSER_RESULT_LIMIT}
|
|
1612
1863
|
* and was rejected in-page before it could overflow the CDP transport frame.
|
|
1613
1864
|
*/
|
|
1614
1865
|
export declare class BrowserResultLimitError extends BrowserError {
|
|
1615
1866
|
constructor(message: string, context?: Readonly<Record<string, unknown>>);
|
|
1616
1867
|
}
|
|
1617
1868
|
|
|
1618
|
-
/**
|
|
1869
|
+
/** Describes the options for role-based locator creation. */
|
|
1619
1870
|
export declare interface BrowserRoleOptions {
|
|
1620
1871
|
readonly name?: string;
|
|
1621
1872
|
readonly exact?: boolean;
|
|
1622
1873
|
}
|
|
1623
1874
|
|
|
1624
|
-
/**
|
|
1625
|
-
* One paused request that can be aborted, continued, or fulfilled exactly once.
|
|
1626
|
-
*/
|
|
1627
|
-
export declare class BrowserRoute implements BrowserRouteInterface {
|
|
1628
|
-
#private;
|
|
1629
|
-
constructor(frame: BrowserFrameInterface, id: string, request: BrowserRequest);
|
|
1630
|
-
get id(): string;
|
|
1631
|
-
get request(): BrowserRequest;
|
|
1632
|
-
get handled(): boolean;
|
|
1633
|
-
abort(reason?: string): Promise<void>;
|
|
1634
|
-
continue(options?: BrowserRouteContinueOptions): Promise<void>;
|
|
1635
|
-
fulfill(options: BrowserRouteFulfillOptions): Promise<void>;
|
|
1636
|
-
}
|
|
1637
|
-
|
|
1638
|
-
/** Overrides supplied when continuing an intercepted request. */
|
|
1875
|
+
/** Describes the overrides supplied when continuing an intercepted request. */
|
|
1639
1876
|
export declare interface BrowserRouteContinueOptions {
|
|
1640
1877
|
readonly url?: string;
|
|
1641
1878
|
readonly method?: string;
|
|
@@ -1643,13 +1880,13 @@ export declare interface BrowserRouteContinueOptions {
|
|
|
1643
1880
|
readonly post?: string;
|
|
1644
1881
|
}
|
|
1645
1882
|
|
|
1646
|
-
/**
|
|
1883
|
+
/** Represents one installed network route. */
|
|
1647
1884
|
export declare interface BrowserRouteDefinition {
|
|
1648
1885
|
readonly query: BrowserRouteQuery;
|
|
1649
1886
|
readonly handler: BrowserRouteHandler;
|
|
1650
1887
|
}
|
|
1651
1888
|
|
|
1652
|
-
/**
|
|
1889
|
+
/** Describes the synthetic response supplied when fulfilling an intercepted request. */
|
|
1653
1890
|
export declare interface BrowserRouteFulfillOptions {
|
|
1654
1891
|
readonly status?: number;
|
|
1655
1892
|
readonly phrase?: string;
|
|
@@ -1657,10 +1894,10 @@ export declare interface BrowserRouteFulfillOptions {
|
|
|
1657
1894
|
readonly body?: string | Uint8Array;
|
|
1658
1895
|
}
|
|
1659
1896
|
|
|
1660
|
-
/**
|
|
1897
|
+
/** Runs for a matching intercepted request. */
|
|
1661
1898
|
export declare type BrowserRouteHandler = (route: BrowserRouteInterface) => void | Promise<void>;
|
|
1662
1899
|
|
|
1663
|
-
/**
|
|
1900
|
+
/** Represents one paused Fetch-domain request. */
|
|
1664
1901
|
export declare interface BrowserRouteInterface {
|
|
1665
1902
|
readonly id: string;
|
|
1666
1903
|
readonly request: BrowserRequest;
|
|
@@ -1670,29 +1907,29 @@ export declare interface BrowserRouteInterface {
|
|
|
1670
1907
|
fulfill(options: BrowserRouteFulfillOptions): Promise<void>;
|
|
1671
1908
|
}
|
|
1672
1909
|
|
|
1673
|
-
/**
|
|
1910
|
+
/** Describes route matching criteria. Omitted fields match all values. */
|
|
1674
1911
|
export declare interface BrowserRouteQuery {
|
|
1675
1912
|
readonly url?: string;
|
|
1676
1913
|
readonly method?: string;
|
|
1677
1914
|
readonly resource?: string;
|
|
1678
1915
|
}
|
|
1679
1916
|
|
|
1680
|
-
/**
|
|
1917
|
+
/** Names a cookie same-site policy understood by Chromium. */
|
|
1681
1918
|
export declare type BrowserSameSite = 'Strict' | 'Lax' | 'None';
|
|
1682
1919
|
|
|
1683
1920
|
/**
|
|
1684
|
-
*
|
|
1921
|
+
* Describes the options for taking a page screenshot.
|
|
1685
1922
|
*
|
|
1686
1923
|
* @remarks
|
|
1687
|
-
* - `path` — file path to persist the screenshot to,
|
|
1924
|
+
* - `path` — file path to persist the screenshot to, through the page's writer
|
|
1688
1925
|
* - `full` — capture the full scrollable page (default `false`)
|
|
1689
|
-
* - `
|
|
1926
|
+
* - `format` — image format (default `'png'`)
|
|
1690
1927
|
* - `quality` — JPEG quality 0–100 (ignored for PNG)
|
|
1691
1928
|
*/
|
|
1692
1929
|
export declare interface BrowserScreenshotOptions {
|
|
1693
1930
|
readonly path?: string;
|
|
1694
1931
|
readonly full?: boolean;
|
|
1695
|
-
readonly
|
|
1932
|
+
readonly format?: 'png' | 'jpeg';
|
|
1696
1933
|
readonly quality?: number;
|
|
1697
1934
|
readonly clip?: BrowserRect;
|
|
1698
1935
|
readonly transparent?: boolean;
|
|
@@ -1704,47 +1941,56 @@ export declare interface BrowserScreenshotOptions {
|
|
|
1704
1941
|
}
|
|
1705
1942
|
|
|
1706
1943
|
/**
|
|
1707
|
-
*
|
|
1944
|
+
* Describes the result of a page screenshot.
|
|
1708
1945
|
*
|
|
1709
1946
|
* @remarks
|
|
1710
1947
|
* - `bytes` — raw image bytes
|
|
1711
|
-
* - `path` — file path if persisted
|
|
1948
|
+
* - `path` — file path if persisted through the page's writer, otherwise undefined
|
|
1712
1949
|
*/
|
|
1713
1950
|
export declare interface BrowserScreenshotResult {
|
|
1714
1951
|
readonly bytes: Uint8Array;
|
|
1715
1952
|
readonly path: string | undefined;
|
|
1716
1953
|
}
|
|
1717
1954
|
|
|
1718
|
-
/**
|
|
1955
|
+
/** Names a screenshot coordinate scale. */
|
|
1719
1956
|
export declare type BrowserScreenshotScale = 'css' | 'device';
|
|
1720
1957
|
|
|
1721
1958
|
/**
|
|
1722
|
-
*
|
|
1959
|
+
* Validates and compiles basic Page.captureScreenshot parameters.
|
|
1723
1960
|
*
|
|
1724
1961
|
* @param options - Public screenshot options
|
|
1725
1962
|
* @returns Protocol parameter record
|
|
1726
1963
|
*/
|
|
1727
1964
|
export declare function browserScreenshotToParams(options?: BrowserScreenshotOptions): Readonly<Record<string, unknown>>;
|
|
1728
1965
|
|
|
1729
|
-
/** JavaScript script coverage. */
|
|
1966
|
+
/** Describes JavaScript script coverage. */
|
|
1730
1967
|
export declare interface BrowserScriptCoverage {
|
|
1731
1968
|
readonly id: string;
|
|
1732
1969
|
readonly url: string;
|
|
1733
1970
|
readonly functions: readonly BrowserFunctionCoverage[];
|
|
1734
1971
|
}
|
|
1735
1972
|
|
|
1736
|
-
/**
|
|
1973
|
+
/** Represents one installed new-document script and its optional host binding owner. */
|
|
1737
1974
|
export declare interface BrowserScriptEntry {
|
|
1738
1975
|
readonly source: string;
|
|
1739
1976
|
readonly binding: string | undefined;
|
|
1740
1977
|
}
|
|
1741
1978
|
|
|
1742
1979
|
/**
|
|
1743
|
-
*
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1980
|
+
* Installs new-document scripts and promise-based host functions for one page.
|
|
1981
|
+
*
|
|
1982
|
+
* @example
|
|
1983
|
+
* ```ts
|
|
1984
|
+
* import { BrowserScriptManager } from '@orkestrel/browser'
|
|
1985
|
+
*
|
|
1986
|
+
* const scripts = new BrowserScriptManager(page)
|
|
1987
|
+
* const id = await scripts.add('window.__ready = true')
|
|
1988
|
+
* await scripts.remove(id)
|
|
1989
|
+
* ```
|
|
1990
|
+
*/
|
|
1991
|
+
export declare class BrowserScriptManager implements BrowserScriptManagerInterface {
|
|
1992
|
+
#private;
|
|
1993
|
+
constructor(frame: BrowserFrameInterface);
|
|
1748
1994
|
add(source: string): Promise<string>;
|
|
1749
1995
|
remove(id: string): Promise<void>;
|
|
1750
1996
|
expose(name: string, handler: BrowserBindingHandler): Promise<void>;
|
|
@@ -1752,7 +1998,7 @@ export declare class BrowserScriptManager implements BrowserScriptManagerInterfa
|
|
|
1752
1998
|
destroy(): Promise<void>;
|
|
1753
1999
|
}
|
|
1754
2000
|
|
|
1755
|
-
/**
|
|
2001
|
+
/** Manages initialization scripts and host bindings for one page. */
|
|
1756
2002
|
export declare interface BrowserScriptManagerInterface {
|
|
1757
2003
|
add(source: string): Promise<string>;
|
|
1758
2004
|
remove(id: string): Promise<void>;
|
|
@@ -1761,7 +2007,7 @@ export declare interface BrowserScriptManagerInterface {
|
|
|
1761
2007
|
destroy(): Promise<void>;
|
|
1762
2008
|
}
|
|
1763
2009
|
|
|
1764
|
-
/** TLS details supplied with a browser response. */
|
|
2010
|
+
/** Describes the TLS details supplied with a browser response. */
|
|
1765
2011
|
export declare interface BrowserSecurity {
|
|
1766
2012
|
readonly protocol: string;
|
|
1767
2013
|
readonly issuer: string;
|
|
@@ -1769,18 +2015,32 @@ export declare interface BrowserSecurity {
|
|
|
1769
2015
|
readonly to: number;
|
|
1770
2016
|
}
|
|
1771
2017
|
|
|
1772
|
-
/**
|
|
1773
|
-
|
|
2018
|
+
/**
|
|
2019
|
+
* Names a selector axis supported by {@link BrowserSelectorManagerInterface}.
|
|
2020
|
+
*
|
|
2021
|
+
* @remarks
|
|
2022
|
+
* `testId` mirrors the `data-testid` attribute {@link BROWSER_TEST_ID_ATTRIBUTE} names.
|
|
2023
|
+
*/
|
|
2024
|
+
export declare type BrowserSelector = 'css' | 'role' | 'text' | 'label' | 'placeholder' | 'testId';
|
|
1774
2025
|
|
|
1775
2026
|
/**
|
|
1776
|
-
*
|
|
2027
|
+
* Reports that a selector-based lookup or wait timed out without the element appearing.
|
|
1777
2028
|
*/
|
|
1778
2029
|
export declare class BrowserSelectorError extends BrowserError {
|
|
1779
2030
|
constructor(message: string, context?: Readonly<Record<string, unknown>>);
|
|
1780
2031
|
}
|
|
1781
2032
|
|
|
1782
2033
|
/**
|
|
1783
|
-
*
|
|
2034
|
+
* Creates semantic locators for one frame.
|
|
2035
|
+
*
|
|
2036
|
+
* @example
|
|
2037
|
+
* ```ts
|
|
2038
|
+
* import { BrowserSelectorManager } from '@orkestrel/browser'
|
|
2039
|
+
*
|
|
2040
|
+
* const selectors = new BrowserSelectorManager(page)
|
|
2041
|
+
* await selectors.role('button', { name: 'Save' }).click()
|
|
2042
|
+
* await selectors.testId('checkout').click()
|
|
2043
|
+
* ```
|
|
1784
2044
|
*/
|
|
1785
2045
|
export declare class BrowserSelectorManager implements BrowserSelectorManagerInterface {
|
|
1786
2046
|
#private;
|
|
@@ -1790,11 +2050,11 @@ export declare class BrowserSelectorManager implements BrowserSelectorManagerInt
|
|
|
1790
2050
|
text(value: string, options?: BrowserTextOptions): BrowserLocatorInterface;
|
|
1791
2051
|
label(value: string, options?: BrowserTextOptions): BrowserLocatorInterface;
|
|
1792
2052
|
placeholder(value: string, options?: BrowserTextOptions): BrowserLocatorInterface;
|
|
1793
|
-
|
|
2053
|
+
testId(value: string): BrowserLocatorInterface;
|
|
1794
2054
|
}
|
|
1795
2055
|
|
|
1796
2056
|
/**
|
|
1797
|
-
*
|
|
2057
|
+
* Groups the locator factories by selector semantics.
|
|
1798
2058
|
*/
|
|
1799
2059
|
export declare interface BrowserSelectorManagerInterface {
|
|
1800
2060
|
css(value: string): BrowserLocatorInterface;
|
|
@@ -1802,16 +2062,39 @@ export declare interface BrowserSelectorManagerInterface {
|
|
|
1802
2062
|
text(value: string, options?: BrowserTextOptions): BrowserLocatorInterface;
|
|
1803
2063
|
label(value: string, options?: BrowserTextOptions): BrowserLocatorInterface;
|
|
1804
2064
|
placeholder(value: string, options?: BrowserTextOptions): BrowserLocatorInterface;
|
|
1805
|
-
|
|
2065
|
+
testId(value: string): BrowserLocatorInterface;
|
|
1806
2066
|
}
|
|
1807
2067
|
|
|
1808
|
-
/**
|
|
2068
|
+
/**
|
|
2069
|
+
* Describes the options for one raw CDP method call issued in a frame's target session.
|
|
2070
|
+
*
|
|
2071
|
+
* @remarks
|
|
2072
|
+
* The frame supplies its own session, so a caller bounds the call and nothing
|
|
2073
|
+
* else.
|
|
2074
|
+
*
|
|
2075
|
+
* - `timeout` — ms before this one request fails, overriding the client-wide default
|
|
2076
|
+
*/
|
|
2077
|
+
export declare interface BrowserSendOptions {
|
|
2078
|
+
readonly timeout?: number;
|
|
2079
|
+
}
|
|
2080
|
+
|
|
2081
|
+
/** Resolves the current CDP session for a frame id. */
|
|
1809
2082
|
export declare type BrowserSessionFunction = (frame: string) => Promise<string>;
|
|
1810
2083
|
|
|
1811
|
-
/**
|
|
2084
|
+
/** Names a structural sibling relationship relative to a browser node. */
|
|
1812
2085
|
export declare type BrowserSiblingRelation = 'preceding' | 'following';
|
|
1813
2086
|
|
|
1814
|
-
/**
|
|
2087
|
+
/**
|
|
2088
|
+
* Represents a navigable, serializable browser DOM snapshot.
|
|
2089
|
+
*
|
|
2090
|
+
* @example
|
|
2091
|
+
* ```ts
|
|
2092
|
+
* import { BrowserSnapshot } from '@orkestrel/browser'
|
|
2093
|
+
*
|
|
2094
|
+
* const snapshot = new BrowserSnapshot({ documents, styles: ['display'] })
|
|
2095
|
+
* const main = snapshot.find({ name: 'main', visible: true })
|
|
2096
|
+
* ```
|
|
2097
|
+
*/
|
|
1815
2098
|
export declare class BrowserSnapshot implements BrowserSnapshotInterface {
|
|
1816
2099
|
#private;
|
|
1817
2100
|
readonly documents: readonly BrowserDocument[];
|
|
@@ -1832,13 +2115,13 @@ export declare class BrowserSnapshot implements BrowserSnapshotInterface {
|
|
|
1832
2115
|
path(node: BrowserNode): string;
|
|
1833
2116
|
}
|
|
1834
2117
|
|
|
1835
|
-
/**
|
|
2118
|
+
/** Describes the serializable input for a navigable browser snapshot. */
|
|
1836
2119
|
export declare interface BrowserSnapshotInput {
|
|
1837
2120
|
readonly documents: readonly BrowserDocument[];
|
|
1838
2121
|
readonly styles: readonly string[];
|
|
1839
2122
|
}
|
|
1840
2123
|
|
|
1841
|
-
/**
|
|
2124
|
+
/** Represents a navigable, serializable snapshot of every document attached to a page. */
|
|
1842
2125
|
export declare interface BrowserSnapshotInterface extends BrowserSnapshotInput {
|
|
1843
2126
|
walk(options?: BrowserWalkOptions): Generator<BrowserNode, void, unknown>;
|
|
1844
2127
|
descendants(node: BrowserNode): Generator<BrowserNode, void, unknown>;
|
|
@@ -1856,7 +2139,7 @@ export declare interface BrowserSnapshotInterface extends BrowserSnapshotInput {
|
|
|
1856
2139
|
}
|
|
1857
2140
|
|
|
1858
2141
|
/**
|
|
1859
|
-
*
|
|
2142
|
+
* Describes the options configuring capture through {@link BrowserPageInterface} `snapshot()`.
|
|
1860
2143
|
* The snapshot entity's creation input is {@link BrowserSnapshotInput}.
|
|
1861
2144
|
*
|
|
1862
2145
|
* @remarks
|
|
@@ -1872,7 +2155,7 @@ export declare interface BrowserSnapshotOptions {
|
|
|
1872
2155
|
readonly limit?: number;
|
|
1873
2156
|
}
|
|
1874
2157
|
|
|
1875
|
-
/**
|
|
2158
|
+
/** Represents one browser-side stack frame. */
|
|
1876
2159
|
export declare interface BrowserStackFrame {
|
|
1877
2160
|
readonly url: string;
|
|
1878
2161
|
readonly function: string;
|
|
@@ -1880,71 +2163,78 @@ export declare interface BrowserStackFrame {
|
|
|
1880
2163
|
readonly column: number;
|
|
1881
2164
|
}
|
|
1882
2165
|
|
|
1883
|
-
/**
|
|
2166
|
+
/** Represents one key/value pair from web storage. */
|
|
1884
2167
|
export declare interface BrowserStorageEntry {
|
|
1885
2168
|
readonly name: string;
|
|
1886
2169
|
readonly value: string;
|
|
1887
2170
|
}
|
|
1888
2171
|
|
|
1889
2172
|
/**
|
|
1890
|
-
*
|
|
2173
|
+
* Imports, exports, and clears cookie and web-storage state for one browser context.
|
|
2174
|
+
*
|
|
2175
|
+
* @example
|
|
2176
|
+
* ```ts
|
|
2177
|
+
* import { BrowserStorageManager } from '@orkestrel/browser'
|
|
2178
|
+
*
|
|
2179
|
+
* const storage = new BrowserStorageManager(context.cookies, () => context.pages())
|
|
2180
|
+
* const state = await storage.state({ origins: ['https://example.com'] })
|
|
2181
|
+
* await storage.restore(state)
|
|
2182
|
+
* ```
|
|
1891
2183
|
*/
|
|
1892
2184
|
export declare class BrowserStorageManager implements BrowserStorageManagerInterface {
|
|
1893
2185
|
#private;
|
|
1894
|
-
constructor(cookies: BrowserCookieManagerInterface, pages:
|
|
2186
|
+
constructor(cookies: BrowserCookieManagerInterface, pages: BrowserPagesFunction);
|
|
1895
2187
|
state(options?: BrowserStorageOptions): Promise<BrowserStorageState>;
|
|
1896
2188
|
restore(state: BrowserStorageState): Promise<void>;
|
|
1897
2189
|
clear(origin?: string): Promise<void>;
|
|
1898
2190
|
}
|
|
1899
2191
|
|
|
1900
|
-
/**
|
|
2192
|
+
/** Provides storage-state import, export, and clearing operations. */
|
|
1901
2193
|
export declare interface BrowserStorageManagerInterface {
|
|
1902
2194
|
state(options?: BrowserStorageOptions): Promise<BrowserStorageState>;
|
|
1903
2195
|
restore(state: BrowserStorageState): Promise<void>;
|
|
1904
2196
|
clear(origin?: string): Promise<void>;
|
|
1905
2197
|
}
|
|
1906
2198
|
|
|
1907
|
-
/**
|
|
2199
|
+
/** Describes the options for collecting storage state from selected origins. */
|
|
1908
2200
|
export declare interface BrowserStorageOptions {
|
|
1909
2201
|
readonly origins?: readonly string[];
|
|
1910
2202
|
}
|
|
1911
2203
|
|
|
1912
|
-
/**
|
|
2204
|
+
/** Describes an origin-scoped local and session storage snapshot. */
|
|
1913
2205
|
export declare interface BrowserStorageOrigin {
|
|
1914
2206
|
readonly origin: string;
|
|
1915
2207
|
readonly local: readonly BrowserStorageEntry[];
|
|
1916
2208
|
readonly session: readonly BrowserStorageEntry[];
|
|
1917
2209
|
}
|
|
1918
2210
|
|
|
1919
|
-
/**
|
|
2211
|
+
/** Describes a portable browser authentication and storage snapshot. */
|
|
1920
2212
|
export declare interface BrowserStorageState {
|
|
1921
2213
|
readonly cookies: readonly BrowserCookieInput[];
|
|
1922
2214
|
readonly origins: readonly BrowserStorageOrigin[];
|
|
1923
2215
|
}
|
|
1924
2216
|
|
|
1925
|
-
/**
|
|
2217
|
+
/** Represents one decoded IO stream read. */
|
|
1926
2218
|
export declare interface BrowserStreamChunk {
|
|
1927
2219
|
readonly bytes: Uint8Array;
|
|
1928
2220
|
readonly eof: boolean;
|
|
1929
2221
|
}
|
|
1930
2222
|
|
|
1931
|
-
/** CSS stylesheet coverage. */
|
|
2223
|
+
/** Describes CSS stylesheet coverage. */
|
|
1932
2224
|
export declare interface BrowserStyleCoverage {
|
|
1933
2225
|
readonly id: string;
|
|
1934
2226
|
readonly ranges: readonly BrowserCoverageRange[];
|
|
1935
2227
|
}
|
|
1936
2228
|
|
|
1937
|
-
/**
|
|
2229
|
+
/** Runs one teardown step to settlement while the first failure is retained. */
|
|
2230
|
+
export declare type BrowserTeardownFunction = () => Promise<unknown>;
|
|
2231
|
+
|
|
2232
|
+
/** Describes the options for text-like locator creation. */
|
|
1938
2233
|
export declare interface BrowserTextOptions {
|
|
1939
2234
|
readonly exact?: boolean;
|
|
1940
2235
|
}
|
|
1941
2236
|
|
|
1942
|
-
/**
|
|
1943
|
-
export declare interface BrowserTextResultOptions {
|
|
1944
|
-
readonly all?: boolean;
|
|
1945
|
-
}
|
|
1946
|
-
|
|
1947
|
-
/** Network timing values in milliseconds relative to request time. */
|
|
2237
|
+
/** Holds network timing values in milliseconds relative to request time. */
|
|
1948
2238
|
export declare interface BrowserTiming {
|
|
1949
2239
|
readonly request: number;
|
|
1950
2240
|
readonly proxy: BrowserTimingRange | undefined;
|
|
@@ -1955,14 +2245,22 @@ export declare interface BrowserTiming {
|
|
|
1955
2245
|
readonly receive: number | undefined;
|
|
1956
2246
|
}
|
|
1957
2247
|
|
|
1958
|
-
/**
|
|
2248
|
+
/** Describes the start/end pair for one network timing phase. */
|
|
1959
2249
|
export declare interface BrowserTimingRange {
|
|
1960
2250
|
readonly start: number;
|
|
1961
2251
|
readonly end: number;
|
|
1962
2252
|
}
|
|
1963
2253
|
|
|
1964
2254
|
/**
|
|
1965
|
-
*
|
|
2255
|
+
* Sends trusted touch input through Chromium's CDP Input domain.
|
|
2256
|
+
*
|
|
2257
|
+
* @example
|
|
2258
|
+
* ```ts
|
|
2259
|
+
* import { BrowserTouch } from '@orkestrel/browser'
|
|
2260
|
+
*
|
|
2261
|
+
* const touch = new BrowserTouch(page)
|
|
2262
|
+
* await touch.tap({ x: 120, y: 240 })
|
|
2263
|
+
* ```
|
|
1966
2264
|
*/
|
|
1967
2265
|
export declare class BrowserTouch implements BrowserTouchInterface {
|
|
1968
2266
|
#private;
|
|
@@ -1970,24 +2268,33 @@ export declare class BrowserTouch implements BrowserTouchInterface {
|
|
|
1970
2268
|
tap(point: BrowserPoint): Promise<void>;
|
|
1971
2269
|
}
|
|
1972
2270
|
|
|
1973
|
-
/**
|
|
2271
|
+
/** Provides touch input operations bound to one frame target session. */
|
|
1974
2272
|
export declare interface BrowserTouchInterface {
|
|
1975
2273
|
tap(point: BrowserPoint): Promise<void>;
|
|
1976
2274
|
}
|
|
1977
2275
|
|
|
1978
2276
|
/**
|
|
1979
|
-
* Chromium
|
|
2277
|
+
* Captures Chromium traces streamed through the IO domain.
|
|
2278
|
+
*
|
|
2279
|
+
* @example
|
|
2280
|
+
* ```ts
|
|
2281
|
+
* import { BrowserTracing } from '@orkestrel/browser'
|
|
2282
|
+
*
|
|
2283
|
+
* const tracing = new BrowserTracing(page)
|
|
2284
|
+
* await tracing.start({ screenshots: true })
|
|
2285
|
+
* const trace = await tracing.stop() // { bytes, path }
|
|
2286
|
+
* ```
|
|
1980
2287
|
*/
|
|
1981
2288
|
export declare class BrowserTracing implements BrowserTracingInterface {
|
|
1982
2289
|
#private;
|
|
1983
|
-
constructor(frame: BrowserFrameInterface, writer?:
|
|
2290
|
+
constructor(frame: BrowserFrameInterface, writer?: BrowserWriterInterface);
|
|
1984
2291
|
get active(): boolean;
|
|
1985
2292
|
start(options?: BrowserTracingOptions): Promise<void>;
|
|
1986
2293
|
stop(): Promise<BrowserTracingResult>;
|
|
1987
2294
|
destroy(): Promise<void>;
|
|
1988
2295
|
}
|
|
1989
2296
|
|
|
1990
|
-
/**
|
|
2297
|
+
/** Drives the trace capture lifecycle. */
|
|
1991
2298
|
export declare interface BrowserTracingInterface {
|
|
1992
2299
|
readonly active: boolean;
|
|
1993
2300
|
start(options?: BrowserTracingOptions): Promise<void>;
|
|
@@ -1995,7 +2302,7 @@ export declare interface BrowserTracingInterface {
|
|
|
1995
2302
|
destroy(): Promise<void>;
|
|
1996
2303
|
}
|
|
1997
2304
|
|
|
1998
|
-
/** Chromium trace capture
|
|
2305
|
+
/** Describes the options for a Chromium trace capture. */
|
|
1999
2306
|
export declare interface BrowserTracingOptions {
|
|
2000
2307
|
readonly path?: string;
|
|
2001
2308
|
readonly categories?: readonly string[];
|
|
@@ -2003,25 +2310,69 @@ export declare interface BrowserTracingOptions {
|
|
|
2003
2310
|
readonly sampling?: boolean;
|
|
2004
2311
|
}
|
|
2005
2312
|
|
|
2006
|
-
/**
|
|
2313
|
+
/** Describes the result of a trace capture. */
|
|
2007
2314
|
export declare interface BrowserTracingResult {
|
|
2008
2315
|
readonly bytes: Uint8Array;
|
|
2009
2316
|
readonly path: string | undefined;
|
|
2010
2317
|
}
|
|
2011
2318
|
|
|
2012
|
-
/**
|
|
2319
|
+
/**
|
|
2320
|
+
* Runs one asynchronous transition at a time, shared by every caller that joins it.
|
|
2321
|
+
*
|
|
2322
|
+
* @remarks
|
|
2323
|
+
* An entity with a lifecycle runs the same guard around every transition: take
|
|
2324
|
+
* the promise already in flight when one exists, otherwise start the work, hold
|
|
2325
|
+
* its promise, and release the field afterwards only when it is still this
|
|
2326
|
+
* run's. Holding that guard in one place keeps the identity check — the part a
|
|
2327
|
+
* hand-written copy drops — identical at every site. The entry guards stay with
|
|
2328
|
+
* each entity, because what makes a transition unnecessary is the entity's own
|
|
2329
|
+
* state.
|
|
2330
|
+
*
|
|
2331
|
+
* @example
|
|
2332
|
+
* ```ts
|
|
2333
|
+
* import { BrowserTransition } from '@orkestrel/browser'
|
|
2334
|
+
*
|
|
2335
|
+
* const starting = new BrowserTransition()
|
|
2336
|
+
* await starting.execute(() => transport.start())
|
|
2337
|
+
* const joined = starting.pending // the in-flight promise, or undefined
|
|
2338
|
+
* ```
|
|
2339
|
+
*/
|
|
2340
|
+
export declare class BrowserTransition<T = void> implements BrowserTransitionInterface<T> {
|
|
2341
|
+
#private;
|
|
2342
|
+
get pending(): Promise<T> | undefined;
|
|
2343
|
+
execute(work: BrowserTransitionFunction<T>): Promise<T>;
|
|
2344
|
+
}
|
|
2345
|
+
|
|
2346
|
+
/** Runs the work one {@link BrowserTransitionInterface} transition performs. */
|
|
2347
|
+
export declare type BrowserTransitionFunction<T> = () => Promise<T>;
|
|
2348
|
+
|
|
2349
|
+
/**
|
|
2350
|
+
* Represents one asynchronous transition shared by every caller that arrives while it runs.
|
|
2351
|
+
*
|
|
2352
|
+
* @remarks
|
|
2353
|
+
* `pending` is the promise of the transition in flight, or undefined when none
|
|
2354
|
+
* is running; an entity reads it to answer a question about its own state, such
|
|
2355
|
+
* as whether a close must wait for an in-flight connect. `execute` starts the
|
|
2356
|
+
* work when nothing is in flight, and joins the running transition otherwise.
|
|
2357
|
+
*/
|
|
2358
|
+
export declare interface BrowserTransitionInterface<T> {
|
|
2359
|
+
readonly pending: Promise<T> | undefined;
|
|
2360
|
+
execute(work: BrowserTransitionFunction<T>): Promise<T>;
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2363
|
+
/** Describes the options for setting files on a file input. */
|
|
2013
2364
|
export declare interface BrowserUploadOptions extends BrowserActionOptions {
|
|
2014
2365
|
readonly files: readonly string[];
|
|
2015
2366
|
}
|
|
2016
2367
|
|
|
2017
|
-
/**
|
|
2368
|
+
/** Describes user-agent metadata accepted by Chromium emulation. */
|
|
2018
2369
|
export declare interface BrowserUserAgent {
|
|
2019
2370
|
readonly value: string;
|
|
2020
2371
|
readonly language?: string;
|
|
2021
2372
|
readonly platform?: string;
|
|
2022
2373
|
}
|
|
2023
2374
|
|
|
2024
|
-
/**
|
|
2375
|
+
/** Describes the viewport dimensions for a browser page. */
|
|
2025
2376
|
export declare interface BrowserViewport {
|
|
2026
2377
|
readonly width: number;
|
|
2027
2378
|
readonly height: number;
|
|
@@ -2032,7 +2383,7 @@ export declare interface BrowserViewport {
|
|
|
2032
2383
|
}
|
|
2033
2384
|
|
|
2034
2385
|
/**
|
|
2035
|
-
*
|
|
2386
|
+
* Describes the options for waiting on an element.
|
|
2036
2387
|
*
|
|
2037
2388
|
* @remarks
|
|
2038
2389
|
* - `timeout` — maximum time to wait in milliseconds
|
|
@@ -2043,14 +2394,14 @@ export declare interface BrowserWaitOptions extends BrowserActionOptions {
|
|
|
2043
2394
|
readonly state?: BrowserWaitState;
|
|
2044
2395
|
}
|
|
2045
2396
|
|
|
2046
|
-
/**
|
|
2397
|
+
/** Names an element state a frame or page can wait for. */
|
|
2047
2398
|
export declare type BrowserWaitState = 'attached' | 'detached' | 'visible' | 'hidden';
|
|
2048
2399
|
|
|
2049
|
-
/**
|
|
2400
|
+
/** Names the page load condition for navigation — the CDP load event awaited by `navigate()`. */
|
|
2050
2401
|
export declare type BrowserWaitUntil = 'commit' | 'load' | 'domcontentloaded';
|
|
2051
2402
|
|
|
2052
2403
|
/**
|
|
2053
|
-
*
|
|
2404
|
+
* Describes the options for walking a browser snapshot.
|
|
2054
2405
|
*
|
|
2055
2406
|
* @remarks
|
|
2056
2407
|
* - `root` — optional subtree root, included in the walk
|
|
@@ -2061,11 +2412,19 @@ export declare interface BrowserWalkOptions {
|
|
|
2061
2412
|
readonly order?: BrowserWalkOrder;
|
|
2062
2413
|
}
|
|
2063
2414
|
|
|
2064
|
-
/**
|
|
2415
|
+
/** Names the structural ordering for a browser snapshot walk. */
|
|
2065
2416
|
export declare type BrowserWalkOrder = 'depth' | 'breadth';
|
|
2066
2417
|
|
|
2067
2418
|
/**
|
|
2068
|
-
*
|
|
2419
|
+
* Represents an observable WebSocket connection reconstructed from Network-domain events.
|
|
2420
|
+
*
|
|
2421
|
+
* @example
|
|
2422
|
+
* ```ts
|
|
2423
|
+
* import { BrowserWebSocket } from '@orkestrel/browser'
|
|
2424
|
+
*
|
|
2425
|
+
* const socket = new BrowserWebSocket('request-1', 'wss://example.com/live')
|
|
2426
|
+
* socket.emitter.on('receive', (frame) => log(frame.data))
|
|
2427
|
+
* ```
|
|
2069
2428
|
*/
|
|
2070
2429
|
export declare class BrowserWebSocket implements BrowserWebSocketInterface {
|
|
2071
2430
|
#private;
|
|
@@ -2079,7 +2438,7 @@ export declare class BrowserWebSocket implements BrowserWebSocketInterface {
|
|
|
2079
2438
|
close(timestamp: number): void;
|
|
2080
2439
|
}
|
|
2081
2440
|
|
|
2082
|
-
/** WebSocket lifecycle events. */
|
|
2441
|
+
/** Maps the WebSocket lifecycle events. */
|
|
2083
2442
|
export declare type BrowserWebSocketEventMap = {
|
|
2084
2443
|
readonly receive: readonly [frame: BrowserWebSocketFrame];
|
|
2085
2444
|
readonly transmit: readonly [frame: BrowserWebSocketFrame];
|
|
@@ -2087,7 +2446,7 @@ export declare type BrowserWebSocketEventMap = {
|
|
|
2087
2446
|
readonly close: readonly [timestamp: number];
|
|
2088
2447
|
};
|
|
2089
2448
|
|
|
2090
|
-
/** WebSocket frame payload. */
|
|
2449
|
+
/** Describes a WebSocket frame payload. */
|
|
2091
2450
|
export declare interface BrowserWebSocketFrame {
|
|
2092
2451
|
readonly opcode: number;
|
|
2093
2452
|
readonly data: string;
|
|
@@ -2095,36 +2454,33 @@ export declare interface BrowserWebSocketFrame {
|
|
|
2095
2454
|
readonly timestamp: number;
|
|
2096
2455
|
}
|
|
2097
2456
|
|
|
2098
|
-
/**
|
|
2457
|
+
/**
|
|
2458
|
+
* Represents one observed WebSocket connection.
|
|
2459
|
+
*
|
|
2460
|
+
* @remarks
|
|
2461
|
+
* The connection is an observation: a page's network manager reconstructs it
|
|
2462
|
+
* from Network-domain events and drives the concrete `BrowserWebSocket`. The
|
|
2463
|
+
* drive methods are on this contract because the class exposes exactly its
|
|
2464
|
+
* interface methods.
|
|
2465
|
+
*/
|
|
2099
2466
|
export declare interface BrowserWebSocketInterface {
|
|
2100
2467
|
readonly emitter: EmitterInterface<BrowserWebSocketEventMap>;
|
|
2101
2468
|
readonly id: string;
|
|
2102
2469
|
readonly url: string;
|
|
2470
|
+
/** Reports one received frame. The page's network manager drives it. */
|
|
2103
2471
|
receive(frame: BrowserWebSocketFrame): void;
|
|
2472
|
+
/** Reports one sent frame. The page's network manager drives it. */
|
|
2104
2473
|
transmit(frame: BrowserWebSocketFrame): void;
|
|
2474
|
+
/** Reports a connection fault. The page's network manager drives it. */
|
|
2105
2475
|
fail(message: string): void;
|
|
2476
|
+
/** Reports the connection closing and destroys the emitter. The page's network manager drives it. */
|
|
2106
2477
|
close(timestamp: number): void;
|
|
2107
2478
|
}
|
|
2108
2479
|
|
|
2109
|
-
/**
|
|
2110
|
-
* Dedicated, shared, or service worker attached through a flattened target session.
|
|
2111
|
-
*/
|
|
2112
|
-
export declare class BrowserWorker implements BrowserWorkerInterface {
|
|
2113
|
-
#private;
|
|
2114
|
-
constructor(client: CDPClientInterface, session: string, id: string, url: string, category: BrowserWorkerCategory);
|
|
2115
|
-
get id(): string;
|
|
2116
|
-
get url(): string;
|
|
2117
|
-
get category(): BrowserWorkerCategory;
|
|
2118
|
-
evaluate(expression: string, timeout?: number): Promise<unknown>;
|
|
2119
|
-
send(method: string, params?: Readonly<Record<string, unknown>>): Promise<unknown>;
|
|
2120
|
-
detach(): void;
|
|
2121
|
-
close(): Promise<void>;
|
|
2122
|
-
}
|
|
2123
|
-
|
|
2124
|
-
/** Worker target category. */
|
|
2480
|
+
/** Names a worker target category. */
|
|
2125
2481
|
export declare type BrowserWorkerCategory = 'worker' | 'service_worker' | 'shared_worker';
|
|
2126
2482
|
|
|
2127
|
-
/**
|
|
2483
|
+
/** Represents a script worker attached to a page target. */
|
|
2128
2484
|
export declare interface BrowserWorkerInterface {
|
|
2129
2485
|
readonly id: string;
|
|
2130
2486
|
readonly url: string;
|
|
@@ -2135,11 +2491,23 @@ export declare interface BrowserWorkerInterface {
|
|
|
2135
2491
|
close(): Promise<void>;
|
|
2136
2492
|
}
|
|
2137
2493
|
|
|
2138
|
-
/**
|
|
2494
|
+
/**
|
|
2495
|
+
* Provides a pluggable sink for persisting captured browser bytes to a path.
|
|
2496
|
+
*
|
|
2497
|
+
* @remarks
|
|
2498
|
+
* Core never touches a filesystem directly — a page accepts an optional
|
|
2499
|
+
* writer (server supplies an `fs`-backed implementation) and calls it when a
|
|
2500
|
+
* screenshot, PDF, trace, or HAR request carries a `path`.
|
|
2501
|
+
*/
|
|
2502
|
+
export declare interface BrowserWriterInterface {
|
|
2503
|
+
write(path: string, data: Uint8Array): Promise<void>;
|
|
2504
|
+
}
|
|
2505
|
+
|
|
2506
|
+
/** Decodes UTF-8 bytes as text. */
|
|
2139
2507
|
export declare function bytesToText(value: Uint8Array): string;
|
|
2140
2508
|
|
|
2141
2509
|
/**
|
|
2142
|
-
*
|
|
2510
|
+
* Provides a lightweight Chrome DevTools Protocol client over a {@link CDPTransportInterface}.
|
|
2143
2511
|
*
|
|
2144
2512
|
* @remarks
|
|
2145
2513
|
* Sends JSON-RPC messages over the injected transport and dispatches
|
|
@@ -2147,18 +2515,28 @@ export declare function bytesToText(value: Uint8Array): string;
|
|
|
2147
2515
|
* (WebSocket, pipe, or any other duplex channel); this class owns only
|
|
2148
2516
|
* the JSON-RPC framing and id/session correlation.
|
|
2149
2517
|
*
|
|
2150
|
-
* Supports session-scoped event subscriptions:
|
|
2151
|
-
*
|
|
2152
|
-
*
|
|
2153
|
-
*
|
|
2518
|
+
* Supports session-scoped event subscriptions: a subscription registered
|
|
2519
|
+
* without a session id receives the event whatever session carries it, and a
|
|
2520
|
+
* session-scoped subscription receives only its own session's events.
|
|
2521
|
+
*
|
|
2522
|
+
* @example
|
|
2523
|
+
* ```ts
|
|
2524
|
+
* import { CDPClient } from '@orkestrel/browser'
|
|
2525
|
+
*
|
|
2526
|
+
* const client = new CDPClient({ transport })
|
|
2527
|
+
* await client.connect()
|
|
2528
|
+
* const targets = await client.send('Target.getTargets')
|
|
2529
|
+
* await client.close()
|
|
2530
|
+
* ```
|
|
2154
2531
|
*/
|
|
2155
2532
|
export declare class CDPClient implements CDPClientInterface {
|
|
2156
2533
|
#private;
|
|
2157
2534
|
constructor(options: CDPClientOptions);
|
|
2535
|
+
get emitter(): EmitterInterface<CDPClientEventMap>;
|
|
2158
2536
|
get connected(): boolean;
|
|
2159
2537
|
connect(): Promise<void>;
|
|
2160
2538
|
/**
|
|
2161
|
-
*
|
|
2539
|
+
* Closes the transport and re-establishes a fresh connection.
|
|
2162
2540
|
*
|
|
2163
2541
|
* @remarks
|
|
2164
2542
|
* Client-level subscriptions (`subscribe`/`unsubscribe` registrations)
|
|
@@ -2167,14 +2545,14 @@ export declare class CDPClient implements CDPClientInterface {
|
|
|
2167
2545
|
* transport without re-registering every handler.
|
|
2168
2546
|
*/
|
|
2169
2547
|
reconnect(): Promise<void>;
|
|
2170
|
-
send(method: string, params?: Readonly<Record<string, unknown>>,
|
|
2171
|
-
subscribe(method: string, handler: CDPHandler,
|
|
2172
|
-
unsubscribe(method: string, handler: CDPHandler,
|
|
2548
|
+
send(method: string, params?: Readonly<Record<string, unknown>>, options?: CDPSendOptions): Promise<unknown>;
|
|
2549
|
+
subscribe(method: string, handler: CDPHandler, session?: string): void;
|
|
2550
|
+
unsubscribe(method: string, handler: CDPHandler, session?: string): void;
|
|
2173
2551
|
/**
|
|
2174
|
-
*
|
|
2552
|
+
* Closes the transport and rejects all pending requests.
|
|
2175
2553
|
*
|
|
2176
2554
|
* @remarks
|
|
2177
|
-
* Subscriptions registered
|
|
2555
|
+
* Subscriptions registered through `subscribe()` are client-level
|
|
2178
2556
|
* registrations, not connection-level state — they survive `close()`
|
|
2179
2557
|
* (and a subsequent `reconnect()`/`connect()`) and keep firing once the
|
|
2180
2558
|
* transport is active again. Only pending requests are rejected here.
|
|
@@ -2186,9 +2564,27 @@ export declare class CDPClient implements CDPClientInterface {
|
|
|
2186
2564
|
}
|
|
2187
2565
|
|
|
2188
2566
|
/**
|
|
2189
|
-
*
|
|
2567
|
+
* Maps the events a {@link CDPClientInterface} emits.
|
|
2568
|
+
*
|
|
2569
|
+
* @remarks
|
|
2570
|
+
* `connect` fires once the transport started and dispatch began; `close`
|
|
2571
|
+
* fires after an explicit teardown, including one that interrupted a
|
|
2572
|
+
* pending `connect()`; `drop` fires when the transport ended without a
|
|
2573
|
+
* close request; `error` carries a transport-level fault (unknown shape —
|
|
2574
|
+
* narrow before use).
|
|
2575
|
+
*/
|
|
2576
|
+
export declare type CDPClientEventMap = {
|
|
2577
|
+
readonly connect: readonly [];
|
|
2578
|
+
readonly close: readonly [];
|
|
2579
|
+
readonly drop: readonly [];
|
|
2580
|
+
readonly error: readonly [error: unknown];
|
|
2581
|
+
};
|
|
2582
|
+
|
|
2583
|
+
/**
|
|
2584
|
+
* Provides a lightweight Chrome DevTools Protocol client over a {@link CDPTransportInterface}.
|
|
2190
2585
|
*
|
|
2191
2586
|
* @remarks
|
|
2587
|
+
* - `emitter` — subscribe to the client's own connection lifecycle
|
|
2192
2588
|
* - `connected` — true while the transport is active
|
|
2193
2589
|
* - `connect` — start the transport and begin dispatching
|
|
2194
2590
|
* - `reconnect` — close and re-establish the transport
|
|
@@ -2200,29 +2596,39 @@ export declare class CDPClient implements CDPClientInterface {
|
|
|
2200
2596
|
* - `close` — tear down the transport and reject all pending requests
|
|
2201
2597
|
*/
|
|
2202
2598
|
export declare interface CDPClientInterface {
|
|
2599
|
+
readonly emitter: EmitterInterface<CDPClientEventMap>;
|
|
2203
2600
|
readonly connected: boolean;
|
|
2204
2601
|
connect(): Promise<void>;
|
|
2205
2602
|
reconnect(): Promise<void>;
|
|
2206
|
-
send(method: string, params?: Readonly<Record<string, unknown>>,
|
|
2207
|
-
subscribe(method: string, handler: CDPHandler,
|
|
2208
|
-
unsubscribe(method: string, handler: CDPHandler,
|
|
2603
|
+
send(method: string, params?: Readonly<Record<string, unknown>>, options?: CDPSendOptions): Promise<unknown>;
|
|
2604
|
+
subscribe(method: string, handler: CDPHandler, session?: string): void;
|
|
2605
|
+
unsubscribe(method: string, handler: CDPHandler, session?: string): void;
|
|
2209
2606
|
close(): Promise<void>;
|
|
2210
2607
|
}
|
|
2211
2608
|
|
|
2212
2609
|
/**
|
|
2213
|
-
*
|
|
2610
|
+
* Describes the options for creating a CDPClient.
|
|
2214
2611
|
*
|
|
2215
2612
|
* @remarks
|
|
2216
2613
|
* - `transport` — the text pipe the client sends/receives JSON-RPC frames over
|
|
2217
2614
|
* - `timeout` — ms before a pending request or connection attempt fails (default from constants)
|
|
2615
|
+
* - `on` — initial event listeners wired at construction
|
|
2616
|
+
* - `error` — receives a throwing subscriber's error on both dispatch paths:
|
|
2617
|
+
* a CDP event subscriber's throw arrives with the CDP method that raised it,
|
|
2618
|
+
* and a lifecycle subscriber's throw arrives with the lifecycle event name
|
|
2619
|
+
* (`connect`, `close`, `drop`, `error`) as the second argument. Without it a
|
|
2620
|
+
* broken handler fails silently, because a throwing subscriber is never
|
|
2621
|
+
* allowed to reach its siblings or the dispatch loop
|
|
2218
2622
|
*/
|
|
2219
2623
|
export declare interface CDPClientOptions {
|
|
2220
2624
|
readonly transport: CDPTransportInterface;
|
|
2221
2625
|
readonly timeout?: number;
|
|
2626
|
+
readonly on?: EmitterHooks<CDPClientEventMap>;
|
|
2627
|
+
readonly error?: EmitterErrorHandler;
|
|
2222
2628
|
}
|
|
2223
2629
|
|
|
2224
2630
|
/**
|
|
2225
|
-
*
|
|
2631
|
+
* Reports that a CDP request could not be sent or completed because the client was not in
|
|
2226
2632
|
* a connectable state (not connected, closed while connecting, or the
|
|
2227
2633
|
* connection dropped mid-request).
|
|
2228
2634
|
*/
|
|
@@ -2231,7 +2637,7 @@ export declare class CDPConnectionError extends BrowserError {
|
|
|
2231
2637
|
}
|
|
2232
2638
|
|
|
2233
2639
|
/**
|
|
2234
|
-
*
|
|
2640
|
+
* Reports that a CDP request received an error response from the remote endpoint.
|
|
2235
2641
|
*
|
|
2236
2642
|
* @remarks
|
|
2237
2643
|
* Carries the originating `method` plus the CDP error's own `code`,
|
|
@@ -2242,26 +2648,44 @@ export declare class CDPError extends BrowserError {
|
|
|
2242
2648
|
constructor(message: string, context?: Readonly<Record<string, unknown>>);
|
|
2243
2649
|
}
|
|
2244
2650
|
|
|
2245
|
-
/**
|
|
2651
|
+
/** Receives a subscribed CDP event with its params record. */
|
|
2246
2652
|
export declare type CDPHandler = (params: Readonly<Record<string, unknown>>) => void;
|
|
2247
2653
|
|
|
2248
|
-
/**
|
|
2654
|
+
/**
|
|
2655
|
+
* Describes the options for one CDP method call.
|
|
2656
|
+
*
|
|
2657
|
+
* @remarks
|
|
2658
|
+
* - `session` — scope the call to one attached CDP session
|
|
2659
|
+
* - `timeout` — ms before this one request fails, overriding the client-wide default
|
|
2660
|
+
*/
|
|
2661
|
+
export declare interface CDPSendOptions {
|
|
2662
|
+
readonly session?: string;
|
|
2663
|
+
readonly timeout?: number;
|
|
2664
|
+
}
|
|
2665
|
+
|
|
2666
|
+
/**
|
|
2667
|
+
* Represents one entry of the CDP `Target.getTargets` result.
|
|
2668
|
+
*
|
|
2669
|
+
* @remarks
|
|
2670
|
+
* `category` mirrors the protocol's `type` field — `'page'`, `'worker'`,
|
|
2671
|
+
* `'browser'`, and the rest of Chromium's target categories.
|
|
2672
|
+
*/
|
|
2249
2673
|
export declare interface CDPTarget {
|
|
2250
2674
|
readonly id: string;
|
|
2251
|
-
readonly
|
|
2675
|
+
readonly category: string;
|
|
2252
2676
|
readonly title: string;
|
|
2253
2677
|
readonly url: string;
|
|
2254
2678
|
}
|
|
2255
2679
|
|
|
2256
2680
|
/**
|
|
2257
|
-
*
|
|
2681
|
+
* Reports that a pending CDP request was not answered within its timeout window.
|
|
2258
2682
|
*/
|
|
2259
2683
|
export declare class CDPTimeoutError extends BrowserError {
|
|
2260
2684
|
constructor(message: string, context?: Readonly<Record<string, unknown>>);
|
|
2261
2685
|
}
|
|
2262
2686
|
|
|
2263
2687
|
/**
|
|
2264
|
-
*
|
|
2688
|
+
* Maps the events emitted by a {@link CDPTransportInterface} — the raw text pipe a
|
|
2265
2689
|
* {@link CDPClientInterface} sends and receives JSON-RPC frames over.
|
|
2266
2690
|
*
|
|
2267
2691
|
* @remarks
|
|
@@ -2276,7 +2700,7 @@ export declare type CDPTransportEventMap = {
|
|
|
2276
2700
|
};
|
|
2277
2701
|
|
|
2278
2702
|
/**
|
|
2279
|
-
*
|
|
2703
|
+
* Represents a dumb text transport CDPClient sends and receives JSON-RPC frames over.
|
|
2280
2704
|
*
|
|
2281
2705
|
* @remarks
|
|
2282
2706
|
* The transport owns the connection (WebSocket, pipe, or any other duplex
|
|
@@ -2293,7 +2717,7 @@ export declare interface CDPTransportInterface {
|
|
|
2293
2717
|
}
|
|
2294
2718
|
|
|
2295
2719
|
/**
|
|
2296
|
-
*
|
|
2720
|
+
* Compiles the element-side actionability pass used before trusted input.
|
|
2297
2721
|
*
|
|
2298
2722
|
* @param options - Checks required for the action
|
|
2299
2723
|
* @returns Async `Runtime.callFunctionOn` function declaration
|
|
@@ -2301,12 +2725,12 @@ export declare interface CDPTransportInterface {
|
|
|
2301
2725
|
export declare function compileActionabilityFunction(options: BrowserActionabilityOptions): string;
|
|
2302
2726
|
|
|
2303
2727
|
/**
|
|
2304
|
-
*
|
|
2728
|
+
* Compiles an attached-state locator wait.
|
|
2305
2729
|
*/
|
|
2306
2730
|
export declare function compileAttachedLocatorWaitExpression(query: BrowserQuery, strict: boolean, timeout: number): string;
|
|
2307
2731
|
|
|
2308
2732
|
/**
|
|
2309
|
-
*
|
|
2733
|
+
* Compiles an in-page wait for an attached selector.
|
|
2310
2734
|
*
|
|
2311
2735
|
* @param selector - CSS selector
|
|
2312
2736
|
* @param strict - Whether more than one match is an error
|
|
@@ -2316,7 +2740,7 @@ export declare function compileAttachedLocatorWaitExpression(query: BrowserQuery
|
|
|
2316
2740
|
export declare function compileAttachedWaitExpression(selector: string, strict: boolean, timeout: number): string;
|
|
2317
2741
|
|
|
2318
2742
|
/**
|
|
2319
|
-
*
|
|
2743
|
+
* Compiles current-document cleanup for one page-side host binding facade.
|
|
2320
2744
|
*
|
|
2321
2745
|
* @param name - Binding identifier
|
|
2322
2746
|
* @returns Runtime cleanup expression
|
|
@@ -2324,7 +2748,7 @@ export declare function compileAttachedWaitExpression(selector: string, strict:
|
|
|
2324
2748
|
export declare function compileBrowserBindingCleanup(name: string): string;
|
|
2325
2749
|
|
|
2326
2750
|
/**
|
|
2327
|
-
*
|
|
2751
|
+
* Compiles delivery of a host binding result to one execution context.
|
|
2328
2752
|
*
|
|
2329
2753
|
* @param name - Binding identifier
|
|
2330
2754
|
* @param id - Call identifier
|
|
@@ -2335,7 +2759,7 @@ export declare function compileBrowserBindingCleanup(name: string): string;
|
|
|
2335
2759
|
export declare function compileBrowserBindingResult(name: string, id: string, success: boolean, value: unknown): string;
|
|
2336
2760
|
|
|
2337
2761
|
/**
|
|
2338
|
-
*
|
|
2762
|
+
* Compiles the page-side promise facade for one Runtime binding.
|
|
2339
2763
|
*
|
|
2340
2764
|
* @param name - Binding identifier
|
|
2341
2765
|
* @returns Self-installing script source
|
|
@@ -2343,7 +2767,7 @@ export declare function compileBrowserBindingResult(name: string, id: string, su
|
|
|
2343
2767
|
export declare function compileBrowserBindingSource(name: string): string;
|
|
2344
2768
|
|
|
2345
2769
|
/**
|
|
2346
|
-
*
|
|
2770
|
+
* Compiles a strict, visibility-checked click expression.
|
|
2347
2771
|
*
|
|
2348
2772
|
* @param selector - CSS selector
|
|
2349
2773
|
* @param strict - Whether more than one match is an error
|
|
@@ -2352,7 +2776,7 @@ export declare function compileBrowserBindingSource(name: string): string;
|
|
|
2352
2776
|
export declare function compileClickExpression(selector: string, strict: boolean): string;
|
|
2353
2777
|
|
|
2354
2778
|
/**
|
|
2355
|
-
*
|
|
2779
|
+
* Compiles recorded codegen actions into a replayable script.
|
|
2356
2780
|
*
|
|
2357
2781
|
* @remarks
|
|
2358
2782
|
* Emits one statement per action against a `page` object shaped like
|
|
@@ -2368,12 +2792,12 @@ export declare function compileClickExpression(selector: string, strict: boolean
|
|
|
2368
2792
|
export declare function compileCodegenScript(actions: readonly BrowserCodegenAction[], options?: BrowserCodegenScriptOptions): string;
|
|
2369
2793
|
|
|
2370
2794
|
/**
|
|
2371
|
-
*
|
|
2795
|
+
* Compiles a detached-state locator wait.
|
|
2372
2796
|
*/
|
|
2373
2797
|
export declare function compileDetachedLocatorWaitExpression(query: BrowserQuery, strict: boolean, timeout: number): string;
|
|
2374
2798
|
|
|
2375
2799
|
/**
|
|
2376
|
-
*
|
|
2800
|
+
* Compiles an in-page wait for a detached selector.
|
|
2377
2801
|
*
|
|
2378
2802
|
* @param selector - CSS selector
|
|
2379
2803
|
* @param strict - Whether more than one match is an error
|
|
@@ -2383,7 +2807,7 @@ export declare function compileDetachedLocatorWaitExpression(query: BrowserQuery
|
|
|
2383
2807
|
export declare function compileDetachedWaitExpression(selector: string, strict: boolean, timeout: number): string;
|
|
2384
2808
|
|
|
2385
2809
|
/**
|
|
2386
|
-
*
|
|
2810
|
+
* Compiles a strict, editable fill expression.
|
|
2387
2811
|
*
|
|
2388
2812
|
* @param selector - CSS selector
|
|
2389
2813
|
* @param value - Value to assign
|
|
@@ -2393,7 +2817,7 @@ export declare function compileDetachedWaitExpression(selector: string, strict:
|
|
|
2393
2817
|
export declare function compileFillExpression(selector: string, value: string, strict: boolean): string;
|
|
2394
2818
|
|
|
2395
2819
|
/**
|
|
2396
|
-
*
|
|
2820
|
+
* Compiles an auto-retrying in-page predicate wait.
|
|
2397
2821
|
*
|
|
2398
2822
|
* @param expression - Value or function expression
|
|
2399
2823
|
* @param timeout - Maximum wait in milliseconds
|
|
@@ -2402,12 +2826,36 @@ export declare function compileFillExpression(selector: string, value: string, s
|
|
|
2402
2826
|
export declare function compileFunctionWaitExpression(expression: string, timeout: number): string;
|
|
2403
2827
|
|
|
2404
2828
|
/**
|
|
2405
|
-
*
|
|
2829
|
+
* Compiles a `Runtime.evaluate` expression so the IN-PAGE code stringifies
|
|
2830
|
+
* its own result and throws a recognizable error before an oversized result
|
|
2831
|
+
* would overflow the CDP transport frame.
|
|
2832
|
+
*
|
|
2833
|
+
* @remarks
|
|
2834
|
+
* A result whose `JSON.stringify` length exceeds `limit` throws
|
|
2835
|
+
* `Error('BROWSER_RESULT_LIMIT: <length>')` inside the page instead of being
|
|
2836
|
+
* returned — the caller maps that sentinel to a coded
|
|
2837
|
+
* {@link BrowserResultLimitError}. A non-serializable result (`undefined`,
|
|
2838
|
+
* a function, a symbol) makes `JSON.stringify` return `undefined`, so the
|
|
2839
|
+
* length check is skipped and today's undefined-passthrough behavior is
|
|
2840
|
+
* unchanged.
|
|
2841
|
+
*
|
|
2842
|
+
* The expression is placed on its own line inside the wrapper (rather than
|
|
2843
|
+
* inline with the guard code) so a trailing `//` line comment in the
|
|
2844
|
+
* expression cannot swallow the closing guard syntax that follows it.
|
|
2845
|
+
*
|
|
2846
|
+
* @param expression - The candidate JavaScript expression to evaluate
|
|
2847
|
+
* @param limit - Maximum serialized-character length (see {@link BROWSER_RESULT_LIMIT})
|
|
2848
|
+
* @returns The wrapped, guarded expression
|
|
2849
|
+
*/
|
|
2850
|
+
export declare function compileGuardedEvaluateExpression(expression: string, limit: number): string;
|
|
2851
|
+
|
|
2852
|
+
/**
|
|
2853
|
+
* Compiles a hidden-state locator wait.
|
|
2406
2854
|
*/
|
|
2407
2855
|
export declare function compileHiddenLocatorWaitExpression(query: BrowserQuery, strict: boolean, timeout: number): string;
|
|
2408
2856
|
|
|
2409
2857
|
/**
|
|
2410
|
-
*
|
|
2858
|
+
* Compiles an in-page wait for a hidden selector.
|
|
2411
2859
|
*
|
|
2412
2860
|
* @param selector - CSS selector
|
|
2413
2861
|
* @param strict - Whether more than one match is an error
|
|
@@ -2417,7 +2865,7 @@ export declare function compileHiddenLocatorWaitExpression(query: BrowserQuery,
|
|
|
2417
2865
|
export declare function compileHiddenWaitExpression(selector: string, strict: boolean, timeout: number): string;
|
|
2418
2866
|
|
|
2419
2867
|
/**
|
|
2420
|
-
*
|
|
2868
|
+
* Compiles a deep locator query returning its first match.
|
|
2421
2869
|
*
|
|
2422
2870
|
* @param query - Serializable locator query
|
|
2423
2871
|
* @returns Runtime expression returning one element or undefined
|
|
@@ -2425,7 +2873,7 @@ export declare function compileHiddenWaitExpression(selector: string, strict: bo
|
|
|
2425
2873
|
export declare function compileLocatorExpression(query: BrowserQuery): string;
|
|
2426
2874
|
|
|
2427
2875
|
/**
|
|
2428
|
-
*
|
|
2876
|
+
* Compiles a deep, shadow-aware locator query returning every match.
|
|
2429
2877
|
*
|
|
2430
2878
|
* @param query - Serializable locator query
|
|
2431
2879
|
* @returns Runtime expression returning an element array
|
|
@@ -2433,7 +2881,7 @@ export declare function compileLocatorExpression(query: BrowserQuery): string;
|
|
|
2433
2881
|
export declare function compileLocatorListExpression(query: BrowserQuery): string;
|
|
2434
2882
|
|
|
2435
2883
|
/**
|
|
2436
|
-
*
|
|
2884
|
+
* Compiles cleanup for temporary screenshot styles and masks.
|
|
2437
2885
|
*
|
|
2438
2886
|
* @param token - Preparation token
|
|
2439
2887
|
* @returns Cleanup expression
|
|
@@ -2441,7 +2889,7 @@ export declare function compileLocatorListExpression(query: BrowserQuery): strin
|
|
|
2441
2889
|
export declare function compileScreenshotCleanupExpression(token: string): string;
|
|
2442
2890
|
|
|
2443
2891
|
/**
|
|
2444
|
-
*
|
|
2892
|
+
* Compiles temporary animation, caret, and mask setup for a screenshot.
|
|
2445
2893
|
*
|
|
2446
2894
|
* @param options - Screenshot controls
|
|
2447
2895
|
* @returns Setup expression or undefined when no preparation is required
|
|
@@ -2449,7 +2897,7 @@ export declare function compileScreenshotCleanupExpression(token: string): strin
|
|
|
2449
2897
|
export declare function compileScreenshotPreparationExpression(options?: BrowserScreenshotOptions): string | undefined;
|
|
2450
2898
|
|
|
2451
2899
|
/**
|
|
2452
|
-
*
|
|
2900
|
+
* Compiles a strict select expression.
|
|
2453
2901
|
*
|
|
2454
2902
|
* @param selector - CSS selector
|
|
2455
2903
|
* @param values - Option values to select
|
|
@@ -2459,21 +2907,21 @@ export declare function compileScreenshotPreparationExpression(options?: Browser
|
|
|
2459
2907
|
export declare function compileSelectExpression(selector: string, values: readonly string[], strict: boolean): string;
|
|
2460
2908
|
|
|
2461
2909
|
/**
|
|
2462
|
-
*
|
|
2910
|
+
* Compiles an expression that clears local and session storage.
|
|
2463
2911
|
*
|
|
2464
2912
|
* @returns In-page clear expression
|
|
2465
2913
|
*/
|
|
2466
2914
|
export declare function compileStorageClearExpression(): string;
|
|
2467
2915
|
|
|
2468
2916
|
/**
|
|
2469
|
-
*
|
|
2917
|
+
* Compiles an expression that serializes local and session storage.
|
|
2470
2918
|
*
|
|
2471
2919
|
* @returns In-page storage expression
|
|
2472
2920
|
*/
|
|
2473
2921
|
export declare function compileStorageReadExpression(): string;
|
|
2474
2922
|
|
|
2475
2923
|
/**
|
|
2476
|
-
*
|
|
2924
|
+
* Compiles an expression that restores one origin's web storage.
|
|
2477
2925
|
*
|
|
2478
2926
|
* @param origin - Storage values to restore
|
|
2479
2927
|
* @returns In-page restore expression
|
|
@@ -2481,12 +2929,12 @@ export declare function compileStorageReadExpression(): string;
|
|
|
2481
2929
|
export declare function compileStorageRestoreExpression(origin: BrowserStorageOrigin): string;
|
|
2482
2930
|
|
|
2483
2931
|
/**
|
|
2484
|
-
*
|
|
2932
|
+
* Compiles a visible-state locator wait.
|
|
2485
2933
|
*/
|
|
2486
2934
|
export declare function compileVisibleLocatorWaitExpression(query: BrowserQuery, strict: boolean, timeout: number): string;
|
|
2487
2935
|
|
|
2488
2936
|
/**
|
|
2489
|
-
*
|
|
2937
|
+
* Compiles an in-page wait for a visible selector.
|
|
2490
2938
|
*
|
|
2491
2939
|
* @param selector - CSS selector
|
|
2492
2940
|
* @param strict - Whether more than one match is an error
|
|
@@ -2496,7 +2944,7 @@ export declare function compileVisibleLocatorWaitExpression(query: BrowserQuery,
|
|
|
2496
2944
|
export declare function compileVisibleWaitExpression(selector: string, strict: boolean, timeout: number): string;
|
|
2497
2945
|
|
|
2498
2946
|
/**
|
|
2499
|
-
*
|
|
2947
|
+
* Computes the CDP Input pressed-button bitmask.
|
|
2500
2948
|
*
|
|
2501
2949
|
* @param buttons - Currently pressed public mouse buttons
|
|
2502
2950
|
* @returns Combined CDP pressed-button mask
|
|
@@ -2504,7 +2952,7 @@ export declare function compileVisibleWaitExpression(selector: string, strict: b
|
|
|
2504
2952
|
export declare function computeBrowserButtons(buttons: readonly BrowserMouseButton[]): number;
|
|
2505
2953
|
|
|
2506
2954
|
/**
|
|
2507
|
-
*
|
|
2955
|
+
* Computes the CDP Input modifier bitmask.
|
|
2508
2956
|
*
|
|
2509
2957
|
* @param modifiers - Canonical modifier names
|
|
2510
2958
|
* @returns Combined CDP modifier mask
|
|
@@ -2512,7 +2960,7 @@ export declare function computeBrowserButtons(buttons: readonly BrowserMouseButt
|
|
|
2512
2960
|
export declare function computeBrowserModifiers(modifiers: readonly string[]): number;
|
|
2513
2961
|
|
|
2514
2962
|
/**
|
|
2515
|
-
*
|
|
2963
|
+
* Concatenates byte chunks without Node-specific buffers.
|
|
2516
2964
|
*
|
|
2517
2965
|
* @param chunks - Byte arrays in source order
|
|
2518
2966
|
* @returns Combined bytes
|
|
@@ -2520,7 +2968,7 @@ export declare function computeBrowserModifiers(modifiers: readonly string[]): n
|
|
|
2520
2968
|
export declare function concatBytes(chunks: readonly Uint8Array[]): Uint8Array;
|
|
2521
2969
|
|
|
2522
2970
|
/**
|
|
2523
|
-
*
|
|
2971
|
+
* Converts a typed cookie input into Chromium protocol fields.
|
|
2524
2972
|
*
|
|
2525
2973
|
* @param cookie - Validated public cookie input
|
|
2526
2974
|
* @returns Protocol cookie record
|
|
@@ -2528,7 +2976,7 @@ export declare function concatBytes(chunks: readonly Uint8Array[]): Uint8Array;
|
|
|
2528
2976
|
export declare function cookieToProtocol(cookie: BrowserCookieInput): Readonly<Record<string, unknown>>;
|
|
2529
2977
|
|
|
2530
2978
|
/**
|
|
2531
|
-
*
|
|
2979
|
+
* Builds a standards-shaped HAR 1.2 entry from one observed exchange.
|
|
2532
2980
|
*
|
|
2533
2981
|
* @param pending - Request and optional response captured by the recorder
|
|
2534
2982
|
* @param duration - Whole exchange duration in milliseconds
|
|
@@ -2539,30 +2987,30 @@ export declare function cookieToProtocol(cookie: BrowserCookieInput): Readonly<R
|
|
|
2539
2987
|
export declare function createBrowserHAREntry(pending: BrowserHARPending, duration: number, body?: Uint8Array, error?: string): BrowserHAREntry;
|
|
2540
2988
|
|
|
2541
2989
|
/**
|
|
2542
|
-
*
|
|
2990
|
+
* Creates a navigable browser snapshot from decoded serializable data.
|
|
2543
2991
|
*
|
|
2544
2992
|
* @param input - Captured documents and computed-style names
|
|
2545
2993
|
* @returns A {@link BrowserSnapshotInterface}
|
|
2546
2994
|
*
|
|
2547
2995
|
* @example
|
|
2548
2996
|
* ```ts
|
|
2549
|
-
* import { createBrowserSnapshot,
|
|
2997
|
+
* import { createBrowserSnapshot, readBrowserSnapshot } from '@orkestrel/browser'
|
|
2550
2998
|
*
|
|
2551
|
-
* const snapshot = createBrowserSnapshot(
|
|
2999
|
+
* const snapshot = createBrowserSnapshot(readBrowserSnapshot(captured, ['display']))
|
|
2552
3000
|
* snapshot.find({ name: 'main' })
|
|
2553
3001
|
* ```
|
|
2554
3002
|
*/
|
|
2555
3003
|
export declare function createBrowserSnapshot(input: BrowserSnapshotInput): BrowserSnapshotInterface;
|
|
2556
3004
|
|
|
2557
3005
|
/**
|
|
2558
|
-
*
|
|
3006
|
+
* Creates a CDP client bound to the given transport.
|
|
2559
3007
|
*
|
|
2560
3008
|
* @param options - The transport (and optional timeout) the client uses
|
|
2561
3009
|
* @returns A {@link CDPClientInterface}
|
|
2562
3010
|
*
|
|
2563
3011
|
* @example
|
|
2564
3012
|
* ```ts
|
|
2565
|
-
* import { createCDPClient } from '@
|
|
3013
|
+
* import { createCDPClient } from '@orkestrel/browser'
|
|
2566
3014
|
*
|
|
2567
3015
|
* const client = createCDPClient({ transport })
|
|
2568
3016
|
* await client.connect()
|
|
@@ -2571,7 +3019,7 @@ export declare function createBrowserSnapshot(input: BrowserSnapshotInput): Brow
|
|
|
2571
3019
|
export declare function createCDPClient(options: CDPClientOptions): CDPClientInterface;
|
|
2572
3020
|
|
|
2573
3021
|
/**
|
|
2574
|
-
*
|
|
3022
|
+
* Decodes a base64-encoded string into raw bytes.
|
|
2575
3023
|
*
|
|
2576
3024
|
* @remarks
|
|
2577
3025
|
* Pure JS implementation — no `Buffer`, no `atob` (DOM-only) — so it runs
|
|
@@ -2589,51 +3037,7 @@ export declare function createCDPClient(options: CDPClientOptions): CDPClientInt
|
|
|
2589
3037
|
export declare function decodeBase64(text: string): Uint8Array;
|
|
2590
3038
|
|
|
2591
3039
|
/**
|
|
2592
|
-
*
|
|
2593
|
-
*
|
|
2594
|
-
* @param value - Candidate string-index array
|
|
2595
|
-
* @param strings - Snapshot string table
|
|
2596
|
-
* @returns Frozen attribute record
|
|
2597
|
-
*/
|
|
2598
|
-
export declare function decodeBrowserAttributes(value: unknown, strings: readonly string[]): Readonly<Record<string, string>>;
|
|
2599
|
-
|
|
2600
|
-
/**
|
|
2601
|
-
* Decode a CDP `DOMSnapshot.captureSnapshot` result.
|
|
2602
|
-
*
|
|
2603
|
-
* @param value - Unknown CDP result
|
|
2604
|
-
* @param styles - Requested computed-style names, in protocol order
|
|
2605
|
-
* @param limit - Maximum accepted node count
|
|
2606
|
-
* @returns A typed serializable browser snapshot
|
|
2607
|
-
*/
|
|
2608
|
-
export declare function decodeBrowserSnapshot(value: unknown, styles?: readonly string[], limit?: number): BrowserSnapshotInput;
|
|
2609
|
-
|
|
2610
|
-
/**
|
|
2611
|
-
* Decode CDP snapshot sparse boolean data.
|
|
2612
|
-
*
|
|
2613
|
-
* @param value - Sparse `{ index }` record
|
|
2614
|
-
* @returns Set of node indexes whose value is true
|
|
2615
|
-
*/
|
|
2616
|
-
export declare function decodeRareBooleanData(value: unknown): ReadonlySet<number>;
|
|
2617
|
-
|
|
2618
|
-
/**
|
|
2619
|
-
* Decode CDP snapshot sparse integer data.
|
|
2620
|
-
*
|
|
2621
|
-
* @param value - Sparse `{ index, value }` record
|
|
2622
|
-
* @returns Node-index to integer map
|
|
2623
|
-
*/
|
|
2624
|
-
export declare function decodeRareIntegerData(value: unknown): ReadonlyMap<number, number>;
|
|
2625
|
-
|
|
2626
|
-
/**
|
|
2627
|
-
* Decode CDP snapshot sparse string data.
|
|
2628
|
-
*
|
|
2629
|
-
* @param value - Sparse `{ index, value }` record
|
|
2630
|
-
* @param strings - Snapshot string table
|
|
2631
|
-
* @returns Node-index to string map
|
|
2632
|
-
*/
|
|
2633
|
-
export declare function decodeRareStringData(value: unknown, strings: readonly string[]): ReadonlyMap<number, string>;
|
|
2634
|
-
|
|
2635
|
-
/**
|
|
2636
|
-
* Encode raw bytes as base64 without relying on Node or DOM globals.
|
|
3040
|
+
* Encodes raw bytes as base64 without relying on Node or DOM globals.
|
|
2637
3041
|
*
|
|
2638
3042
|
* @param bytes - Raw input bytes
|
|
2639
3043
|
* @returns Base64 text
|
|
@@ -2641,46 +3045,31 @@ export declare function decodeRareStringData(value: unknown, strings: readonly s
|
|
|
2641
3045
|
export declare function encodeBase64(bytes: Uint8Array): string;
|
|
2642
3046
|
|
|
2643
3047
|
/**
|
|
2644
|
-
*
|
|
2645
|
-
* own result and throws a recognizable error before an oversized result
|
|
2646
|
-
* would overflow the CDP transport frame.
|
|
3048
|
+
* Extracts a keyboard chord such as `Control+Shift+P` into its parts.
|
|
2647
3049
|
*
|
|
2648
|
-
* @
|
|
2649
|
-
*
|
|
2650
|
-
*
|
|
2651
|
-
* returned — the caller maps that sentinel to a coded
|
|
2652
|
-
* {@link BrowserResultLimitError}. A non-serializable result (`undefined`,
|
|
2653
|
-
* a function, a symbol) makes `JSON.stringify` return `undefined`, so the
|
|
2654
|
-
* length check is skipped and today's undefined-passthrough behavior is
|
|
2655
|
-
* unchanged.
|
|
2656
|
-
*
|
|
2657
|
-
* The expression is placed on its own line inside the wrapper (rather than
|
|
2658
|
-
* inline with the guard code) so a trailing `//` line comment in the
|
|
2659
|
-
* expression cannot swallow the closing guard syntax that follows it.
|
|
2660
|
-
*
|
|
2661
|
-
* @param expression - The candidate JavaScript expression to evaluate
|
|
2662
|
-
* @param limit - Maximum serialized-character length (see {@link BROWSER_RESULT_LIMIT})
|
|
2663
|
-
* @returns The wrapped, guarded expression
|
|
3050
|
+
* @param value - Chord source
|
|
3051
|
+
* @returns Canonical modifiers and terminal key
|
|
3052
|
+
* @throws Thrown when the chord is empty or names an unsupported modifier.
|
|
2664
3053
|
*/
|
|
2665
|
-
export declare function
|
|
3054
|
+
export declare function extractBrowserChord(value: string): BrowserChord;
|
|
2666
3055
|
|
|
2667
3056
|
/**
|
|
2668
|
-
*
|
|
3057
|
+
* Narrows an unknown value to BrowserError.
|
|
2669
3058
|
*
|
|
2670
3059
|
* @param value - Value to check
|
|
2671
|
-
* @returns True
|
|
3060
|
+
* @returns True if value is a BrowserError instance; false otherwise
|
|
2672
3061
|
*/
|
|
2673
3062
|
export declare function isBrowserError(value: unknown): value is BrowserError;
|
|
2674
3063
|
|
|
2675
3064
|
/**
|
|
2676
|
-
*
|
|
3065
|
+
* Tests whether a browser-node matcher is a declarative query.
|
|
2677
3066
|
*
|
|
2678
3067
|
* @param value - Browser-node query or predicate
|
|
2679
|
-
* @returns
|
|
3068
|
+
* @returns True if the matcher is a declarative query; false otherwise
|
|
2680
3069
|
*
|
|
2681
3070
|
* @example
|
|
2682
3071
|
* ```ts
|
|
2683
|
-
* import { isBrowserNodeQuery } from '@
|
|
3072
|
+
* import { isBrowserNodeQuery } from '@orkestrel/browser'
|
|
2684
3073
|
*
|
|
2685
3074
|
* isBrowserNodeQuery({ name: 'main' }) // true
|
|
2686
3075
|
* isBrowserNodeQuery(() => true) // false
|
|
@@ -2689,55 +3078,55 @@ export declare function isBrowserError(value: unknown): value is BrowserError;
|
|
|
2689
3078
|
export declare function isBrowserNodeQuery(value: BrowserNodeQuery | BrowserNodePredicate): value is BrowserNodeQuery;
|
|
2690
3079
|
|
|
2691
3080
|
/**
|
|
2692
|
-
*
|
|
3081
|
+
* Tests whether a captured node has a non-empty rendered layout box.
|
|
2693
3082
|
*
|
|
2694
3083
|
* @param node - Captured browser node
|
|
2695
|
-
* @returns
|
|
3084
|
+
* @returns True if the snapshot reports a visible layout box; false otherwise
|
|
2696
3085
|
*/
|
|
2697
3086
|
export declare function isBrowserNodeVisible(node: BrowserNode): boolean;
|
|
2698
3087
|
|
|
2699
3088
|
/**
|
|
2700
|
-
*
|
|
3089
|
+
* Narrows an unknown value to BrowserResultLimitError.
|
|
2701
3090
|
*
|
|
2702
3091
|
* @param value - Value to check
|
|
2703
|
-
* @returns True
|
|
3092
|
+
* @returns True if value is a BrowserResultLimitError instance; false otherwise
|
|
2704
3093
|
*/
|
|
2705
3094
|
export declare function isBrowserResultLimitError(value: unknown): value is BrowserResultLimitError;
|
|
2706
3095
|
|
|
2707
3096
|
/**
|
|
2708
|
-
*
|
|
3097
|
+
* Narrows an unknown value to BrowserSelectorError.
|
|
2709
3098
|
*
|
|
2710
3099
|
* @param value - Value to check
|
|
2711
|
-
* @returns True
|
|
3100
|
+
* @returns True if value is a BrowserSelectorError instance; false otherwise
|
|
2712
3101
|
*/
|
|
2713
3102
|
export declare function isBrowserSelectorError(value: unknown): value is BrowserSelectorError;
|
|
2714
3103
|
|
|
2715
3104
|
/**
|
|
2716
|
-
*
|
|
3105
|
+
* Narrows an unknown value to CDPConnectionError.
|
|
2717
3106
|
*
|
|
2718
3107
|
* @param value - Value to check
|
|
2719
|
-
* @returns True
|
|
3108
|
+
* @returns True if value is a CDPConnectionError instance; false otherwise
|
|
2720
3109
|
*/
|
|
2721
3110
|
export declare function isCDPConnectionError(value: unknown): value is CDPConnectionError;
|
|
2722
3111
|
|
|
2723
3112
|
/**
|
|
2724
|
-
*
|
|
3113
|
+
* Narrows an unknown value to CDPError.
|
|
2725
3114
|
*
|
|
2726
3115
|
* @param value - Value to check
|
|
2727
|
-
* @returns True
|
|
3116
|
+
* @returns True if value is a CDPError instance; false otherwise
|
|
2728
3117
|
*/
|
|
2729
3118
|
export declare function isCDPError(value: unknown): value is CDPError;
|
|
2730
3119
|
|
|
2731
3120
|
/**
|
|
2732
|
-
*
|
|
3121
|
+
* Narrows an unknown value to CDPTimeoutError.
|
|
2733
3122
|
*
|
|
2734
3123
|
* @param value - Value to check
|
|
2735
|
-
* @returns True
|
|
3124
|
+
* @returns True if value is a CDPTimeoutError instance; false otherwise
|
|
2736
3125
|
*/
|
|
2737
3126
|
export declare function isCDPTimeoutError(value: unknown): value is CDPTimeoutError;
|
|
2738
3127
|
|
|
2739
3128
|
/**
|
|
2740
|
-
*
|
|
3129
|
+
* Normalizes one key to CDP keyboard event data.
|
|
2741
3130
|
*
|
|
2742
3131
|
* @param value - Key value or canonical key name
|
|
2743
3132
|
* @returns Normalized key data
|
|
@@ -2745,43 +3134,43 @@ export declare function isCDPTimeoutError(value: unknown): value is CDPTimeoutEr
|
|
|
2745
3134
|
export declare function keyToBrowserInput(value: string): BrowserKey;
|
|
2746
3135
|
|
|
2747
3136
|
/**
|
|
2748
|
-
*
|
|
3137
|
+
* Matches a decoded cookie against one request URL.
|
|
2749
3138
|
*
|
|
2750
3139
|
* @param cookie - Decoded context cookie
|
|
2751
3140
|
* @param value - Candidate absolute URL
|
|
2752
|
-
* @returns
|
|
3141
|
+
* @returns True if domain, path, and secure constraints match; false otherwise
|
|
2753
3142
|
*/
|
|
2754
3143
|
export declare function matchesBrowserCookieURL(cookie: BrowserCookie, value: string): boolean;
|
|
2755
3144
|
|
|
2756
3145
|
/**
|
|
2757
|
-
*
|
|
3146
|
+
* Tests a captured node against a declarative query.
|
|
2758
3147
|
*
|
|
2759
3148
|
* @param node - Captured browser node
|
|
2760
3149
|
* @param query - Fields every candidate must satisfy
|
|
2761
|
-
* @returns
|
|
3150
|
+
* @returns True if the node matches; false otherwise
|
|
2762
3151
|
*/
|
|
2763
3152
|
export declare function matchesBrowserNode(node: BrowserNode, query: BrowserNodeQuery): boolean;
|
|
2764
3153
|
|
|
2765
3154
|
/**
|
|
2766
|
-
*
|
|
3155
|
+
* Matches a request against route criteria.
|
|
2767
3156
|
*
|
|
2768
3157
|
* @param request - Observed request
|
|
2769
3158
|
* @param query - Match criteria
|
|
2770
|
-
* @returns
|
|
3159
|
+
* @returns True if every supplied criterion matches; false otherwise
|
|
2771
3160
|
*/
|
|
2772
3161
|
export declare function matchesBrowserRoute(request: BrowserRequest, query: BrowserRouteQuery): boolean;
|
|
2773
3162
|
|
|
2774
3163
|
/**
|
|
2775
|
-
*
|
|
3164
|
+
* Matches a URL using Chromium-style `*` and `**` glob segments.
|
|
2776
3165
|
*
|
|
2777
3166
|
* @param url - Candidate URL
|
|
2778
3167
|
* @param pattern - Glob pattern
|
|
2779
|
-
* @returns
|
|
3168
|
+
* @returns True if the whole URL matches; false otherwise
|
|
2780
3169
|
*/
|
|
2781
3170
|
export declare function matchesBrowserURL(url: string, pattern: string): boolean;
|
|
2782
3171
|
|
|
2783
3172
|
/**
|
|
2784
|
-
*
|
|
3173
|
+
* Converts typed media preferences to Chromium emulated media features.
|
|
2785
3174
|
*
|
|
2786
3175
|
* @param media - Public media configuration
|
|
2787
3176
|
* @returns Protocol feature records
|
|
@@ -2789,7 +3178,7 @@ export declare function matchesBrowserURL(url: string, pattern: string): boolean
|
|
|
2789
3178
|
export declare function mediaToFeatures(media: BrowserMedia): ReadonlyArray<Readonly<Record<string, string>>>;
|
|
2790
3179
|
|
|
2791
3180
|
/**
|
|
2792
|
-
*
|
|
3181
|
+
* Normalizes a raw list of recorded codegen actions.
|
|
2793
3182
|
*
|
|
2794
3183
|
* @remarks
|
|
2795
3184
|
* Collapses consecutive `fill` actions on the same selector into the latest
|
|
@@ -2803,15 +3192,158 @@ export declare function mediaToFeatures(media: BrowserMedia): ReadonlyArray<Read
|
|
|
2803
3192
|
export declare function normalizeCodegenActions(actions: readonly BrowserCodegenAction[]): readonly BrowserCodegenAction[];
|
|
2804
3193
|
|
|
2805
3194
|
/**
|
|
2806
|
-
*
|
|
3195
|
+
* Coerces a string-valued Accessibility-domain AXValue to a string, or
|
|
3196
|
+
* `undefined` off-shape.
|
|
2807
3197
|
*
|
|
2808
|
-
* @param value -
|
|
2809
|
-
* @returns
|
|
3198
|
+
* @param value - Unknown AX value
|
|
3199
|
+
* @returns String or undefined
|
|
3200
|
+
*/
|
|
3201
|
+
export declare function parseBrowserAXString(value: unknown): string | undefined;
|
|
3202
|
+
|
|
3203
|
+
/**
|
|
3204
|
+
* Coerces one Runtime binding invocation to a `BrowserBindingCall`, or
|
|
3205
|
+
* `undefined` off-shape.
|
|
3206
|
+
*
|
|
3207
|
+
* @param value - Unknown `Runtime.bindingCalled` parameters
|
|
3208
|
+
* @returns Valid call or undefined
|
|
2810
3209
|
*/
|
|
2811
|
-
export declare function
|
|
3210
|
+
export declare function parseBrowserBindingCall(value: unknown): BrowserBindingCall | undefined;
|
|
2812
3211
|
|
|
2813
3212
|
/**
|
|
2814
|
-
*
|
|
3213
|
+
* Coerces one `Runtime.consoleAPICalled` event to a `BrowserConsoleMessage`, or
|
|
3214
|
+
* `undefined` off-shape.
|
|
3215
|
+
*
|
|
3216
|
+
* @param value - Unknown event parameters
|
|
3217
|
+
* @returns Console message or undefined
|
|
3218
|
+
*/
|
|
3219
|
+
export declare function parseBrowserConsoleMessage(value: unknown): BrowserConsoleMessage | undefined;
|
|
3220
|
+
|
|
3221
|
+
/**
|
|
3222
|
+
* Coerces an optional Chromium cookie partition key to a
|
|
3223
|
+
* `BrowserCookiePartition`, or `undefined` off-shape.
|
|
3224
|
+
*
|
|
3225
|
+
* @param value - Unknown partition value
|
|
3226
|
+
* @returns Partition key or undefined
|
|
3227
|
+
*/
|
|
3228
|
+
export declare function parseBrowserCookiePartition(value: unknown): BrowserCookiePartition | undefined;
|
|
3229
|
+
|
|
3230
|
+
/**
|
|
3231
|
+
* Coerces one `Browser.downloadProgress` event to a `BrowserDownloadProgress`,
|
|
3232
|
+
* or `undefined` off-shape.
|
|
3233
|
+
*
|
|
3234
|
+
* @param value - Unknown event parameters
|
|
3235
|
+
* @returns Download id and progress, or undefined
|
|
3236
|
+
*/
|
|
3237
|
+
export declare function parseBrowserDownloadProgress(value: unknown): readonly [id: string, progress: BrowserDownloadProgress] | undefined;
|
|
3238
|
+
|
|
3239
|
+
/**
|
|
3240
|
+
* Coerces one `Browser.downloadWillBegin` event to a `BrowserDownloadStart`, or
|
|
3241
|
+
* `undefined` off-shape.
|
|
3242
|
+
*
|
|
3243
|
+
* @param value - Unknown event parameters
|
|
3244
|
+
* @returns Download start or undefined
|
|
3245
|
+
*/
|
|
3246
|
+
export declare function parseBrowserDownloadStart(value: unknown): BrowserDownloadStart | undefined;
|
|
3247
|
+
|
|
3248
|
+
/**
|
|
3249
|
+
* Coerces one `Runtime.exceptionThrown` event to a `BrowserPageError`, or
|
|
3250
|
+
* `undefined` off-shape.
|
|
3251
|
+
*
|
|
3252
|
+
* @param value - Unknown event parameters
|
|
3253
|
+
* @returns Page error or undefined
|
|
3254
|
+
*/
|
|
3255
|
+
export declare function parseBrowserPageError(value: unknown): BrowserPageError | undefined;
|
|
3256
|
+
|
|
3257
|
+
/**
|
|
3258
|
+
* Coerces a CDP snapshot rectangle to a `BrowserRect`, or `undefined`
|
|
3259
|
+
* off-shape.
|
|
3260
|
+
*
|
|
3261
|
+
* @param value - Candidate four-number array
|
|
3262
|
+
* @returns A rectangle, or undefined
|
|
3263
|
+
*/
|
|
3264
|
+
export declare function parseBrowserRect(value: unknown): BrowserRect | undefined;
|
|
3265
|
+
|
|
3266
|
+
/**
|
|
3267
|
+
* Coerces one `Network.requestWillBeSent` or `Fetch.requestPaused` event to a
|
|
3268
|
+
* `BrowserRequest`, or `undefined` off-shape.
|
|
3269
|
+
*
|
|
3270
|
+
* @param value - Unknown event parameters
|
|
3271
|
+
* @returns Request or undefined
|
|
3272
|
+
*/
|
|
3273
|
+
export declare function parseBrowserRequest(value: unknown): BrowserRequest | undefined;
|
|
3274
|
+
|
|
3275
|
+
/**
|
|
3276
|
+
* Coerces one `Network.loadingFailed` event to a `BrowserRequestFailure`, or
|
|
3277
|
+
* `undefined` off-shape.
|
|
3278
|
+
*
|
|
3279
|
+
* @param value - Unknown event parameters
|
|
3280
|
+
* @returns Failure or undefined
|
|
3281
|
+
*/
|
|
3282
|
+
export declare function parseBrowserRequestFailure(value: unknown): BrowserRequestFailure | undefined;
|
|
3283
|
+
|
|
3284
|
+
/**
|
|
3285
|
+
* Coerces one `Network.responseReceived` event to a `BrowserResponse`, or
|
|
3286
|
+
* `undefined` off-shape.
|
|
3287
|
+
*
|
|
3288
|
+
* @param value - Unknown event parameters
|
|
3289
|
+
* @returns Response or undefined
|
|
3290
|
+
*/
|
|
3291
|
+
export declare function parseBrowserResponse(value: unknown): BrowserResponse | undefined;
|
|
3292
|
+
|
|
3293
|
+
/**
|
|
3294
|
+
* Coerces one Chromium response object plus its event identity to a
|
|
3295
|
+
* `BrowserResponse`, or `undefined` off-shape.
|
|
3296
|
+
*
|
|
3297
|
+
* @param value - Unknown response object
|
|
3298
|
+
* @param id - Request id
|
|
3299
|
+
* @param loader - Loader id
|
|
3300
|
+
* @param frame - Optional frame id
|
|
3301
|
+
* @param timestamp - Monotonic event timestamp
|
|
3302
|
+
* @returns Response or undefined
|
|
3303
|
+
*/
|
|
3304
|
+
export declare function parseBrowserResponseRecord(value: unknown, id: string, loader: string, frame: string | undefined, timestamp: number): BrowserResponse | undefined;
|
|
3305
|
+
|
|
3306
|
+
/**
|
|
3307
|
+
* Coerces Chromium TLS security details to a `BrowserSecurity`, or `undefined`
|
|
3308
|
+
* off-shape.
|
|
3309
|
+
*
|
|
3310
|
+
* @param value - Unknown security details
|
|
3311
|
+
* @returns Security metadata or undefined
|
|
3312
|
+
*/
|
|
3313
|
+
export declare function parseBrowserSecurity(value: unknown): BrowserSecurity | undefined;
|
|
3314
|
+
|
|
3315
|
+
/**
|
|
3316
|
+
* Coerces Chromium response timing to a `BrowserTiming`, or `undefined`
|
|
3317
|
+
* off-shape.
|
|
3318
|
+
*
|
|
3319
|
+
* @param value - Unknown timing object
|
|
3320
|
+
* @returns Timing or undefined
|
|
3321
|
+
*/
|
|
3322
|
+
export declare function parseBrowserTiming(value: unknown): BrowserTiming | undefined;
|
|
3323
|
+
|
|
3324
|
+
/**
|
|
3325
|
+
* Coerces one named start/end pair of Chromium network timing to a
|
|
3326
|
+
* `BrowserTimingRange`, or `undefined` off-shape.
|
|
3327
|
+
*
|
|
3328
|
+
* @param value - Unknown timing object
|
|
3329
|
+
* @param start - Start field
|
|
3330
|
+
* @param end - End field
|
|
3331
|
+
* @returns Timing range or undefined
|
|
3332
|
+
*/
|
|
3333
|
+
export declare function parseBrowserTimingRange(value: unknown, start: string, end: string): BrowserTimingRange | undefined;
|
|
3334
|
+
|
|
3335
|
+
/**
|
|
3336
|
+
* Coerces one WebSocket frame event to a `BrowserWebSocketFrame`, or
|
|
3337
|
+
* `undefined` off-shape.
|
|
3338
|
+
*
|
|
3339
|
+
* @param value - Unknown event parameters
|
|
3340
|
+
* @returns Frame or undefined
|
|
3341
|
+
*/
|
|
3342
|
+
export declare function parseBrowserWebSocketFrame(value: unknown): BrowserWebSocketFrame | undefined;
|
|
3343
|
+
|
|
3344
|
+
/**
|
|
3345
|
+
* Coerces a codegen binding payload string to a `BrowserCodegenAction`, or
|
|
3346
|
+
* `undefined` off-shape.
|
|
2815
3347
|
*
|
|
2816
3348
|
* @remarks
|
|
2817
3349
|
* The in-page recorder script calls the CDP binding with a JSON string
|
|
@@ -2824,64 +3356,73 @@ export declare function parseBrowserChord(value: string): BrowserChord;
|
|
|
2824
3356
|
export declare function parseCodegenActionPayload(payload: unknown): BrowserCodegenAction | undefined;
|
|
2825
3357
|
|
|
2826
3358
|
/**
|
|
2827
|
-
*
|
|
3359
|
+
* Coerces a `Page.frameNavigated` CDP event to a `navigate` codegen action, or
|
|
3360
|
+
* `undefined` off-shape.
|
|
2828
3361
|
*
|
|
2829
|
-
* @
|
|
2830
|
-
*
|
|
3362
|
+
* @remarks
|
|
3363
|
+
* Only the top-level (main) frame's navigation is recorded — a frame
|
|
3364
|
+
* carrying a `parentId` is a sub-frame and is ignored.
|
|
3365
|
+
*
|
|
3366
|
+
* @param params - The CDP `Page.frameNavigated` event params
|
|
3367
|
+
* @returns A `navigate` action, or `undefined` when the event is not a
|
|
3368
|
+
* top-level navigation with a resolvable URL
|
|
2831
3369
|
*/
|
|
2832
|
-
export declare function
|
|
3370
|
+
export declare function parseCodegenNavigateAction(params: Readonly<Record<string, unknown>>): BrowserCodegenAction | undefined;
|
|
2833
3371
|
|
|
2834
3372
|
/**
|
|
2835
|
-
*
|
|
3373
|
+
* Coerces an unknown value to an all-number array, or `undefined` off-shape.
|
|
2836
3374
|
*
|
|
2837
|
-
* @param value -
|
|
2838
|
-
* @returns
|
|
3375
|
+
* @param value - Candidate value
|
|
3376
|
+
* @returns The number array, or undefined
|
|
2839
3377
|
*/
|
|
2840
|
-
export declare function
|
|
3378
|
+
export declare function parseNumberArray(value: unknown): readonly number[] | undefined;
|
|
2841
3379
|
|
|
2842
3380
|
/**
|
|
2843
|
-
*
|
|
3381
|
+
* Coerces one CDP snapshot string-table index to its string, or `undefined`
|
|
3382
|
+
* off-shape.
|
|
2844
3383
|
*
|
|
2845
|
-
* @param
|
|
2846
|
-
* @
|
|
3384
|
+
* @param strings - Snapshot string table
|
|
3385
|
+
* @param index - Candidate string index
|
|
3386
|
+
* @returns The resolved string, or undefined
|
|
2847
3387
|
*/
|
|
2848
|
-
export declare function
|
|
3388
|
+
export declare function parseSnapshotString(strings: readonly string[], index: unknown): string | undefined;
|
|
2849
3389
|
|
|
2850
3390
|
/**
|
|
2851
|
-
*
|
|
3391
|
+
* Decodes Accessibility-domain nodes into a flat serializable tree.
|
|
2852
3392
|
*
|
|
2853
|
-
* @param value - Unknown
|
|
2854
|
-
* @returns Valid
|
|
3393
|
+
* @param value - Unknown full or partial AX-tree result
|
|
3394
|
+
* @returns Valid accessibility snapshot
|
|
2855
3395
|
*/
|
|
2856
|
-
export declare function
|
|
3396
|
+
export declare function readBrowserAccessibility(value: unknown): BrowserAccessibilitySnapshot;
|
|
2857
3397
|
|
|
2858
3398
|
/**
|
|
2859
|
-
*
|
|
3399
|
+
* Decodes flattened CDP node attributes.
|
|
2860
3400
|
*
|
|
2861
|
-
* @param value -
|
|
2862
|
-
* @
|
|
3401
|
+
* @param value - Candidate string-index array
|
|
3402
|
+
* @param strings - Snapshot string table
|
|
3403
|
+
* @returns Frozen attribute record
|
|
2863
3404
|
*/
|
|
2864
|
-
export declare function
|
|
3405
|
+
export declare function readBrowserAttributes(value: unknown, strings: readonly string[]): Readonly<Record<string, string>>;
|
|
2865
3406
|
|
|
2866
3407
|
/**
|
|
2867
|
-
*
|
|
3408
|
+
* Decodes an Accessibility-domain AXValue.
|
|
2868
3409
|
*
|
|
2869
|
-
* @param value - Unknown
|
|
2870
|
-
* @
|
|
2871
|
-
* @returns Valid cookie
|
|
3410
|
+
* @param value - Unknown AX value
|
|
3411
|
+
* @returns Underlying value
|
|
2872
3412
|
*/
|
|
2873
|
-
export declare function
|
|
3413
|
+
export declare function readBrowserAXValue(value: unknown): unknown;
|
|
2874
3414
|
|
|
2875
3415
|
/**
|
|
2876
|
-
*
|
|
3416
|
+
* Decodes one Chromium cookie.
|
|
2877
3417
|
*
|
|
2878
|
-
* @param value - Unknown
|
|
2879
|
-
* @
|
|
3418
|
+
* @param value - Unknown cookie record
|
|
3419
|
+
* @param index - Source array position for diagnostics
|
|
3420
|
+
* @returns Valid cookie
|
|
2880
3421
|
*/
|
|
2881
|
-
export declare function
|
|
3422
|
+
export declare function readBrowserCookie(value: unknown, index: number): BrowserCookie;
|
|
2882
3423
|
|
|
2883
3424
|
/**
|
|
2884
|
-
*
|
|
3425
|
+
* Decodes cookies returned by `Storage.getCookies`.
|
|
2885
3426
|
*
|
|
2886
3427
|
* @param value - Unknown protocol result
|
|
2887
3428
|
* @returns Valid cookies
|
|
@@ -2889,7 +3430,7 @@ export declare function readBrowserCookiePartition(value: unknown): BrowserCooki
|
|
|
2889
3430
|
export declare function readBrowserCookies(value: unknown): readonly BrowserCookie[];
|
|
2890
3431
|
|
|
2891
3432
|
/**
|
|
2892
|
-
*
|
|
3433
|
+
* Decodes coverage ranges.
|
|
2893
3434
|
*
|
|
2894
3435
|
* @param value - Unknown ranges
|
|
2895
3436
|
* @param script - Script index for diagnostics
|
|
@@ -2898,23 +3439,7 @@ export declare function readBrowserCookies(value: unknown): readonly BrowserCook
|
|
|
2898
3439
|
export declare function readBrowserCoverageRanges(value: unknown, script: number): readonly BrowserCoverageRange[];
|
|
2899
3440
|
|
|
2900
3441
|
/**
|
|
2901
|
-
*
|
|
2902
|
-
*
|
|
2903
|
-
* @param value - Unknown event parameters
|
|
2904
|
-
* @returns Download id and progress, or undefined
|
|
2905
|
-
*/
|
|
2906
|
-
export declare function readBrowserDownloadProgress(value: unknown): readonly [id: string, progress: BrowserDownloadProgress] | undefined;
|
|
2907
|
-
|
|
2908
|
-
/**
|
|
2909
|
-
* Decode one `Browser.downloadWillBegin` event.
|
|
2910
|
-
*
|
|
2911
|
-
* @param value - Unknown event parameters
|
|
2912
|
-
* @returns Download start or undefined
|
|
2913
|
-
*/
|
|
2914
|
-
export declare function readBrowserDownloadStart(value: unknown): BrowserDownloadStart | undefined;
|
|
2915
|
-
|
|
2916
|
-
/**
|
|
2917
|
-
* Decode a flattened CDP `Page.getFrameTree` result.
|
|
3442
|
+
* Decodes a flattened CDP `Page.getFrameTree` result.
|
|
2918
3443
|
*
|
|
2919
3444
|
* @param value - Unknown CDP result
|
|
2920
3445
|
* @returns Frame metadata in depth-first, main-frame-first order
|
|
@@ -2922,7 +3447,7 @@ export declare function readBrowserDownloadStart(value: unknown): BrowserDownloa
|
|
|
2922
3447
|
export declare function readBrowserFrames(value: unknown): readonly BrowserFrameInfo[];
|
|
2923
3448
|
|
|
2924
3449
|
/**
|
|
2925
|
-
*
|
|
3450
|
+
* Decodes a Chromium Headers object into string values.
|
|
2926
3451
|
*
|
|
2927
3452
|
* @param value - Unknown headers
|
|
2928
3453
|
* @returns Frozen-compatible header record
|
|
@@ -2930,7 +3455,7 @@ export declare function readBrowserFrames(value: unknown): readonly BrowserFrame
|
|
|
2930
3455
|
export declare function readBrowserHeaders(value: unknown): Readonly<Record<string, string>>;
|
|
2931
3456
|
|
|
2932
3457
|
/**
|
|
2933
|
-
*
|
|
3458
|
+
* Decodes Performance-domain metrics.
|
|
2934
3459
|
*
|
|
2935
3460
|
* @param value - Unknown metrics result
|
|
2936
3461
|
* @returns Valid metrics
|
|
@@ -2938,15 +3463,7 @@ export declare function readBrowserHeaders(value: unknown): Readonly<Record<stri
|
|
|
2938
3463
|
export declare function readBrowserMetrics(value: unknown): readonly BrowserMetric[];
|
|
2939
3464
|
|
|
2940
3465
|
/**
|
|
2941
|
-
*
|
|
2942
|
-
*
|
|
2943
|
-
* @param value - Unknown event parameters
|
|
2944
|
-
* @returns Page error or undefined
|
|
2945
|
-
*/
|
|
2946
|
-
export declare function readBrowserPageError(value: unknown): BrowserPageError | undefined;
|
|
2947
|
-
|
|
2948
|
-
/**
|
|
2949
|
-
* Decode one CPU profile.
|
|
3466
|
+
* Decodes one CPU profile.
|
|
2950
3467
|
*
|
|
2951
3468
|
* @param value - Unknown `Profiler.stop` result
|
|
2952
3469
|
* @returns Valid profile
|
|
@@ -2954,7 +3471,7 @@ export declare function readBrowserPageError(value: unknown): BrowserPageError |
|
|
|
2954
3471
|
export declare function readBrowserProfile(value: unknown): BrowserProfile;
|
|
2955
3472
|
|
|
2956
3473
|
/**
|
|
2957
|
-
*
|
|
3474
|
+
* Decodes a CPU profile call frame.
|
|
2958
3475
|
*
|
|
2959
3476
|
* @param value - Unknown call frame
|
|
2960
3477
|
* @param node - Node index for diagnostics
|
|
@@ -2963,7 +3480,7 @@ export declare function readBrowserProfile(value: unknown): BrowserProfile;
|
|
|
2963
3480
|
export declare function readBrowserProfileFrame(value: unknown, node: number): BrowserProfileFrame;
|
|
2964
3481
|
|
|
2965
3482
|
/**
|
|
2966
|
-
*
|
|
3483
|
+
* Decodes the first `DOM.getContentQuads` quad and its center.
|
|
2967
3484
|
*
|
|
2968
3485
|
* @param value - Unknown CDP result
|
|
2969
3486
|
* @returns Decoded quad
|
|
@@ -2971,15 +3488,7 @@ export declare function readBrowserProfileFrame(value: unknown, node: number): B
|
|
|
2971
3488
|
export declare function readBrowserQuad(value: unknown): BrowserQuad;
|
|
2972
3489
|
|
|
2973
3490
|
/**
|
|
2974
|
-
*
|
|
2975
|
-
*
|
|
2976
|
-
* @param value - Candidate four-number array
|
|
2977
|
-
* @returns A rectangle, or undefined
|
|
2978
|
-
*/
|
|
2979
|
-
export declare function readBrowserRect(value: unknown): BrowserRect | undefined;
|
|
2980
|
-
|
|
2981
|
-
/**
|
|
2982
|
-
* Decode a Runtime remote object's printable value.
|
|
3491
|
+
* Decodes a Runtime remote object's printable value.
|
|
2983
3492
|
*
|
|
2984
3493
|
* @param value - Unknown remote object
|
|
2985
3494
|
* @returns By-value data or a description
|
|
@@ -2987,43 +3496,7 @@ export declare function readBrowserRect(value: unknown): BrowserRect | undefined
|
|
|
2987
3496
|
export declare function readBrowserRemoteValue(value: unknown): unknown;
|
|
2988
3497
|
|
|
2989
3498
|
/**
|
|
2990
|
-
*
|
|
2991
|
-
*
|
|
2992
|
-
* @param value - Unknown event parameters
|
|
2993
|
-
* @returns Request or undefined
|
|
2994
|
-
*/
|
|
2995
|
-
export declare function readBrowserRequest(value: unknown): BrowserRequest | undefined;
|
|
2996
|
-
|
|
2997
|
-
/**
|
|
2998
|
-
* Decode one `Network.loadingFailed` event.
|
|
2999
|
-
*
|
|
3000
|
-
* @param value - Unknown event parameters
|
|
3001
|
-
* @returns Failure or undefined
|
|
3002
|
-
*/
|
|
3003
|
-
export declare function readBrowserRequestFailure(value: unknown): BrowserRequestFailure | undefined;
|
|
3004
|
-
|
|
3005
|
-
/**
|
|
3006
|
-
* Decode one `Network.responseReceived` event.
|
|
3007
|
-
*
|
|
3008
|
-
* @param value - Unknown event parameters
|
|
3009
|
-
* @returns Response or undefined
|
|
3010
|
-
*/
|
|
3011
|
-
export declare function readBrowserResponse(value: unknown): BrowserResponse | undefined;
|
|
3012
|
-
|
|
3013
|
-
/**
|
|
3014
|
-
* Decode one Chromium response object with its event identity.
|
|
3015
|
-
*
|
|
3016
|
-
* @param value - Unknown response object
|
|
3017
|
-
* @param id - Request id
|
|
3018
|
-
* @param loader - Loader id
|
|
3019
|
-
* @param frame - Optional frame id
|
|
3020
|
-
* @param timestamp - Monotonic event timestamp
|
|
3021
|
-
* @returns Response or undefined
|
|
3022
|
-
*/
|
|
3023
|
-
export declare function readBrowserResponseRecord(value: unknown, id: string, loader: string, frame: string | undefined, timestamp: number): BrowserResponse | undefined;
|
|
3024
|
-
|
|
3025
|
-
/**
|
|
3026
|
-
* Decode JavaScript precise coverage.
|
|
3499
|
+
* Decodes JavaScript precise coverage.
|
|
3027
3500
|
*
|
|
3028
3501
|
* @param value - Unknown `Profiler.takePreciseCoverage` result
|
|
3029
3502
|
* @returns Script coverage
|
|
@@ -3031,7 +3504,7 @@ export declare function readBrowserResponseRecord(value: unknown, id: string, lo
|
|
|
3031
3504
|
export declare function readBrowserScriptCoverage(value: unknown): readonly BrowserScriptCoverage[];
|
|
3032
3505
|
|
|
3033
3506
|
/**
|
|
3034
|
-
*
|
|
3507
|
+
* Decodes the `Page.addScriptToEvaluateOnNewDocument` result.
|
|
3035
3508
|
*
|
|
3036
3509
|
* @param value - Unknown protocol result
|
|
3037
3510
|
* @returns Script identifier
|
|
@@ -3039,15 +3512,17 @@ export declare function readBrowserScriptCoverage(value: unknown): readonly Brow
|
|
|
3039
3512
|
export declare function readBrowserScriptIdentifier(value: unknown): string;
|
|
3040
3513
|
|
|
3041
3514
|
/**
|
|
3042
|
-
*
|
|
3515
|
+
* Decodes a CDP `DOMSnapshot.captureSnapshot` result.
|
|
3043
3516
|
*
|
|
3044
|
-
* @param value - Unknown
|
|
3045
|
-
* @
|
|
3517
|
+
* @param value - Unknown CDP result
|
|
3518
|
+
* @param styles - Requested computed-style names, in protocol order
|
|
3519
|
+
* @param limit - Maximum accepted node count
|
|
3520
|
+
* @returns A typed serializable browser snapshot
|
|
3046
3521
|
*/
|
|
3047
|
-
export declare function
|
|
3522
|
+
export declare function readBrowserSnapshot(value: unknown, styles?: readonly string[], limit?: number): BrowserSnapshotInput;
|
|
3048
3523
|
|
|
3049
3524
|
/**
|
|
3050
|
-
*
|
|
3525
|
+
* Decodes a Chromium runtime stack trace.
|
|
3051
3526
|
*
|
|
3052
3527
|
* @param value - Unknown stack trace or call-frame list
|
|
3053
3528
|
* @returns Valid stack frames
|
|
@@ -3055,7 +3530,7 @@ export declare function readBrowserSecurity(value: unknown): BrowserSecurity | u
|
|
|
3055
3530
|
export declare function readBrowserStack(value: unknown): readonly BrowserStackFrame[];
|
|
3056
3531
|
|
|
3057
3532
|
/**
|
|
3058
|
-
*
|
|
3533
|
+
* Decodes a list of web-storage entries.
|
|
3059
3534
|
*
|
|
3060
3535
|
* @param value - Unknown entry list
|
|
3061
3536
|
* @param origin - Origin used for diagnostics
|
|
@@ -3065,7 +3540,7 @@ export declare function readBrowserStack(value: unknown): readonly BrowserStackF
|
|
|
3065
3540
|
export declare function readBrowserStorageEntries(value: unknown, origin: string, storage: 'local' | 'session'): readonly BrowserStorageEntry[];
|
|
3066
3541
|
|
|
3067
3542
|
/**
|
|
3068
|
-
*
|
|
3543
|
+
* Decodes one in-page web-storage snapshot.
|
|
3069
3544
|
*
|
|
3070
3545
|
* @param value - Unknown evaluation result
|
|
3071
3546
|
* @param origin - Origin represented by the result
|
|
@@ -3074,7 +3549,7 @@ export declare function readBrowserStorageEntries(value: unknown, origin: string
|
|
|
3074
3549
|
export declare function readBrowserStorageOrigin(value: unknown, origin: string): BrowserStorageOrigin;
|
|
3075
3550
|
|
|
3076
3551
|
/**
|
|
3077
|
-
*
|
|
3552
|
+
* Decodes one `IO.read` response.
|
|
3078
3553
|
*
|
|
3079
3554
|
* @param value - Unknown protocol result
|
|
3080
3555
|
* @returns Valid stream chunk
|
|
@@ -3082,7 +3557,7 @@ export declare function readBrowserStorageOrigin(value: unknown, origin: string)
|
|
|
3082
3557
|
export declare function readBrowserStreamChunk(value: unknown): BrowserStreamChunk;
|
|
3083
3558
|
|
|
3084
3559
|
/**
|
|
3085
|
-
*
|
|
3560
|
+
* Decodes CSS rule usage.
|
|
3086
3561
|
*
|
|
3087
3562
|
* @param value - Unknown `CSS.stopRuleUsageTracking` result
|
|
3088
3563
|
* @returns Stylesheet coverage
|
|
@@ -3090,71 +3565,40 @@ export declare function readBrowserStreamChunk(value: unknown): BrowserStreamChu
|
|
|
3090
3565
|
export declare function readBrowserStyleCoverage(value: unknown): readonly BrowserStyleCoverage[];
|
|
3091
3566
|
|
|
3092
3567
|
/**
|
|
3093
|
-
*
|
|
3094
|
-
*
|
|
3095
|
-
* @param value - Unknown timing object
|
|
3096
|
-
* @returns Timing or undefined
|
|
3097
|
-
*/
|
|
3098
|
-
export declare function readBrowserTiming(value: unknown): BrowserTiming | undefined;
|
|
3099
|
-
|
|
3100
|
-
/**
|
|
3101
|
-
* Decode one start/end pair from Chromium network timing data.
|
|
3102
|
-
*
|
|
3103
|
-
* @param value - Unknown timing object
|
|
3104
|
-
* @param start - Start field
|
|
3105
|
-
* @param end - End field
|
|
3106
|
-
* @returns Timing range or undefined
|
|
3107
|
-
*/
|
|
3108
|
-
export declare function readBrowserTimingRange(value: unknown, start: string, end: string): BrowserTimingRange | undefined;
|
|
3109
|
-
|
|
3110
|
-
/**
|
|
3111
|
-
* Decode one WebSocket frame event.
|
|
3112
|
-
*
|
|
3113
|
-
* @param value - Unknown event parameters
|
|
3114
|
-
* @returns Frame or undefined
|
|
3115
|
-
*/
|
|
3116
|
-
export declare function readBrowserWebSocketFrame(value: unknown): BrowserWebSocketFrame | undefined;
|
|
3117
|
-
|
|
3118
|
-
/**
|
|
3119
|
-
* Derive a `navigate` codegen action from a `Page.frameNavigated` CDP event.
|
|
3568
|
+
* Decodes one CDP `Runtime.evaluate` result.
|
|
3120
3569
|
*
|
|
3121
|
-
* @
|
|
3122
|
-
*
|
|
3123
|
-
* carrying a `parentId` is a sub-frame and is ignored.
|
|
3124
|
-
*
|
|
3125
|
-
* @param params - The CDP `Page.frameNavigated` event params
|
|
3126
|
-
* @returns A `navigate` action, or `undefined` when the event is not a
|
|
3127
|
-
* top-level navigation with a resolvable URL
|
|
3570
|
+
* @param value - Unknown CDP result
|
|
3571
|
+
* @returns The returned by-value payload, or undefined
|
|
3128
3572
|
*/
|
|
3129
|
-
export declare function
|
|
3573
|
+
export declare function readEvaluationResult(value: unknown): unknown;
|
|
3130
3574
|
|
|
3131
3575
|
/**
|
|
3132
|
-
*
|
|
3576
|
+
* Decodes CDP snapshot sparse boolean data.
|
|
3133
3577
|
*
|
|
3134
|
-
* @param value -
|
|
3135
|
-
* @returns
|
|
3578
|
+
* @param value - Sparse `{ index }` record
|
|
3579
|
+
* @returns Set of node indexes whose value is true
|
|
3136
3580
|
*/
|
|
3137
|
-
export declare function
|
|
3581
|
+
export declare function readRareBooleanData(value: unknown): ReadonlySet<number>;
|
|
3138
3582
|
|
|
3139
3583
|
/**
|
|
3140
|
-
*
|
|
3584
|
+
* Decodes CDP snapshot sparse integer data.
|
|
3141
3585
|
*
|
|
3142
|
-
* @param value -
|
|
3143
|
-
* @returns
|
|
3586
|
+
* @param value - Sparse `{ index, value }` record
|
|
3587
|
+
* @returns Node-index to integer map
|
|
3144
3588
|
*/
|
|
3145
|
-
export declare function
|
|
3589
|
+
export declare function readRareIntegerData(value: unknown): ReadonlyMap<number, number>;
|
|
3146
3590
|
|
|
3147
3591
|
/**
|
|
3148
|
-
*
|
|
3592
|
+
* Decodes CDP snapshot sparse string data.
|
|
3149
3593
|
*
|
|
3594
|
+
* @param value - Sparse `{ index, value }` record
|
|
3150
3595
|
* @param strings - Snapshot string table
|
|
3151
|
-
* @
|
|
3152
|
-
* @returns The resolved string, or undefined
|
|
3596
|
+
* @returns Node-index to string map
|
|
3153
3597
|
*/
|
|
3154
|
-
export declare function
|
|
3598
|
+
export declare function readRareStringData(value: unknown, strings: readonly string[]): ReadonlyMap<number, string>;
|
|
3155
3599
|
|
|
3156
3600
|
/**
|
|
3157
|
-
*
|
|
3601
|
+
* Requires an evaluated browser value to be a string.
|
|
3158
3602
|
*
|
|
3159
3603
|
* @param value - Candidate evaluated value
|
|
3160
3604
|
* @param field - Human-readable field name used in the error
|
|
@@ -3163,64 +3607,85 @@ export declare function readSnapshotString(strings: readonly string[], index: un
|
|
|
3163
3607
|
export declare function requireBrowserString(value: unknown, field: string): string;
|
|
3164
3608
|
|
|
3165
3609
|
/**
|
|
3166
|
-
*
|
|
3610
|
+
* Awaits every teardown step in order and returns the first failure.
|
|
3167
3611
|
*
|
|
3168
3612
|
* @remarks
|
|
3169
|
-
*
|
|
3170
|
-
*
|
|
3171
|
-
*
|
|
3613
|
+
* A teardown runs every step even after one of them fails, so a later release
|
|
3614
|
+
* is never skipped by an earlier fault, and the failure the caller reports is
|
|
3615
|
+
* the first one. The failure is returned rather than thrown, so the caller
|
|
3616
|
+
* keeps the cleanup that must still run after the steps and decides where the
|
|
3617
|
+
* throw belongs. A step may throw any value, `undefined` and `null` included,
|
|
3618
|
+
* so the first throw is retained by a separate flag rather than by testing the
|
|
3619
|
+
* retained value.
|
|
3620
|
+
*
|
|
3621
|
+
* @param steps - The teardown steps, in the order they must run
|
|
3622
|
+
* @returns The value the first failing step threw, or undefined when no step threw
|
|
3623
|
+
*
|
|
3624
|
+
* @example
|
|
3625
|
+
* ```ts
|
|
3626
|
+
* import { settleBrowserTeardown } from '@orkestrel/browser'
|
|
3627
|
+
*
|
|
3628
|
+
* const failure = await settleBrowserTeardown(
|
|
3629
|
+
* () => client.close(),
|
|
3630
|
+
* () => transport.close(),
|
|
3631
|
+
* )
|
|
3632
|
+
* if (failure !== undefined) throw failure
|
|
3633
|
+
* ```
|
|
3172
3634
|
*/
|
|
3173
|
-
export declare
|
|
3174
|
-
write(path: string, data: Uint8Array): Promise<void>;
|
|
3175
|
-
}
|
|
3635
|
+
export declare function settleBrowserTeardown(...steps: readonly BrowserTeardownFunction[]): Promise<unknown>;
|
|
3176
3636
|
|
|
3177
|
-
/**
|
|
3637
|
+
/** Encodes UTF-8 text as bytes. */
|
|
3178
3638
|
export declare function textToBytes(value: string): Uint8Array;
|
|
3179
3639
|
|
|
3180
3640
|
/**
|
|
3181
|
-
*
|
|
3641
|
+
* Validates Accessibility-domain snapshot bounds.
|
|
3182
3642
|
*
|
|
3183
3643
|
* @param options - Public accessibility snapshot options
|
|
3184
3644
|
*/
|
|
3185
3645
|
export declare function validateBrowserAccessibilityOptions(options?: BrowserAccessibilityOptions): void;
|
|
3186
3646
|
|
|
3187
3647
|
/**
|
|
3188
|
-
*
|
|
3189
|
-
*
|
|
3190
|
-
* @param options - Candidate action options
|
|
3191
|
-
*/
|
|
3192
|
-
export declare function validateBrowserActionOptions(options?: BrowserActionOptions): void;
|
|
3193
|
-
|
|
3194
|
-
/**
|
|
3195
|
-
* Validate isolated-context options before creating remote state.
|
|
3648
|
+
* Validates isolated-context options before creating remote state.
|
|
3196
3649
|
*
|
|
3197
3650
|
* @param options - Public context configuration
|
|
3198
3651
|
*/
|
|
3199
3652
|
export declare function validateBrowserContextOptions(options?: BrowserContextOptions): void;
|
|
3200
3653
|
|
|
3201
3654
|
/**
|
|
3202
|
-
*
|
|
3655
|
+
* Validates context emulation boundaries before partial application.
|
|
3203
3656
|
*
|
|
3204
3657
|
* @param options - Public emulation configuration
|
|
3205
3658
|
*/
|
|
3206
3659
|
export declare function validateBrowserEmulationOptions(options: BrowserEmulationOptions): void;
|
|
3207
3660
|
|
|
3208
3661
|
/**
|
|
3209
|
-
*
|
|
3662
|
+
* Validates the HAR 1.2 fields required for deterministic replay.
|
|
3210
3663
|
*
|
|
3211
3664
|
* @param value - Candidate archive
|
|
3212
3665
|
*/
|
|
3213
3666
|
export declare function validateBrowserHAR(value: unknown): asserts value is BrowserHAR;
|
|
3214
3667
|
|
|
3215
3668
|
/**
|
|
3216
|
-
*
|
|
3669
|
+
* Validates the bounded keys of one trusted-input operation.
|
|
3670
|
+
*
|
|
3671
|
+
* @remarks
|
|
3672
|
+
* The parameter is `BrowserOperationOptions`, so one validator answers for a
|
|
3673
|
+
* locator click, a locator drag, a mouse click, a mouse drag, and keyboard
|
|
3674
|
+
* entry alike.
|
|
3675
|
+
*
|
|
3676
|
+
* @param options - Candidate input options
|
|
3677
|
+
*/
|
|
3678
|
+
export declare function validateBrowserInputOptions(options?: BrowserOperationOptions): void;
|
|
3679
|
+
|
|
3680
|
+
/**
|
|
3681
|
+
* Validates viewport input coordinates.
|
|
3217
3682
|
*
|
|
3218
3683
|
* @param point - Candidate point
|
|
3219
3684
|
*/
|
|
3220
3685
|
export declare function validateBrowserPoint(point: BrowserPoint): void;
|
|
3221
3686
|
|
|
3222
3687
|
/**
|
|
3223
|
-
*
|
|
3688
|
+
* Validates a finite numeric range.
|
|
3224
3689
|
*
|
|
3225
3690
|
* @param value - Candidate number
|
|
3226
3691
|
* @param field - Diagnostic field
|
|
@@ -3231,14 +3696,14 @@ export declare function validateBrowserPoint(point: BrowserPoint): void;
|
|
|
3231
3696
|
export declare function validateBrowserRange(value: number, field: string, minimum: number, maximum: number, inclusive?: boolean): void;
|
|
3232
3697
|
|
|
3233
3698
|
/**
|
|
3234
|
-
*
|
|
3699
|
+
* Validates a public browser timeout before protocol work begins.
|
|
3235
3700
|
*
|
|
3236
3701
|
* @param timeout - Timeout in milliseconds
|
|
3237
3702
|
*/
|
|
3238
3703
|
export declare function validateBrowserTimeout(timeout: number): void;
|
|
3239
3704
|
|
|
3240
3705
|
/**
|
|
3241
|
-
*
|
|
3706
|
+
* Validates Chromium viewport metrics.
|
|
3242
3707
|
*
|
|
3243
3708
|
* @param viewport - Public viewport configuration
|
|
3244
3709
|
*/
|