@opensteer/engine-playwright 0.7.0
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/LICENSE +21 -0
- package/README.md +12 -0
- package/dist/index.cjs +5468 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1189 -0
- package/dist/index.d.ts +1189 -0
- package/dist/index.js +5463 -0
- package/dist/index.js.map +1 -0
- package/package.json +59 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1189 @@
|
|
|
1
|
+
import { BrowserContext, Page, Browser } from 'playwright';
|
|
2
|
+
|
|
3
|
+
declare const brandSymbol: unique symbol;
|
|
4
|
+
type Brand<Value, Name extends string> = Value & {
|
|
5
|
+
readonly [brandSymbol]: Name;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
type SessionRef = Brand<string, "SessionRef">;
|
|
9
|
+
type PageRef = Brand<string, "PageRef">;
|
|
10
|
+
type FrameRef = Brand<string, "FrameRef">;
|
|
11
|
+
type DocumentRef = Brand<string, "DocumentRef">;
|
|
12
|
+
type NodeRef = Brand<string, "NodeRef">;
|
|
13
|
+
type NetworkRequestId = Brand<string, "NetworkRequestId">;
|
|
14
|
+
type DownloadRef = Brand<string, "DownloadRef">;
|
|
15
|
+
type DialogRef = Brand<string, "DialogRef">;
|
|
16
|
+
type ChooserRef = Brand<string, "ChooserRef">;
|
|
17
|
+
type WorkerRef = Brand<string, "WorkerRef">;
|
|
18
|
+
type DocumentEpoch = Brand<number, "DocumentEpoch">;
|
|
19
|
+
interface NodeLocator {
|
|
20
|
+
readonly documentRef: DocumentRef;
|
|
21
|
+
readonly documentEpoch: DocumentEpoch;
|
|
22
|
+
readonly nodeRef: NodeRef;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
type PageLifecycleState = "opening" | "open" | "closing" | "closed" | "crashed";
|
|
26
|
+
interface PageInfo {
|
|
27
|
+
readonly pageRef: PageRef;
|
|
28
|
+
readonly sessionRef: SessionRef;
|
|
29
|
+
readonly openerPageRef?: PageRef;
|
|
30
|
+
readonly url: string;
|
|
31
|
+
readonly title: string;
|
|
32
|
+
readonly lifecycleState: PageLifecycleState;
|
|
33
|
+
}
|
|
34
|
+
interface FrameInfo {
|
|
35
|
+
readonly frameRef: FrameRef;
|
|
36
|
+
readonly pageRef: PageRef;
|
|
37
|
+
readonly parentFrameRef?: FrameRef;
|
|
38
|
+
readonly documentRef: DocumentRef;
|
|
39
|
+
readonly documentEpoch: DocumentEpoch;
|
|
40
|
+
readonly url: string;
|
|
41
|
+
readonly name?: string;
|
|
42
|
+
readonly isMainFrame: boolean;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
interface Point {
|
|
46
|
+
readonly x: number;
|
|
47
|
+
readonly y: number;
|
|
48
|
+
}
|
|
49
|
+
interface Size {
|
|
50
|
+
readonly width: number;
|
|
51
|
+
readonly height: number;
|
|
52
|
+
}
|
|
53
|
+
interface Rect {
|
|
54
|
+
readonly x: number;
|
|
55
|
+
readonly y: number;
|
|
56
|
+
readonly width: number;
|
|
57
|
+
readonly height: number;
|
|
58
|
+
}
|
|
59
|
+
type Quad = readonly [Point, Point, Point, Point];
|
|
60
|
+
interface ScrollOffset {
|
|
61
|
+
readonly x: number;
|
|
62
|
+
readonly y: number;
|
|
63
|
+
}
|
|
64
|
+
type CoordinateSpace = "document-css" | "layout-viewport-css" | "visual-viewport-css" | "computer-display-css" | "window" | "screen" | "device-pixel";
|
|
65
|
+
interface LayoutViewport {
|
|
66
|
+
readonly origin: Point;
|
|
67
|
+
readonly size: Size;
|
|
68
|
+
}
|
|
69
|
+
interface VisualViewport {
|
|
70
|
+
readonly origin: Point;
|
|
71
|
+
readonly offsetWithinLayoutViewport: ScrollOffset;
|
|
72
|
+
readonly size: Size;
|
|
73
|
+
}
|
|
74
|
+
type DevicePixelRatio = Brand<number, "DevicePixelRatio">;
|
|
75
|
+
type PageScaleFactor = Brand<number, "PageScaleFactor">;
|
|
76
|
+
type PageZoomFactor = Brand<number, "PageZoomFactor">;
|
|
77
|
+
interface ViewportMetrics {
|
|
78
|
+
readonly layoutViewport: LayoutViewport;
|
|
79
|
+
readonly visualViewport: VisualViewport;
|
|
80
|
+
readonly scrollOffset: ScrollOffset;
|
|
81
|
+
readonly contentSize: Size;
|
|
82
|
+
readonly devicePixelRatio: DevicePixelRatio;
|
|
83
|
+
readonly pageScaleFactor: PageScaleFactor;
|
|
84
|
+
readonly pageZoomFactor: PageZoomFactor;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
interface HeaderEntry {
|
|
88
|
+
readonly name: string;
|
|
89
|
+
readonly value: string;
|
|
90
|
+
}
|
|
91
|
+
type BodyPayloadEncoding = "identity" | "base64" | "gzip" | "deflate" | "brotli" | "unknown";
|
|
92
|
+
interface BodyPayload {
|
|
93
|
+
readonly bytes: Uint8Array;
|
|
94
|
+
readonly encoding: BodyPayloadEncoding;
|
|
95
|
+
readonly mimeType?: string;
|
|
96
|
+
readonly charset?: string;
|
|
97
|
+
readonly truncated: boolean;
|
|
98
|
+
readonly capturedByteLength: number;
|
|
99
|
+
readonly originalByteLength?: number;
|
|
100
|
+
}
|
|
101
|
+
type NetworkCaptureState = "pending" | "complete" | "failed" | "skipped";
|
|
102
|
+
type NetworkRecordKind = "http" | "websocket" | "event-stream";
|
|
103
|
+
type NetworkResourceType = "document" | "stylesheet" | "image" | "media" | "font" | "script" | "fetch" | "xhr" | "websocket" | "event-stream" | "manifest" | "texttrack" | "beacon" | "ping" | "preflight" | "other";
|
|
104
|
+
type NetworkInitiatorType = "parser" | "script" | "preload" | "redirect" | "user" | "service-worker" | "other";
|
|
105
|
+
interface NetworkInitiator {
|
|
106
|
+
readonly type: NetworkInitiatorType;
|
|
107
|
+
readonly url?: string;
|
|
108
|
+
readonly lineNumber?: number;
|
|
109
|
+
readonly columnNumber?: number;
|
|
110
|
+
readonly requestId?: NetworkRequestId;
|
|
111
|
+
readonly stackTrace?: readonly string[];
|
|
112
|
+
}
|
|
113
|
+
interface NetworkTiming {
|
|
114
|
+
readonly requestStartMs?: number;
|
|
115
|
+
readonly dnsStartMs?: number;
|
|
116
|
+
readonly dnsEndMs?: number;
|
|
117
|
+
readonly connectStartMs?: number;
|
|
118
|
+
readonly connectEndMs?: number;
|
|
119
|
+
readonly sslStartMs?: number;
|
|
120
|
+
readonly sslEndMs?: number;
|
|
121
|
+
readonly requestSentMs?: number;
|
|
122
|
+
readonly responseStartMs?: number;
|
|
123
|
+
readonly responseEndMs?: number;
|
|
124
|
+
readonly workerStartMs?: number;
|
|
125
|
+
readonly workerReadyMs?: number;
|
|
126
|
+
}
|
|
127
|
+
interface NetworkTransferSizes {
|
|
128
|
+
readonly requestHeadersBytes?: number;
|
|
129
|
+
readonly responseHeadersBytes?: number;
|
|
130
|
+
readonly encodedBodyBytes?: number;
|
|
131
|
+
readonly decodedBodyBytes?: number;
|
|
132
|
+
readonly transferSizeBytes?: number;
|
|
133
|
+
}
|
|
134
|
+
interface NetworkSourceMetadata {
|
|
135
|
+
readonly protocol?: string;
|
|
136
|
+
readonly remoteAddress?: {
|
|
137
|
+
readonly ip?: string;
|
|
138
|
+
readonly port?: number;
|
|
139
|
+
};
|
|
140
|
+
readonly fromServiceWorker?: boolean;
|
|
141
|
+
readonly fromDiskCache?: boolean;
|
|
142
|
+
readonly fromMemoryCache?: boolean;
|
|
143
|
+
readonly workerRef?: WorkerRef;
|
|
144
|
+
}
|
|
145
|
+
interface NetworkRecord {
|
|
146
|
+
readonly kind: NetworkRecordKind;
|
|
147
|
+
readonly requestId: NetworkRequestId;
|
|
148
|
+
readonly sessionRef: SessionRef;
|
|
149
|
+
readonly pageRef?: PageRef;
|
|
150
|
+
readonly frameRef?: FrameRef;
|
|
151
|
+
readonly documentRef?: DocumentRef;
|
|
152
|
+
readonly method: string;
|
|
153
|
+
readonly url: string;
|
|
154
|
+
readonly requestHeaders: readonly HeaderEntry[];
|
|
155
|
+
readonly responseHeaders: readonly HeaderEntry[];
|
|
156
|
+
readonly status?: number;
|
|
157
|
+
readonly statusText?: string;
|
|
158
|
+
readonly resourceType: NetworkResourceType;
|
|
159
|
+
readonly redirectFromRequestId?: NetworkRequestId;
|
|
160
|
+
readonly redirectToRequestId?: NetworkRequestId;
|
|
161
|
+
readonly navigationRequest: boolean;
|
|
162
|
+
readonly initiator?: NetworkInitiator;
|
|
163
|
+
readonly timing?: NetworkTiming;
|
|
164
|
+
readonly transfer?: NetworkTransferSizes;
|
|
165
|
+
readonly source?: NetworkSourceMetadata;
|
|
166
|
+
readonly captureState: NetworkCaptureState;
|
|
167
|
+
readonly requestBodyState: NetworkCaptureState;
|
|
168
|
+
readonly responseBodyState: NetworkCaptureState;
|
|
169
|
+
readonly requestBodySkipReason?: string;
|
|
170
|
+
readonly responseBodySkipReason?: string;
|
|
171
|
+
readonly requestBodyError?: string;
|
|
172
|
+
readonly responseBodyError?: string;
|
|
173
|
+
readonly requestBody?: BodyPayload;
|
|
174
|
+
readonly responseBody?: BodyPayload;
|
|
175
|
+
}
|
|
176
|
+
interface NetworkRecordFilterInput {
|
|
177
|
+
readonly url?: string;
|
|
178
|
+
readonly hostname?: string;
|
|
179
|
+
readonly path?: string;
|
|
180
|
+
readonly method?: string;
|
|
181
|
+
readonly status?: string;
|
|
182
|
+
readonly resourceType?: NetworkResourceType;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
type ScreenshotFormat = "png" | "jpeg" | "webp";
|
|
186
|
+
interface ScreenshotArtifact {
|
|
187
|
+
readonly pageRef: PageRef;
|
|
188
|
+
readonly frameRef?: FrameRef;
|
|
189
|
+
readonly documentRef?: DocumentRef;
|
|
190
|
+
readonly documentEpoch?: DocumentEpoch;
|
|
191
|
+
readonly payload: BodyPayload;
|
|
192
|
+
readonly format: ScreenshotFormat;
|
|
193
|
+
readonly size: Size;
|
|
194
|
+
readonly coordinateSpace: CoordinateSpace;
|
|
195
|
+
readonly clip?: Rect;
|
|
196
|
+
}
|
|
197
|
+
interface HtmlSnapshot {
|
|
198
|
+
readonly pageRef: PageRef;
|
|
199
|
+
readonly frameRef: FrameRef;
|
|
200
|
+
readonly documentRef: DocumentRef;
|
|
201
|
+
readonly documentEpoch: DocumentEpoch;
|
|
202
|
+
readonly url: string;
|
|
203
|
+
readonly capturedAt: number;
|
|
204
|
+
readonly html: string;
|
|
205
|
+
}
|
|
206
|
+
interface DomSnapshotNode {
|
|
207
|
+
readonly snapshotNodeId: number;
|
|
208
|
+
readonly nodeRef?: NodeRef;
|
|
209
|
+
readonly parentSnapshotNodeId?: number;
|
|
210
|
+
readonly childSnapshotNodeIds: readonly number[];
|
|
211
|
+
readonly shadowRootType?: "open" | "closed" | "user-agent";
|
|
212
|
+
readonly shadowHostNodeRef?: NodeRef;
|
|
213
|
+
readonly contentDocumentRef?: DocumentRef;
|
|
214
|
+
readonly nodeType: number;
|
|
215
|
+
readonly nodeName: string;
|
|
216
|
+
readonly nodeValue: string;
|
|
217
|
+
readonly textContent?: string;
|
|
218
|
+
readonly computedStyle?: {
|
|
219
|
+
readonly display?: string;
|
|
220
|
+
readonly visibility?: string;
|
|
221
|
+
readonly opacity?: string;
|
|
222
|
+
readonly position?: string;
|
|
223
|
+
readonly cursor?: string;
|
|
224
|
+
readonly overflowX?: string;
|
|
225
|
+
readonly overflowY?: string;
|
|
226
|
+
};
|
|
227
|
+
readonly attributes: readonly {
|
|
228
|
+
readonly name: string;
|
|
229
|
+
readonly value: string;
|
|
230
|
+
}[];
|
|
231
|
+
readonly layout?: {
|
|
232
|
+
readonly rect?: Rect;
|
|
233
|
+
readonly quad?: Quad;
|
|
234
|
+
readonly paintOrder?: number;
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
type ShadowDomSnapshotMode = "flattened" | "preserved" | "unsupported";
|
|
238
|
+
interface DomSnapshot {
|
|
239
|
+
readonly pageRef: PageRef;
|
|
240
|
+
readonly frameRef: FrameRef;
|
|
241
|
+
readonly documentRef: DocumentRef;
|
|
242
|
+
readonly parentDocumentRef?: DocumentRef;
|
|
243
|
+
readonly documentEpoch: DocumentEpoch;
|
|
244
|
+
readonly url: string;
|
|
245
|
+
readonly capturedAt: number;
|
|
246
|
+
readonly rootSnapshotNodeId: number;
|
|
247
|
+
readonly shadowDomMode: ShadowDomSnapshotMode;
|
|
248
|
+
readonly geometryCoordinateSpace?: CoordinateSpace;
|
|
249
|
+
readonly nodes: readonly DomSnapshotNode[];
|
|
250
|
+
}
|
|
251
|
+
interface HitTestResult {
|
|
252
|
+
readonly inputPoint: Point;
|
|
253
|
+
readonly inputCoordinateSpace: CoordinateSpace;
|
|
254
|
+
readonly resolvedPoint: Point;
|
|
255
|
+
readonly resolvedCoordinateSpace: CoordinateSpace;
|
|
256
|
+
readonly pageRef: PageRef;
|
|
257
|
+
readonly frameRef: FrameRef;
|
|
258
|
+
readonly documentRef: DocumentRef;
|
|
259
|
+
readonly documentEpoch: DocumentEpoch;
|
|
260
|
+
readonly nodeRef?: NodeRef;
|
|
261
|
+
readonly targetQuad?: Quad;
|
|
262
|
+
readonly obscured: boolean;
|
|
263
|
+
readonly pointerEventsSkipped: boolean;
|
|
264
|
+
}
|
|
265
|
+
type VisualStabilityScope = "main-frame" | "visible-frames";
|
|
266
|
+
|
|
267
|
+
type CookieSameSite = "strict" | "lax" | "none";
|
|
268
|
+
type CookiePriority = "low" | "medium" | "high";
|
|
269
|
+
interface CookieRecord {
|
|
270
|
+
readonly sessionRef: SessionRef;
|
|
271
|
+
readonly name: string;
|
|
272
|
+
readonly value: string;
|
|
273
|
+
readonly domain: string;
|
|
274
|
+
readonly path: string;
|
|
275
|
+
readonly secure: boolean;
|
|
276
|
+
readonly httpOnly: boolean;
|
|
277
|
+
readonly sameSite?: CookieSameSite;
|
|
278
|
+
readonly priority?: CookiePriority;
|
|
279
|
+
readonly partitionKey?: string;
|
|
280
|
+
readonly session: boolean;
|
|
281
|
+
readonly expiresAt?: number | null;
|
|
282
|
+
}
|
|
283
|
+
interface StorageEntry {
|
|
284
|
+
readonly key: string;
|
|
285
|
+
readonly value: string;
|
|
286
|
+
}
|
|
287
|
+
interface IndexedDbRecord {
|
|
288
|
+
readonly key: unknown;
|
|
289
|
+
readonly primaryKey?: unknown;
|
|
290
|
+
readonly value: unknown;
|
|
291
|
+
}
|
|
292
|
+
interface IndexedDbIndexSnapshot {
|
|
293
|
+
readonly name: string;
|
|
294
|
+
readonly keyPath?: string | readonly string[];
|
|
295
|
+
readonly multiEntry: boolean;
|
|
296
|
+
readonly unique: boolean;
|
|
297
|
+
}
|
|
298
|
+
interface IndexedDbObjectStoreSnapshot {
|
|
299
|
+
readonly name: string;
|
|
300
|
+
readonly keyPath?: string | readonly string[];
|
|
301
|
+
readonly autoIncrement: boolean;
|
|
302
|
+
readonly indexes: readonly IndexedDbIndexSnapshot[];
|
|
303
|
+
readonly records: readonly IndexedDbRecord[];
|
|
304
|
+
}
|
|
305
|
+
interface IndexedDbDatabaseSnapshot {
|
|
306
|
+
readonly name: string;
|
|
307
|
+
readonly version: number;
|
|
308
|
+
readonly objectStores: readonly IndexedDbObjectStoreSnapshot[];
|
|
309
|
+
}
|
|
310
|
+
interface StorageOriginSnapshot {
|
|
311
|
+
readonly origin: string;
|
|
312
|
+
readonly localStorage: readonly StorageEntry[];
|
|
313
|
+
readonly indexedDb?: readonly IndexedDbDatabaseSnapshot[];
|
|
314
|
+
}
|
|
315
|
+
interface SessionStorageSnapshot {
|
|
316
|
+
readonly pageRef: PageRef;
|
|
317
|
+
readonly frameRef: FrameRef;
|
|
318
|
+
readonly origin: string;
|
|
319
|
+
readonly entries: readonly StorageEntry[];
|
|
320
|
+
}
|
|
321
|
+
interface StorageSnapshot {
|
|
322
|
+
readonly sessionRef: SessionRef;
|
|
323
|
+
readonly capturedAt: number;
|
|
324
|
+
readonly origins: readonly StorageOriginSnapshot[];
|
|
325
|
+
readonly sessionStorage?: readonly SessionStorageSnapshot[];
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
interface BrowserCapabilities {
|
|
329
|
+
readonly executor: {
|
|
330
|
+
readonly sessionLifecycle: boolean;
|
|
331
|
+
readonly pageLifecycle: boolean;
|
|
332
|
+
readonly navigation: boolean;
|
|
333
|
+
readonly pointerInput: boolean;
|
|
334
|
+
readonly keyboardInput: boolean;
|
|
335
|
+
readonly touchInput: boolean;
|
|
336
|
+
readonly screenshots: boolean;
|
|
337
|
+
readonly executionControl: {
|
|
338
|
+
readonly pause: boolean;
|
|
339
|
+
readonly resume: boolean;
|
|
340
|
+
readonly freeze: boolean;
|
|
341
|
+
};
|
|
342
|
+
};
|
|
343
|
+
readonly inspector: {
|
|
344
|
+
readonly pageEnumeration: boolean;
|
|
345
|
+
readonly frameEnumeration: boolean;
|
|
346
|
+
readonly html: boolean;
|
|
347
|
+
readonly domSnapshot: boolean;
|
|
348
|
+
readonly visualStability: boolean;
|
|
349
|
+
readonly text: boolean;
|
|
350
|
+
readonly attributes: boolean;
|
|
351
|
+
readonly hitTest: boolean;
|
|
352
|
+
readonly viewportMetrics: boolean;
|
|
353
|
+
readonly network: boolean;
|
|
354
|
+
readonly networkBodies: boolean;
|
|
355
|
+
readonly cookies: boolean;
|
|
356
|
+
readonly localStorage: boolean;
|
|
357
|
+
readonly sessionStorage: boolean;
|
|
358
|
+
readonly indexedDb: boolean;
|
|
359
|
+
};
|
|
360
|
+
readonly transport: {
|
|
361
|
+
readonly sessionHttp: boolean;
|
|
362
|
+
};
|
|
363
|
+
readonly instrumentation: {
|
|
364
|
+
readonly initScripts: boolean;
|
|
365
|
+
readonly routing: boolean;
|
|
366
|
+
};
|
|
367
|
+
readonly events: {
|
|
368
|
+
readonly pageLifecycle: boolean;
|
|
369
|
+
readonly dialog: boolean;
|
|
370
|
+
readonly download: boolean;
|
|
371
|
+
readonly chooser: boolean;
|
|
372
|
+
readonly worker: boolean;
|
|
373
|
+
readonly console: boolean;
|
|
374
|
+
readonly pageError: boolean;
|
|
375
|
+
readonly websocket: boolean;
|
|
376
|
+
readonly eventStream: boolean;
|
|
377
|
+
readonly executionState: boolean;
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
type ConsoleLevel = "debug" | "log" | "info" | "warn" | "error" | "trace";
|
|
382
|
+
interface StepEventBase {
|
|
383
|
+
readonly eventId: string;
|
|
384
|
+
readonly kind: string;
|
|
385
|
+
readonly timestamp: number;
|
|
386
|
+
readonly sessionRef: SessionRef;
|
|
387
|
+
readonly pageRef?: PageRef;
|
|
388
|
+
readonly frameRef?: FrameRef;
|
|
389
|
+
readonly documentRef?: DocumentRef;
|
|
390
|
+
readonly documentEpoch?: DocumentEpoch;
|
|
391
|
+
}
|
|
392
|
+
interface PageCreatedStepEvent extends StepEventBase {
|
|
393
|
+
readonly kind: "page-created";
|
|
394
|
+
readonly pageRef: PageRef;
|
|
395
|
+
}
|
|
396
|
+
interface PopupOpenedStepEvent extends StepEventBase {
|
|
397
|
+
readonly kind: "popup-opened";
|
|
398
|
+
readonly pageRef: PageRef;
|
|
399
|
+
readonly openerPageRef: PageRef;
|
|
400
|
+
}
|
|
401
|
+
interface PageClosedStepEvent extends StepEventBase {
|
|
402
|
+
readonly kind: "page-closed";
|
|
403
|
+
readonly pageRef: PageRef;
|
|
404
|
+
}
|
|
405
|
+
interface DialogOpenedStepEvent extends StepEventBase {
|
|
406
|
+
readonly kind: "dialog-opened";
|
|
407
|
+
readonly dialogRef: DialogRef;
|
|
408
|
+
readonly dialogType: "alert" | "beforeunload" | "confirm" | "prompt";
|
|
409
|
+
readonly message: string;
|
|
410
|
+
readonly defaultValue?: string;
|
|
411
|
+
}
|
|
412
|
+
interface DownloadStartedStepEvent extends StepEventBase {
|
|
413
|
+
readonly kind: "download-started";
|
|
414
|
+
readonly downloadRef: DownloadRef;
|
|
415
|
+
readonly url: string;
|
|
416
|
+
readonly suggestedFilename?: string;
|
|
417
|
+
}
|
|
418
|
+
interface DownloadFinishedStepEvent extends StepEventBase {
|
|
419
|
+
readonly kind: "download-finished";
|
|
420
|
+
readonly downloadRef: DownloadRef;
|
|
421
|
+
readonly state: "completed" | "canceled" | "failed";
|
|
422
|
+
readonly filePath?: string;
|
|
423
|
+
}
|
|
424
|
+
interface ChooserOpenedStepEvent extends StepEventBase {
|
|
425
|
+
readonly kind: "chooser-opened";
|
|
426
|
+
readonly chooserRef: ChooserRef;
|
|
427
|
+
readonly chooserType: "file" | "select";
|
|
428
|
+
readonly multiple: boolean;
|
|
429
|
+
readonly options?: readonly {
|
|
430
|
+
readonly index: number;
|
|
431
|
+
readonly label: string;
|
|
432
|
+
readonly value: string;
|
|
433
|
+
readonly selected: boolean;
|
|
434
|
+
}[];
|
|
435
|
+
}
|
|
436
|
+
interface WorkerCreatedStepEvent extends StepEventBase {
|
|
437
|
+
readonly kind: "worker-created";
|
|
438
|
+
readonly workerRef: WorkerRef;
|
|
439
|
+
readonly workerType: "dedicated" | "shared" | "service";
|
|
440
|
+
readonly url: string;
|
|
441
|
+
}
|
|
442
|
+
interface WorkerDestroyedStepEvent extends StepEventBase {
|
|
443
|
+
readonly kind: "worker-destroyed";
|
|
444
|
+
readonly workerRef: WorkerRef;
|
|
445
|
+
readonly workerType: "dedicated" | "shared" | "service";
|
|
446
|
+
readonly url: string;
|
|
447
|
+
}
|
|
448
|
+
interface ConsoleStepEvent extends StepEventBase {
|
|
449
|
+
readonly kind: "console";
|
|
450
|
+
readonly level: ConsoleLevel;
|
|
451
|
+
readonly text: string;
|
|
452
|
+
readonly location?: {
|
|
453
|
+
readonly url?: string;
|
|
454
|
+
readonly lineNumber?: number;
|
|
455
|
+
readonly columnNumber?: number;
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
interface PageErrorStepEvent extends StepEventBase {
|
|
459
|
+
readonly kind: "page-error";
|
|
460
|
+
readonly message: string;
|
|
461
|
+
readonly stack?: string;
|
|
462
|
+
}
|
|
463
|
+
interface WebSocketOpenedStepEvent extends StepEventBase {
|
|
464
|
+
readonly kind: "websocket-opened";
|
|
465
|
+
readonly socketId: string;
|
|
466
|
+
readonly url: string;
|
|
467
|
+
}
|
|
468
|
+
interface WebSocketFrameStepEvent extends StepEventBase {
|
|
469
|
+
readonly kind: "websocket-frame";
|
|
470
|
+
readonly socketId: string;
|
|
471
|
+
readonly direction: "sent" | "received";
|
|
472
|
+
readonly opcode?: number;
|
|
473
|
+
readonly payloadPreview?: string;
|
|
474
|
+
}
|
|
475
|
+
interface WebSocketClosedStepEvent extends StepEventBase {
|
|
476
|
+
readonly kind: "websocket-closed";
|
|
477
|
+
readonly socketId: string;
|
|
478
|
+
readonly code?: number;
|
|
479
|
+
readonly reason?: string;
|
|
480
|
+
}
|
|
481
|
+
interface EventStreamMessageStepEvent extends StepEventBase {
|
|
482
|
+
readonly kind: "event-stream-message";
|
|
483
|
+
readonly streamId: string;
|
|
484
|
+
readonly eventName?: string;
|
|
485
|
+
readonly dataPreview?: string;
|
|
486
|
+
}
|
|
487
|
+
interface PausedStepEvent extends StepEventBase {
|
|
488
|
+
readonly kind: "paused";
|
|
489
|
+
readonly reason?: string;
|
|
490
|
+
}
|
|
491
|
+
interface ResumedStepEvent extends StepEventBase {
|
|
492
|
+
readonly kind: "resumed";
|
|
493
|
+
readonly reason?: string;
|
|
494
|
+
}
|
|
495
|
+
interface FrozenStepEvent extends StepEventBase {
|
|
496
|
+
readonly kind: "frozen";
|
|
497
|
+
readonly reason?: string;
|
|
498
|
+
}
|
|
499
|
+
type StepEvent = PageCreatedStepEvent | PopupOpenedStepEvent | PageClosedStepEvent | DialogOpenedStepEvent | DownloadStartedStepEvent | DownloadFinishedStepEvent | ChooserOpenedStepEvent | WorkerCreatedStepEvent | WorkerDestroyedStepEvent | ConsoleStepEvent | PageErrorStepEvent | WebSocketOpenedStepEvent | WebSocketFrameStepEvent | WebSocketClosedStepEvent | EventStreamMessageStepEvent | PausedStepEvent | ResumedStepEvent | FrozenStepEvent;
|
|
500
|
+
interface StepResult<TData = void> {
|
|
501
|
+
readonly stepId: string;
|
|
502
|
+
readonly sessionRef: SessionRef;
|
|
503
|
+
readonly pageRef?: PageRef;
|
|
504
|
+
readonly frameRef?: FrameRef;
|
|
505
|
+
readonly documentRef?: DocumentRef;
|
|
506
|
+
readonly documentEpoch?: DocumentEpoch;
|
|
507
|
+
readonly startedAt: number;
|
|
508
|
+
readonly completedAt: number;
|
|
509
|
+
readonly durationMs: number;
|
|
510
|
+
readonly events: readonly StepEvent[];
|
|
511
|
+
readonly data: TData;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
type MouseButton = "left" | "middle" | "right";
|
|
515
|
+
type KeyModifier = "Shift" | "Control" | "Alt" | "Meta";
|
|
516
|
+
interface SessionTransportRequest {
|
|
517
|
+
readonly method: string;
|
|
518
|
+
readonly url: string;
|
|
519
|
+
readonly headers?: readonly HeaderEntry[];
|
|
520
|
+
readonly body?: BodyPayload;
|
|
521
|
+
readonly timeoutMs?: number;
|
|
522
|
+
readonly followRedirects?: boolean;
|
|
523
|
+
}
|
|
524
|
+
interface SessionTransportResponse {
|
|
525
|
+
readonly url: string;
|
|
526
|
+
readonly status: number;
|
|
527
|
+
readonly statusText: string;
|
|
528
|
+
readonly headers: readonly HeaderEntry[];
|
|
529
|
+
readonly body?: BodyPayload;
|
|
530
|
+
readonly redirected: boolean;
|
|
531
|
+
}
|
|
532
|
+
interface BrowserInitScriptInput {
|
|
533
|
+
readonly sessionRef: SessionRef;
|
|
534
|
+
readonly pageRef?: PageRef;
|
|
535
|
+
readonly script: string;
|
|
536
|
+
readonly args?: readonly unknown[];
|
|
537
|
+
}
|
|
538
|
+
interface BrowserInitScriptRegistration {
|
|
539
|
+
readonly registrationId: string;
|
|
540
|
+
readonly sessionRef: SessionRef;
|
|
541
|
+
readonly pageRef?: PageRef;
|
|
542
|
+
}
|
|
543
|
+
interface BrowserRouteRequest {
|
|
544
|
+
readonly url: string;
|
|
545
|
+
readonly method: string;
|
|
546
|
+
readonly headers: readonly HeaderEntry[];
|
|
547
|
+
readonly resourceType: NetworkRecord["resourceType"];
|
|
548
|
+
readonly pageRef?: PageRef;
|
|
549
|
+
readonly postData?: BodyPayload;
|
|
550
|
+
}
|
|
551
|
+
interface BrowserRouteFetchResult extends SessionTransportResponse {
|
|
552
|
+
}
|
|
553
|
+
type BrowserRouteHandlerResult = {
|
|
554
|
+
readonly kind: "continue";
|
|
555
|
+
} | {
|
|
556
|
+
readonly kind: "fulfill";
|
|
557
|
+
readonly status?: number;
|
|
558
|
+
readonly headers?: readonly HeaderEntry[];
|
|
559
|
+
readonly body?: BodyPayload;
|
|
560
|
+
readonly contentType?: string;
|
|
561
|
+
} | {
|
|
562
|
+
readonly kind: "abort";
|
|
563
|
+
readonly errorCode?: string;
|
|
564
|
+
};
|
|
565
|
+
interface BrowserRouteRegistrationInput {
|
|
566
|
+
readonly sessionRef: SessionRef;
|
|
567
|
+
readonly pageRef?: PageRef;
|
|
568
|
+
readonly urlPattern: string;
|
|
569
|
+
readonly resourceTypes?: readonly NetworkRecord["resourceType"][];
|
|
570
|
+
readonly times?: number;
|
|
571
|
+
readonly handler: (input: {
|
|
572
|
+
readonly request: BrowserRouteRequest;
|
|
573
|
+
fetchOriginal(): Promise<BrowserRouteFetchResult>;
|
|
574
|
+
}) => Promise<BrowserRouteHandlerResult> | BrowserRouteHandlerResult;
|
|
575
|
+
}
|
|
576
|
+
interface BrowserRouteRegistration {
|
|
577
|
+
readonly routeId: string;
|
|
578
|
+
readonly sessionRef: SessionRef;
|
|
579
|
+
readonly pageRef?: PageRef;
|
|
580
|
+
readonly urlPattern: string;
|
|
581
|
+
}
|
|
582
|
+
interface GetNetworkRecordsInput extends NetworkRecordFilterInput {
|
|
583
|
+
readonly sessionRef: SessionRef;
|
|
584
|
+
readonly pageRef?: PageRef;
|
|
585
|
+
readonly requestIds?: readonly string[];
|
|
586
|
+
readonly includeBodies?: boolean;
|
|
587
|
+
readonly signal?: AbortSignal;
|
|
588
|
+
}
|
|
589
|
+
interface BrowserExecutor {
|
|
590
|
+
readonly capabilities: Readonly<BrowserCapabilities>;
|
|
591
|
+
createSession(): Promise<SessionRef>;
|
|
592
|
+
closeSession(input: {
|
|
593
|
+
readonly sessionRef: SessionRef;
|
|
594
|
+
}): Promise<void>;
|
|
595
|
+
createPage(input: {
|
|
596
|
+
readonly sessionRef: SessionRef;
|
|
597
|
+
readonly openerPageRef?: PageRef;
|
|
598
|
+
readonly url?: string;
|
|
599
|
+
}): Promise<StepResult<PageInfo>>;
|
|
600
|
+
closePage(input: {
|
|
601
|
+
readonly pageRef: PageRef;
|
|
602
|
+
}): Promise<StepResult<void>>;
|
|
603
|
+
activatePage(input: {
|
|
604
|
+
readonly pageRef: PageRef;
|
|
605
|
+
}): Promise<StepResult<PageInfo>>;
|
|
606
|
+
navigate(input: {
|
|
607
|
+
readonly pageRef: PageRef;
|
|
608
|
+
readonly url: string;
|
|
609
|
+
readonly referrer?: string;
|
|
610
|
+
readonly timeoutMs?: number;
|
|
611
|
+
}): Promise<StepResult<{
|
|
612
|
+
readonly pageInfo: PageInfo;
|
|
613
|
+
readonly mainFrame: FrameInfo;
|
|
614
|
+
}>>;
|
|
615
|
+
reload(input: {
|
|
616
|
+
readonly pageRef: PageRef;
|
|
617
|
+
readonly timeoutMs?: number;
|
|
618
|
+
}): Promise<StepResult<{
|
|
619
|
+
readonly pageInfo: PageInfo;
|
|
620
|
+
readonly mainFrame: FrameInfo;
|
|
621
|
+
}>>;
|
|
622
|
+
goBack(input: {
|
|
623
|
+
readonly pageRef: PageRef;
|
|
624
|
+
}): Promise<StepResult<boolean>>;
|
|
625
|
+
goForward(input: {
|
|
626
|
+
readonly pageRef: PageRef;
|
|
627
|
+
}): Promise<StepResult<boolean>>;
|
|
628
|
+
stopLoading(input: {
|
|
629
|
+
readonly pageRef: PageRef;
|
|
630
|
+
}): Promise<StepResult<void>>;
|
|
631
|
+
mouseMove(input: {
|
|
632
|
+
readonly pageRef: PageRef;
|
|
633
|
+
readonly point: Point;
|
|
634
|
+
readonly coordinateSpace: CoordinateSpace;
|
|
635
|
+
}): Promise<StepResult<void>>;
|
|
636
|
+
mouseClick(input: {
|
|
637
|
+
readonly pageRef: PageRef;
|
|
638
|
+
readonly point: Point;
|
|
639
|
+
readonly coordinateSpace: CoordinateSpace;
|
|
640
|
+
readonly button?: MouseButton;
|
|
641
|
+
readonly clickCount?: number;
|
|
642
|
+
readonly modifiers?: readonly KeyModifier[];
|
|
643
|
+
}): Promise<StepResult<HitTestResult | undefined>>;
|
|
644
|
+
mouseScroll(input: {
|
|
645
|
+
readonly pageRef: PageRef;
|
|
646
|
+
readonly point: Point;
|
|
647
|
+
readonly coordinateSpace: CoordinateSpace;
|
|
648
|
+
readonly delta: Point;
|
|
649
|
+
}): Promise<StepResult<void>>;
|
|
650
|
+
keyPress(input: {
|
|
651
|
+
readonly pageRef: PageRef;
|
|
652
|
+
readonly key: string;
|
|
653
|
+
readonly modifiers?: readonly KeyModifier[];
|
|
654
|
+
}): Promise<StepResult<void>>;
|
|
655
|
+
textInput(input: {
|
|
656
|
+
readonly pageRef: PageRef;
|
|
657
|
+
readonly text: string;
|
|
658
|
+
}): Promise<StepResult<void>>;
|
|
659
|
+
captureScreenshot(input: {
|
|
660
|
+
readonly pageRef: PageRef;
|
|
661
|
+
readonly format?: ScreenshotFormat;
|
|
662
|
+
readonly clip?: Rect;
|
|
663
|
+
readonly clipSpace?: CoordinateSpace;
|
|
664
|
+
readonly fullPage?: boolean;
|
|
665
|
+
readonly includeCursor?: boolean;
|
|
666
|
+
}): Promise<StepResult<ScreenshotArtifact>>;
|
|
667
|
+
setExecutionState(input: {
|
|
668
|
+
readonly pageRef: PageRef;
|
|
669
|
+
readonly paused?: boolean;
|
|
670
|
+
readonly frozen?: boolean;
|
|
671
|
+
}): Promise<StepResult<{
|
|
672
|
+
readonly paused: boolean;
|
|
673
|
+
readonly frozen: boolean;
|
|
674
|
+
}>>;
|
|
675
|
+
}
|
|
676
|
+
interface BrowserInspector {
|
|
677
|
+
readonly capabilities: Readonly<BrowserCapabilities>;
|
|
678
|
+
listPages(input: {
|
|
679
|
+
readonly sessionRef: SessionRef;
|
|
680
|
+
}): Promise<readonly PageInfo[]>;
|
|
681
|
+
listFrames(input: {
|
|
682
|
+
readonly pageRef: PageRef;
|
|
683
|
+
}): Promise<readonly FrameInfo[]>;
|
|
684
|
+
getPageInfo(input: {
|
|
685
|
+
readonly pageRef: PageRef;
|
|
686
|
+
}): Promise<PageInfo>;
|
|
687
|
+
getFrameInfo(input: {
|
|
688
|
+
readonly frameRef: FrameRef;
|
|
689
|
+
}): Promise<FrameInfo>;
|
|
690
|
+
getHtmlSnapshot(input: {
|
|
691
|
+
readonly frameRef?: FrameRef;
|
|
692
|
+
readonly documentRef?: DocumentRef;
|
|
693
|
+
}): Promise<HtmlSnapshot>;
|
|
694
|
+
getDomSnapshot(input: {
|
|
695
|
+
readonly frameRef?: FrameRef;
|
|
696
|
+
readonly documentRef?: DocumentRef;
|
|
697
|
+
}): Promise<DomSnapshot>;
|
|
698
|
+
waitForVisualStability(input: {
|
|
699
|
+
readonly pageRef: PageRef;
|
|
700
|
+
readonly timeoutMs?: number;
|
|
701
|
+
readonly settleMs?: number;
|
|
702
|
+
readonly scope?: VisualStabilityScope;
|
|
703
|
+
}): Promise<void>;
|
|
704
|
+
readText(input: NodeLocator): Promise<string | null>;
|
|
705
|
+
readAttributes(input: NodeLocator): Promise<readonly {
|
|
706
|
+
readonly name: string;
|
|
707
|
+
readonly value: string;
|
|
708
|
+
}[]>;
|
|
709
|
+
hitTest(input: {
|
|
710
|
+
readonly pageRef: PageRef;
|
|
711
|
+
readonly point: Point;
|
|
712
|
+
readonly coordinateSpace: CoordinateSpace;
|
|
713
|
+
readonly ignorePointerEventsNone?: boolean;
|
|
714
|
+
readonly includeUserAgentShadowDom?: boolean;
|
|
715
|
+
}): Promise<HitTestResult>;
|
|
716
|
+
getViewportMetrics(input: {
|
|
717
|
+
readonly pageRef: PageRef;
|
|
718
|
+
}): Promise<ViewportMetrics>;
|
|
719
|
+
getNetworkRecords(input: GetNetworkRecordsInput): Promise<readonly NetworkRecord[]>;
|
|
720
|
+
getCookies(input: {
|
|
721
|
+
readonly sessionRef: SessionRef;
|
|
722
|
+
readonly urls?: readonly string[];
|
|
723
|
+
}): Promise<readonly CookieRecord[]>;
|
|
724
|
+
setCookies(input: {
|
|
725
|
+
readonly sessionRef: SessionRef;
|
|
726
|
+
readonly cookies: readonly CookieRecord[];
|
|
727
|
+
}): Promise<void>;
|
|
728
|
+
getStorageSnapshot(input: {
|
|
729
|
+
readonly sessionRef: SessionRef;
|
|
730
|
+
readonly includeSessionStorage?: boolean;
|
|
731
|
+
readonly includeIndexedDb?: boolean;
|
|
732
|
+
}): Promise<StorageSnapshot>;
|
|
733
|
+
evaluatePage(input: {
|
|
734
|
+
readonly pageRef: PageRef;
|
|
735
|
+
readonly script: string;
|
|
736
|
+
readonly args?: readonly unknown[];
|
|
737
|
+
readonly timeoutMs?: number;
|
|
738
|
+
}): Promise<StepResult<unknown>>;
|
|
739
|
+
}
|
|
740
|
+
interface SessionTransportExecutor {
|
|
741
|
+
readonly capabilities: Readonly<BrowserCapabilities>;
|
|
742
|
+
executeRequest(input: {
|
|
743
|
+
readonly sessionRef: SessionRef;
|
|
744
|
+
readonly request: SessionTransportRequest;
|
|
745
|
+
readonly signal?: AbortSignal;
|
|
746
|
+
}): Promise<StepResult<SessionTransportResponse>>;
|
|
747
|
+
}
|
|
748
|
+
interface BrowserInstrumentation {
|
|
749
|
+
readonly capabilities: Readonly<BrowserCapabilities>;
|
|
750
|
+
addInitScript(input: BrowserInitScriptInput): Promise<BrowserInitScriptRegistration>;
|
|
751
|
+
registerRoute(input: BrowserRouteRegistrationInput): Promise<BrowserRouteRegistration>;
|
|
752
|
+
}
|
|
753
|
+
interface BrowserCoreEngine extends BrowserExecutor, BrowserInspector, SessionTransportExecutor, BrowserInstrumentation {
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
declare const opensteerComputerAnnotationNames: readonly ["clickable", "typeable", "scrollable", "grid", "selected"];
|
|
757
|
+
type OpensteerComputerAnnotation = (typeof opensteerComputerAnnotationNames)[number];
|
|
758
|
+
type OpensteerComputerMouseButton = "left" | "middle" | "right";
|
|
759
|
+
type OpensteerComputerKeyModifier = "Shift" | "Control" | "Alt" | "Meta";
|
|
760
|
+
interface OpensteerComputerClickAction {
|
|
761
|
+
readonly type: "click";
|
|
762
|
+
readonly x: number;
|
|
763
|
+
readonly y: number;
|
|
764
|
+
readonly button?: OpensteerComputerMouseButton;
|
|
765
|
+
readonly clickCount?: number;
|
|
766
|
+
readonly modifiers?: readonly OpensteerComputerKeyModifier[];
|
|
767
|
+
}
|
|
768
|
+
interface OpensteerComputerMoveAction {
|
|
769
|
+
readonly type: "move";
|
|
770
|
+
readonly x: number;
|
|
771
|
+
readonly y: number;
|
|
772
|
+
}
|
|
773
|
+
interface OpensteerComputerScrollAction {
|
|
774
|
+
readonly type: "scroll";
|
|
775
|
+
readonly x: number;
|
|
776
|
+
readonly y: number;
|
|
777
|
+
readonly deltaX: number;
|
|
778
|
+
readonly deltaY: number;
|
|
779
|
+
}
|
|
780
|
+
interface OpensteerComputerTypeAction {
|
|
781
|
+
readonly type: "type";
|
|
782
|
+
readonly text: string;
|
|
783
|
+
}
|
|
784
|
+
interface OpensteerComputerKeyAction {
|
|
785
|
+
readonly type: "key";
|
|
786
|
+
readonly key: string;
|
|
787
|
+
readonly modifiers?: readonly OpensteerComputerKeyModifier[];
|
|
788
|
+
}
|
|
789
|
+
interface OpensteerComputerDragAction {
|
|
790
|
+
readonly type: "drag";
|
|
791
|
+
readonly start: Point;
|
|
792
|
+
readonly end: Point;
|
|
793
|
+
readonly steps?: number;
|
|
794
|
+
}
|
|
795
|
+
interface OpensteerComputerScreenshotAction {
|
|
796
|
+
readonly type: "screenshot";
|
|
797
|
+
}
|
|
798
|
+
interface OpensteerComputerWaitAction {
|
|
799
|
+
readonly type: "wait";
|
|
800
|
+
readonly durationMs: number;
|
|
801
|
+
}
|
|
802
|
+
type OpensteerComputerAction = OpensteerComputerClickAction | OpensteerComputerMoveAction | OpensteerComputerScrollAction | OpensteerComputerTypeAction | OpensteerComputerKeyAction | OpensteerComputerDragAction | OpensteerComputerScreenshotAction | OpensteerComputerWaitAction;
|
|
803
|
+
interface OpensteerComputerExecuteTiming {
|
|
804
|
+
readonly actionMs: number;
|
|
805
|
+
readonly waitMs: number;
|
|
806
|
+
readonly totalMs: number;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
declare const OPENSTEER_COMPUTER_USE_BRIDGE_SYMBOL: unique symbol;
|
|
810
|
+
interface NormalizedComputerScreenshotOptions {
|
|
811
|
+
readonly format: ScreenshotFormat;
|
|
812
|
+
readonly includeCursor: boolean;
|
|
813
|
+
readonly annotations: readonly OpensteerComputerAnnotation[];
|
|
814
|
+
}
|
|
815
|
+
interface ComputerUseBridgeInput {
|
|
816
|
+
readonly pageRef: PageRef;
|
|
817
|
+
readonly action: OpensteerComputerAction;
|
|
818
|
+
readonly screenshot: NormalizedComputerScreenshotOptions;
|
|
819
|
+
readonly signal: AbortSignal;
|
|
820
|
+
remainingMs(): number | undefined;
|
|
821
|
+
policySettle(pageRef: PageRef): Promise<void>;
|
|
822
|
+
}
|
|
823
|
+
interface ComputerUseBridgeOutput {
|
|
824
|
+
readonly pageRef: PageRef;
|
|
825
|
+
readonly screenshot: ScreenshotArtifact;
|
|
826
|
+
readonly viewport: ViewportMetrics;
|
|
827
|
+
readonly events: readonly StepEvent[];
|
|
828
|
+
readonly timing: OpensteerComputerExecuteTiming;
|
|
829
|
+
}
|
|
830
|
+
interface ComputerUseBridge {
|
|
831
|
+
execute(input: ComputerUseBridgeInput): Promise<ComputerUseBridgeOutput>;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
declare const OPENSTEER_DOM_ACTION_BRIDGE_SYMBOL: unique symbol;
|
|
835
|
+
type DomActionScrollAlignment = "start" | "center" | "end" | "nearest";
|
|
836
|
+
interface DomActionTargetInspection {
|
|
837
|
+
readonly connected: boolean;
|
|
838
|
+
readonly visible: boolean;
|
|
839
|
+
readonly enabled: boolean;
|
|
840
|
+
readonly editable: boolean;
|
|
841
|
+
readonly pointerEvents: string;
|
|
842
|
+
readonly bounds?: Rect;
|
|
843
|
+
readonly contentQuads: readonly Quad[];
|
|
844
|
+
}
|
|
845
|
+
interface DomActionScrollOptions {
|
|
846
|
+
readonly block?: DomActionScrollAlignment;
|
|
847
|
+
readonly inline?: DomActionScrollAlignment;
|
|
848
|
+
}
|
|
849
|
+
interface DomActionKeyPressInput {
|
|
850
|
+
readonly key: string;
|
|
851
|
+
readonly modifiers?: readonly KeyModifier[];
|
|
852
|
+
}
|
|
853
|
+
interface DomActionSettleOptions {
|
|
854
|
+
readonly operation: "dom.click" | "dom.hover" | "dom.input" | "dom.scroll";
|
|
855
|
+
readonly signal: AbortSignal;
|
|
856
|
+
remainingMs(): number | undefined;
|
|
857
|
+
policySettle(pageRef: PageRef): Promise<void>;
|
|
858
|
+
}
|
|
859
|
+
type DomPointerHitRelation = "self" | "descendant" | "ancestor" | "same-owner" | "outside" | "unknown";
|
|
860
|
+
interface DomPointerHitAssessment {
|
|
861
|
+
readonly relation: DomPointerHitRelation;
|
|
862
|
+
readonly blocking: boolean;
|
|
863
|
+
readonly ambiguous?: boolean;
|
|
864
|
+
readonly canonicalTarget?: NodeLocator;
|
|
865
|
+
readonly hitOwner?: NodeLocator;
|
|
866
|
+
}
|
|
867
|
+
interface DomActionBridge {
|
|
868
|
+
inspectActionTarget(locator: NodeLocator): Promise<DomActionTargetInspection>;
|
|
869
|
+
canonicalizePointerTarget(locator: NodeLocator): Promise<NodeLocator>;
|
|
870
|
+
classifyPointerHit(input: {
|
|
871
|
+
readonly target: NodeLocator;
|
|
872
|
+
readonly hit: NodeLocator;
|
|
873
|
+
readonly point: Point;
|
|
874
|
+
}): Promise<DomPointerHitAssessment>;
|
|
875
|
+
scrollNodeIntoView(locator: NodeLocator, options?: DomActionScrollOptions): Promise<void>;
|
|
876
|
+
focusNode(locator: NodeLocator): Promise<void>;
|
|
877
|
+
pressKey(locator: NodeLocator, input: DomActionKeyPressInput): Promise<void>;
|
|
878
|
+
finalizeDomAction(pageRef: PageRef, options: DomActionSettleOptions): Promise<void>;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
interface PlaywrightChromiumLaunchOptions {
|
|
882
|
+
readonly headless?: boolean;
|
|
883
|
+
readonly executablePath?: string;
|
|
884
|
+
readonly channel?: string;
|
|
885
|
+
readonly args?: readonly string[];
|
|
886
|
+
readonly chromiumSandbox?: boolean;
|
|
887
|
+
readonly devtools?: boolean;
|
|
888
|
+
readonly downloadsPath?: string;
|
|
889
|
+
readonly proxy?: {
|
|
890
|
+
readonly server: string;
|
|
891
|
+
readonly bypass?: string;
|
|
892
|
+
readonly username?: string;
|
|
893
|
+
readonly password?: string;
|
|
894
|
+
};
|
|
895
|
+
readonly slowMo?: number;
|
|
896
|
+
readonly timeoutMs?: number;
|
|
897
|
+
}
|
|
898
|
+
interface PlaywrightBrowserContextOptions {
|
|
899
|
+
readonly ignoreHTTPSErrors?: boolean;
|
|
900
|
+
readonly locale?: string;
|
|
901
|
+
readonly timezoneId?: string;
|
|
902
|
+
readonly userAgent?: string;
|
|
903
|
+
readonly viewport?: {
|
|
904
|
+
readonly width: number;
|
|
905
|
+
readonly height: number;
|
|
906
|
+
} | null;
|
|
907
|
+
readonly javaScriptEnabled?: boolean;
|
|
908
|
+
readonly bypassCSP?: boolean;
|
|
909
|
+
readonly reducedMotion?: "reduce" | "no-preference";
|
|
910
|
+
readonly colorScheme?: "light" | "dark" | "no-preference";
|
|
911
|
+
readonly extraHTTPHeaders?: readonly HeaderEntry[];
|
|
912
|
+
}
|
|
913
|
+
interface AdoptedChromiumBrowser {
|
|
914
|
+
readonly browserType: () => {
|
|
915
|
+
readonly name: () => string;
|
|
916
|
+
};
|
|
917
|
+
readonly close: () => Promise<void>;
|
|
918
|
+
readonly newContext: (options?: Record<string, unknown>) => Promise<unknown>;
|
|
919
|
+
}
|
|
920
|
+
interface PlaywrightBrowserCoreEngineOptions {
|
|
921
|
+
readonly browser?: AdoptedChromiumBrowser;
|
|
922
|
+
readonly closeBrowserOnDispose?: boolean;
|
|
923
|
+
readonly launch?: PlaywrightChromiumLaunchOptions;
|
|
924
|
+
readonly context?: PlaywrightBrowserContextOptions;
|
|
925
|
+
readonly attachedContext?: BrowserContext;
|
|
926
|
+
readonly attachedPage?: Page;
|
|
927
|
+
readonly closeAttachedContextOnSessionClose?: boolean;
|
|
928
|
+
readonly bodyCaptureLimitBytes?: number;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
declare class PlaywrightBrowserCoreEngine implements BrowserCoreEngine {
|
|
932
|
+
readonly capabilities: BrowserCapabilities;
|
|
933
|
+
private readonly browser;
|
|
934
|
+
private readonly closeBrowserOnDispose;
|
|
935
|
+
private readonly contextOptions;
|
|
936
|
+
private readonly options;
|
|
937
|
+
private readonly bodyCaptureLimitBytes;
|
|
938
|
+
private readonly sessions;
|
|
939
|
+
private readonly pages;
|
|
940
|
+
private readonly frames;
|
|
941
|
+
private readonly documents;
|
|
942
|
+
private readonly retiredDocuments;
|
|
943
|
+
private readonly pageByPlaywrightPage;
|
|
944
|
+
private readonly pendingPopupOpeners;
|
|
945
|
+
private readonly preassignedPopupPageRefs;
|
|
946
|
+
private pageCounter;
|
|
947
|
+
private frameCounter;
|
|
948
|
+
private documentCounter;
|
|
949
|
+
private nodeCounter;
|
|
950
|
+
private requestCounter;
|
|
951
|
+
private sessionCounter;
|
|
952
|
+
private eventCounter;
|
|
953
|
+
private stepCounter;
|
|
954
|
+
private computerUseBridge;
|
|
955
|
+
private domActionBridge;
|
|
956
|
+
private disposed;
|
|
957
|
+
private constructor();
|
|
958
|
+
static create(options?: PlaywrightBrowserCoreEngineOptions): Promise<PlaywrightBrowserCoreEngine>;
|
|
959
|
+
dispose(): Promise<void>;
|
|
960
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
961
|
+
[OPENSTEER_COMPUTER_USE_BRIDGE_SYMBOL](): ComputerUseBridge;
|
|
962
|
+
[OPENSTEER_DOM_ACTION_BRIDGE_SYMBOL](): DomActionBridge;
|
|
963
|
+
createSession(): Promise<SessionRef>;
|
|
964
|
+
closeSession(input: {
|
|
965
|
+
readonly sessionRef: SessionRef;
|
|
966
|
+
}): Promise<void>;
|
|
967
|
+
createPage(input: {
|
|
968
|
+
readonly sessionRef: SessionRef;
|
|
969
|
+
readonly openerPageRef?: PageRef;
|
|
970
|
+
readonly url?: string;
|
|
971
|
+
}): Promise<StepResult<PageInfo>>;
|
|
972
|
+
closePage(input: {
|
|
973
|
+
readonly pageRef: PageRef;
|
|
974
|
+
}): Promise<StepResult<void>>;
|
|
975
|
+
activatePage(input: {
|
|
976
|
+
readonly pageRef: PageRef;
|
|
977
|
+
}): Promise<StepResult<PageInfo>>;
|
|
978
|
+
navigate(input: {
|
|
979
|
+
readonly pageRef: PageRef;
|
|
980
|
+
readonly url: string;
|
|
981
|
+
readonly referrer?: string;
|
|
982
|
+
readonly timeoutMs?: number;
|
|
983
|
+
}): Promise<StepResult<{
|
|
984
|
+
readonly pageInfo: PageInfo;
|
|
985
|
+
readonly mainFrame: FrameInfo;
|
|
986
|
+
}>>;
|
|
987
|
+
reload(input: {
|
|
988
|
+
readonly pageRef: PageRef;
|
|
989
|
+
readonly timeoutMs?: number;
|
|
990
|
+
}): Promise<StepResult<{
|
|
991
|
+
readonly pageInfo: PageInfo;
|
|
992
|
+
readonly mainFrame: FrameInfo;
|
|
993
|
+
}>>;
|
|
994
|
+
goBack(input: {
|
|
995
|
+
readonly pageRef: PageRef;
|
|
996
|
+
}): Promise<StepResult<boolean>>;
|
|
997
|
+
goForward(input: {
|
|
998
|
+
readonly pageRef: PageRef;
|
|
999
|
+
}): Promise<StepResult<boolean>>;
|
|
1000
|
+
stopLoading(input: {
|
|
1001
|
+
readonly pageRef: PageRef;
|
|
1002
|
+
}): Promise<StepResult<void>>;
|
|
1003
|
+
mouseMove(input: {
|
|
1004
|
+
readonly pageRef: PageRef;
|
|
1005
|
+
readonly point: Point;
|
|
1006
|
+
readonly coordinateSpace: CoordinateSpace;
|
|
1007
|
+
}): Promise<StepResult<void>>;
|
|
1008
|
+
mouseClick(input: {
|
|
1009
|
+
readonly pageRef: PageRef;
|
|
1010
|
+
readonly point: Point;
|
|
1011
|
+
readonly coordinateSpace: CoordinateSpace;
|
|
1012
|
+
readonly button?: MouseButton;
|
|
1013
|
+
readonly clickCount?: number;
|
|
1014
|
+
readonly modifiers?: readonly KeyModifier[];
|
|
1015
|
+
}): Promise<StepResult<HitTestResult | undefined>>;
|
|
1016
|
+
mouseScroll(input: {
|
|
1017
|
+
readonly pageRef: PageRef;
|
|
1018
|
+
readonly point: Point;
|
|
1019
|
+
readonly coordinateSpace: CoordinateSpace;
|
|
1020
|
+
readonly delta: Point;
|
|
1021
|
+
}): Promise<StepResult<void>>;
|
|
1022
|
+
keyPress(input: {
|
|
1023
|
+
readonly pageRef: PageRef;
|
|
1024
|
+
readonly key: string;
|
|
1025
|
+
readonly modifiers?: readonly KeyModifier[];
|
|
1026
|
+
}): Promise<StepResult<void>>;
|
|
1027
|
+
textInput(input: {
|
|
1028
|
+
readonly pageRef: PageRef;
|
|
1029
|
+
readonly text: string;
|
|
1030
|
+
}): Promise<StepResult<void>>;
|
|
1031
|
+
captureScreenshot(input: {
|
|
1032
|
+
readonly pageRef: PageRef;
|
|
1033
|
+
readonly format?: ScreenshotFormat;
|
|
1034
|
+
readonly clip?: Rect;
|
|
1035
|
+
readonly clipSpace?: CoordinateSpace;
|
|
1036
|
+
readonly fullPage?: boolean;
|
|
1037
|
+
readonly includeCursor?: boolean;
|
|
1038
|
+
}): Promise<StepResult<ScreenshotArtifact>>;
|
|
1039
|
+
setExecutionState(input: {
|
|
1040
|
+
readonly pageRef: PageRef;
|
|
1041
|
+
readonly paused?: boolean;
|
|
1042
|
+
readonly frozen?: boolean;
|
|
1043
|
+
}): Promise<StepResult<{
|
|
1044
|
+
readonly paused: boolean;
|
|
1045
|
+
readonly frozen: boolean;
|
|
1046
|
+
}>>;
|
|
1047
|
+
listPages(input: {
|
|
1048
|
+
readonly sessionRef: SessionRef;
|
|
1049
|
+
}): Promise<readonly PageInfo[]>;
|
|
1050
|
+
listFrames(input: {
|
|
1051
|
+
readonly pageRef: PageRef;
|
|
1052
|
+
}): Promise<readonly FrameInfo[]>;
|
|
1053
|
+
getPageInfo(input: {
|
|
1054
|
+
readonly pageRef: PageRef;
|
|
1055
|
+
}): Promise<PageInfo>;
|
|
1056
|
+
getFrameInfo(input: {
|
|
1057
|
+
readonly frameRef: FrameRef;
|
|
1058
|
+
}): Promise<FrameInfo>;
|
|
1059
|
+
getHtmlSnapshot(input: {
|
|
1060
|
+
readonly frameRef?: FrameRef;
|
|
1061
|
+
readonly documentRef?: DocumentRef;
|
|
1062
|
+
}): Promise<HtmlSnapshot>;
|
|
1063
|
+
getDomSnapshot(input: {
|
|
1064
|
+
readonly frameRef?: FrameRef;
|
|
1065
|
+
readonly documentRef?: DocumentRef;
|
|
1066
|
+
}): Promise<DomSnapshot>;
|
|
1067
|
+
waitForVisualStability(input: {
|
|
1068
|
+
readonly pageRef: PageRef;
|
|
1069
|
+
readonly timeoutMs?: number;
|
|
1070
|
+
readonly settleMs?: number;
|
|
1071
|
+
readonly scope?: "main-frame" | "visible-frames";
|
|
1072
|
+
}): Promise<void>;
|
|
1073
|
+
readText(input: NodeLocator): Promise<string | null>;
|
|
1074
|
+
readAttributes(input: NodeLocator): Promise<readonly {
|
|
1075
|
+
readonly name: string;
|
|
1076
|
+
readonly value: string;
|
|
1077
|
+
}[]>;
|
|
1078
|
+
hitTest(input: {
|
|
1079
|
+
readonly pageRef: PageRef;
|
|
1080
|
+
readonly point: Point;
|
|
1081
|
+
readonly coordinateSpace: CoordinateSpace;
|
|
1082
|
+
readonly ignorePointerEventsNone?: boolean;
|
|
1083
|
+
readonly includeUserAgentShadowDom?: boolean;
|
|
1084
|
+
}): Promise<HitTestResult>;
|
|
1085
|
+
getViewportMetrics(input: {
|
|
1086
|
+
readonly pageRef: PageRef;
|
|
1087
|
+
}): Promise<ViewportMetrics>;
|
|
1088
|
+
getNetworkRecords(input: GetNetworkRecordsInput): Promise<readonly NetworkRecord[]>;
|
|
1089
|
+
getCookies(input: {
|
|
1090
|
+
readonly sessionRef: SessionRef;
|
|
1091
|
+
readonly urls?: readonly string[];
|
|
1092
|
+
}): Promise<readonly CookieRecord[]>;
|
|
1093
|
+
setCookies(input: {
|
|
1094
|
+
readonly sessionRef: SessionRef;
|
|
1095
|
+
readonly cookies: readonly CookieRecord[];
|
|
1096
|
+
}): Promise<void>;
|
|
1097
|
+
getStorageSnapshot(input: {
|
|
1098
|
+
readonly sessionRef: SessionRef;
|
|
1099
|
+
readonly includeSessionStorage?: boolean;
|
|
1100
|
+
readonly includeIndexedDb?: boolean;
|
|
1101
|
+
}): Promise<StorageSnapshot>;
|
|
1102
|
+
evaluatePage(input: {
|
|
1103
|
+
readonly pageRef: PageRef;
|
|
1104
|
+
readonly script: string;
|
|
1105
|
+
readonly args?: readonly unknown[];
|
|
1106
|
+
readonly timeoutMs?: number;
|
|
1107
|
+
}): Promise<StepResult<unknown>>;
|
|
1108
|
+
addInitScript(input: BrowserInitScriptInput): Promise<BrowserInitScriptRegistration>;
|
|
1109
|
+
registerRoute(input: BrowserRouteRegistrationInput): Promise<BrowserRouteRegistration>;
|
|
1110
|
+
executeRequest(input: {
|
|
1111
|
+
readonly sessionRef: SessionRef;
|
|
1112
|
+
readonly request: SessionTransportRequest;
|
|
1113
|
+
readonly signal?: AbortSignal;
|
|
1114
|
+
}): Promise<StepResult<SessionTransportResponse>>;
|
|
1115
|
+
private handleContextPage;
|
|
1116
|
+
private handleAttachedInitialPage;
|
|
1117
|
+
private initializePageController;
|
|
1118
|
+
private handleFrameAttached;
|
|
1119
|
+
private handleFrameDetached;
|
|
1120
|
+
private handleFrameNavigated;
|
|
1121
|
+
private handleNavigatedWithinDocument;
|
|
1122
|
+
private handleDocumentUpdated;
|
|
1123
|
+
private syncFrameTree;
|
|
1124
|
+
private refreshFrameBindings;
|
|
1125
|
+
private bindPlaywrightFrames;
|
|
1126
|
+
private handleConsole;
|
|
1127
|
+
private handleDialog;
|
|
1128
|
+
private handleDownload;
|
|
1129
|
+
private handleFileChooserOpened;
|
|
1130
|
+
private handlePageError;
|
|
1131
|
+
private handleUnexpectedPageClose;
|
|
1132
|
+
private handleNetworkRequestWillBeSent;
|
|
1133
|
+
private handlePlaywrightRequest;
|
|
1134
|
+
private handlePlaywrightResponse;
|
|
1135
|
+
private bindPlaywrightRequest;
|
|
1136
|
+
private enrichPlaywrightRequest;
|
|
1137
|
+
private handleNetworkResponseReceived;
|
|
1138
|
+
private handleNetworkResponseReceivedExtraInfo;
|
|
1139
|
+
private handleNetworkLoadingFinished;
|
|
1140
|
+
private handleNetworkLoadingFailed;
|
|
1141
|
+
private collectSessionStorageSnapshots;
|
|
1142
|
+
private buildPageInfo;
|
|
1143
|
+
private buildFrameInfo;
|
|
1144
|
+
private reconcileDocumentEpochs;
|
|
1145
|
+
private queueDocumentReconciliation;
|
|
1146
|
+
private flushDomUpdateTask;
|
|
1147
|
+
private captureDomSnapshot;
|
|
1148
|
+
private nodeRefForBackendNode;
|
|
1149
|
+
private resolveDocumentTarget;
|
|
1150
|
+
private requireLiveNode;
|
|
1151
|
+
private resolveNetworkFrameContext;
|
|
1152
|
+
private resolvePageForNetworkRecord;
|
|
1153
|
+
private materializeNetworkRecordBodies;
|
|
1154
|
+
private materializeRequestBody;
|
|
1155
|
+
private materializeResponseBody;
|
|
1156
|
+
private applyCdpResponseMetadata;
|
|
1157
|
+
private requireMainFrame;
|
|
1158
|
+
private requireSession;
|
|
1159
|
+
private requirePage;
|
|
1160
|
+
private requireFrame;
|
|
1161
|
+
private requireDocument;
|
|
1162
|
+
private cleanupPageController;
|
|
1163
|
+
private isControllerAcceptingEvents;
|
|
1164
|
+
private runControllerEvent;
|
|
1165
|
+
private handleControllerEventError;
|
|
1166
|
+
private trackBackgroundTask;
|
|
1167
|
+
private flushBackgroundTasks;
|
|
1168
|
+
private flushPendingPageTasks;
|
|
1169
|
+
private throwBackgroundError;
|
|
1170
|
+
private createEvent;
|
|
1171
|
+
private queueEvent;
|
|
1172
|
+
private drainQueuedEvents;
|
|
1173
|
+
private createStepResult;
|
|
1174
|
+
private withModifiers;
|
|
1175
|
+
private readTitle;
|
|
1176
|
+
private readUrl;
|
|
1177
|
+
private retireDocument;
|
|
1178
|
+
private isDescendantFrame;
|
|
1179
|
+
private assertNotDisposed;
|
|
1180
|
+
}
|
|
1181
|
+
declare function createPlaywrightBrowserCoreEngine(options?: PlaywrightBrowserCoreEngineOptions): Promise<PlaywrightBrowserCoreEngine>;
|
|
1182
|
+
declare function connectPlaywrightChromiumBrowser(input: {
|
|
1183
|
+
readonly url: string;
|
|
1184
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
1185
|
+
}): Promise<Browser>;
|
|
1186
|
+
|
|
1187
|
+
declare function capturePlaywrightStorageOrigins(context: BrowserContext, origins: readonly string[]): Promise<StorageOriginSnapshot[]>;
|
|
1188
|
+
|
|
1189
|
+
export { type AdoptedChromiumBrowser, type PlaywrightBrowserContextOptions, PlaywrightBrowserCoreEngine, type PlaywrightBrowserCoreEngineOptions, type PlaywrightChromiumLaunchOptions, capturePlaywrightStorageOrigins, connectPlaywrightChromiumBrowser, createPlaywrightBrowserCoreEngine };
|