UNPKG

20.3 kBTypeScriptView Raw
1/**
2 * !!! PLEASE DO NOT EDIT THIS FILE !!!
3 *
4 * This source file, even though checked in, is auto-generated based on the
5 * current development within the WebDriver Bidi spec. Any changes to this
6 * file need to come from the specification. You can generate this file by calling
7 *
8 * ```
9 * $ npm run generate:bidi
10 * ```
11 *
12 * from the project root. You can find the scripts that generates this file in
13 * ./scripts/bidi/**
14 */
15export type Message = CommandResponse | ErrorResponse | Event;
16export interface CommandResponse extends Extensible {
17 type: 'success';
18 id: JsUint;
19 result: ResultData;
20}
21export interface ErrorResponse extends Extensible {
22 type: 'error';
23 id: JsUint | null;
24 error: ErrorCode;
25 message: string;
26 stacktrace?: string;
27}
28export type ResultData = BrowsingContextResult | EmptyResult | NetworkResult | ScriptResult | SessionResult;
29export interface EmptyResult extends Extensible {
30}
31export type Event = {
32 type: 'event';
33} & EventData & Extensible;
34export type EventData = BrowsingContextEvent | LogEvent | NetworkEvent | ScriptEvent;
35export type Extensible = Record<string, any>;
36export type JsInt = number;
37export type JsUint = number;
38export type ErrorCode = 'invalid argument' | 'invalid session id' | 'move target out of bounds' | 'no such alert' | 'no such element' | 'no such frame' | 'no such handle' | 'no such history entry' | 'no such intercept' | 'no such node' | 'no such request' | 'no such script' | 'session not created' | 'unable to capture screen' | 'unable to close browser' | 'unknown command' | 'unknown error' | 'unsupported operation';
39export type SessionResult = SessionNewResult | SessionStatusResult;
40export interface SessionCapabilitiesRequest {
41 alwaysMatch?: SessionCapabilityRequest;
42 firstMatch?: SessionCapabilityRequest[];
43}
44export interface SessionCapabilityRequest extends Extensible {
45 acceptInsecureCerts?: boolean;
46 browserName?: string;
47 browserVersion?: string;
48 platformName?: string;
49 proxy?: {
50 proxyType?: 'pac' | 'direct' | 'autodetect' | 'system' | 'manual';
51 proxyAutoconfigUrl?: string;
52 ftpProxy?: string;
53 httpProxy?: string;
54 noProxy?: string[];
55 sslProxy?: string;
56 socksProxy?: string;
57 socksVersion?: number;
58 };
59}
60export interface SessionStatusResult {
61 ready: boolean;
62 message: string;
63}
64export interface SessionNewResult {
65 sessionId: string;
66 capabilities: {
67 acceptInsecureCerts: boolean;
68 browserName: string;
69 browserVersion: string;
70 platformName: string;
71 proxy: {
72 proxyType?: 'pac' | 'direct' | 'autodetect' | 'system' | 'manual';
73 proxyAutoconfigUrl?: string;
74 ftpProxy?: string;
75 httpProxy?: string;
76 noProxy?: string[];
77 sslProxy?: string;
78 socksProxy?: string;
79 socksVersion?: number;
80 };
81 setWindowRect: boolean;
82 };
83}
84export type BrowsingContextResult = BrowsingContextCaptureScreenshotResult | BrowsingContextCreateResult | BrowsingContextGetTreeResult | BrowsingContextLocateNodesResult | BrowsingContextNavigateResult | BrowsingContextPrintResult | BrowsingContextTraverseHistoryResult;
85export type BrowsingContextEvent = BrowsingContextContextCreated | BrowsingContextContextDestroyed | BrowsingContextDomContentLoaded | BrowsingContextDownloadWillBegin | BrowsingContextFragmentNavigated | BrowsingContextLoad | BrowsingContextNavigationAborted | BrowsingContextNavigationFailed | BrowsingContextNavigationStarted | BrowsingContextUserPromptClosed | BrowsingContextUserPromptOpened;
86export type BrowsingContextBrowsingContext = string;
87export type BrowsingContextInfoList = (BrowsingContextInfo)[];
88export interface BrowsingContextInfo {
89 context: BrowsingContextBrowsingContext;
90 url: string;
91 children: BrowsingContextInfoList | null;
92 parent?: BrowsingContextBrowsingContext | null;
93}
94export type BrowsingContextLocator = BrowsingContextCssLocator | BrowsingContextInnerTextLocator | BrowsingContextXPathLocator;
95export interface BrowsingContextCssLocator {
96 type: 'css';
97 value: string;
98}
99export interface BrowsingContextInnerTextLocator {
100 type: 'innerText';
101 value: string;
102 ignoreCase?: boolean;
103 matchType?: 'full' | 'partial';
104 maxDepth?: JsUint;
105}
106export interface BrowsingContextXPathLocator {
107 type: 'xpath';
108 value: string;
109}
110export type BrowsingContextNavigation = string;
111export interface BrowsingContextNavigationInfo {
112 context: BrowsingContextBrowsingContext;
113 navigation: BrowsingContextNavigation | null;
114 timestamp: JsUint;
115 url: string;
116}
117export interface BrowsingContextCaptureScreenshotResult {
118 data: string;
119}
120export interface BrowsingContextCreateResult {
121 context: BrowsingContextBrowsingContext;
122}
123export interface BrowsingContextGetTreeResult {
124 contexts: BrowsingContextInfoList;
125}
126export interface BrowsingContextLocateNodesResult {
127 nodes: ScriptNodeRemoteValue[];
128}
129export interface BrowsingContextNavigateResult {
130 navigation: BrowsingContextNavigation | null;
131 url: string;
132}
133export interface BrowsingContextPrintResult {
134 data: string;
135}
136export interface BrowsingContextTraverseHistoryResult {
137}
138export interface BrowsingContextContextCreated {
139 method: 'browsingContext.contextCreated';
140 params: BrowsingContextInfo;
141}
142export interface BrowsingContextContextDestroyed {
143 method: 'browsingContext.contextDestroyed';
144 params: BrowsingContextInfo;
145}
146export interface BrowsingContextNavigationStarted {
147 method: 'browsingContext.navigationStarted';
148 params: BrowsingContextNavigationInfo;
149}
150export interface BrowsingContextFragmentNavigated {
151 method: 'browsingContext.fragmentNavigated';
152 params: BrowsingContextNavigationInfo;
153}
154export interface BrowsingContextDomContentLoaded {
155 method: 'browsingContext.domContentLoaded';
156 params: BrowsingContextNavigationInfo;
157}
158export interface BrowsingContextLoad {
159 method: 'browsingContext.load';
160 params: BrowsingContextNavigationInfo;
161}
162export interface BrowsingContextDownloadWillBegin {
163 method: 'browsingContext.downloadWillBegin';
164 params: BrowsingContextNavigationInfo;
165}
166export interface BrowsingContextNavigationAborted {
167 method: 'browsingContext.navigationAborted';
168 params: BrowsingContextNavigationInfo;
169}
170export interface BrowsingContextNavigationFailed {
171 method: 'browsingContext.navigationFailed';
172 params: BrowsingContextNavigationInfo;
173}
174export interface BrowsingContextUserPromptClosed {
175 method: 'browsingContext.userPromptClosed';
176 params: BrowsingContextUserPromptClosedParameters;
177}
178export interface BrowsingContextUserPromptClosedParameters {
179 context: BrowsingContextBrowsingContext;
180 accepted: boolean;
181 userText?: string;
182}
183export interface BrowsingContextUserPromptOpened {
184 method: 'browsingContext.userPromptOpened';
185 params: BrowsingContextUserPromptOpenedParameters;
186}
187export interface BrowsingContextUserPromptOpenedParameters {
188 context: BrowsingContextBrowsingContext;
189 type: 'alert' | 'confirm' | 'prompt' | 'beforeunload';
190 message: string;
191 defaultValue?: string;
192}
193export interface NetworkResult extends NetworkAddInterceptResult {
194}
195export type NetworkEvent = NetworkAuthRequired | NetworkBeforeRequestSent | NetworkFetchError | NetworkResponseCompleted | NetworkResponseStarted;
196export interface NetworkAuthChallenge {
197 scheme: string;
198 realm: string;
199}
200export interface NetworkBaseParameters {
201 context: BrowsingContextBrowsingContext | null;
202 isBlocked: boolean;
203 navigation: BrowsingContextNavigation | null;
204 redirectCount: JsUint;
205 request: NetworkRequestData;
206 timestamp: JsUint;
207 intercepts?: NetworkIntercept[];
208}
209export type NetworkBytesValue = NetworkStringValue | NetworkBase64Value;
210export interface NetworkStringValue {
211 type: 'string';
212 value: string;
213}
214export interface NetworkBase64Value {
215 type: 'base64';
216 value: string;
217}
218export interface NetworkCookie {
219 name: string;
220 value: NetworkBytesValue;
221 domain: string;
222 path: string;
223 size: JsUint;
224 httpOnly: boolean;
225 secure: boolean;
226 sameSite: 'strict' | 'lax' | 'none';
227 expiry?: JsUint;
228}
229export interface NetworkFetchTimingInfo {
230 timeOrigin: number;
231 requestTime: number;
232 redirectStart: number;
233 redirectEnd: number;
234 fetchStart: number;
235 dnsStart: number;
236 dnsEnd: number;
237 connectStart: number;
238 connectEnd: number;
239 tlsStart: number;
240 requestStart: number;
241 responseStart: number;
242 responseEnd: number;
243}
244export interface NetworkHeader {
245 name: string;
246 value: NetworkBytesValue;
247}
248export interface NetworkInitiator {
249 type: 'parser' | 'script' | 'preflight' | 'other';
250 columnNumber?: JsUint;
251 lineNumber?: JsUint;
252 stackTrace?: ScriptStackTrace;
253 request?: NetworkRequest;
254}
255export type NetworkIntercept = string;
256export type NetworkRequest = string;
257export interface NetworkRequestData {
258 request: NetworkRequest;
259 url: string;
260 method: string;
261 headers: NetworkHeader[];
262 cookies: NetworkCookie[];
263 headersSize: JsUint;
264 bodySize: JsUint | null;
265 timings: NetworkFetchTimingInfo;
266}
267export interface NetworkResponseContent {
268 size: JsUint;
269}
270export interface NetworkResponseData {
271 url: string;
272 protocol: string;
273 status: JsUint;
274 statusText: string;
275 fromCache: boolean;
276 headers: NetworkHeader[];
277 mimeType: string;
278 bytesReceived: JsUint;
279 headersSize: JsUint | null;
280 bodySize: JsUint | null;
281 content: NetworkResponseContent;
282 authChallenge?: NetworkAuthChallenge;
283}
284export interface NetworkAddInterceptResult {
285 intercept: NetworkIntercept;
286}
287export interface NetworkAuthRequired {
288 method: 'network.authRequired';
289 params: NetworkAuthRequiredParameters;
290}
291export interface NetworkAuthRequiredParameters extends NetworkBaseParameters {
292 response: NetworkResponseData;
293}
294export interface NetworkBeforeRequestSent {
295 method: 'network.beforeRequestSent';
296 params: NetworkBeforeRequestSentParameters;
297}
298export interface NetworkBeforeRequestSentParameters extends NetworkBaseParameters {
299 initiator: NetworkInitiator;
300}
301export interface NetworkFetchError {
302 method: 'network.fetchError';
303 params: NetworkFetchErrorParameters;
304}
305export interface NetworkFetchErrorParameters extends NetworkBaseParameters {
306 errorText: string;
307}
308export interface NetworkResponseCompleted {
309 method: 'network.responseCompleted';
310 params: NetworkResponseCompletedParameters;
311}
312export interface NetworkResponseCompletedParameters extends NetworkBaseParameters {
313 response: NetworkResponseData;
314}
315export interface NetworkResponseStarted {
316 method: 'network.responseStarted';
317 params: NetworkResponseStartedParameters;
318}
319export interface NetworkResponseStartedParameters extends NetworkBaseParameters {
320 response: NetworkResponseData;
321}
322export type ScriptResult = ScriptAddPreloadScriptResult | ScriptEvaluateResult | ScriptGetRealmsResult;
323export type ScriptEvent = ScriptMessage | ScriptRealmCreated | ScriptRealmDestroyed;
324export type ScriptChannel = string;
325export type ScriptEvaluateResult = ScriptEvaluateResultSuccess | ScriptEvaluateResultException;
326export interface ScriptEvaluateResultSuccess {
327 type: 'success';
328 result: ScriptRemoteValue;
329 realm: ScriptRealm;
330}
331export interface ScriptEvaluateResultException {
332 type: 'exception';
333 exceptionDetails: ScriptExceptionDetails;
334 realm: ScriptRealm;
335}
336export interface ScriptExceptionDetails {
337 columnNumber: JsUint;
338 exception: ScriptRemoteValue;
339 lineNumber: JsUint;
340 stackTrace: ScriptStackTrace;
341 text: string;
342}
343export type ScriptHandle = string;
344export type ScriptInternalId = string;
345export type ScriptPreloadScript = string;
346export type ScriptRealm = string;
347export type ScriptPrimitiveProtocolValue = ScriptUndefinedValue | ScriptNullValue | ScriptStringValue | ScriptNumberValue | ScriptBooleanValue | ScriptBigIntValue;
348export interface ScriptUndefinedValue {
349 type: 'undefined';
350}
351export interface ScriptNullValue {
352 type: null;
353}
354export interface ScriptStringValue {
355 type: 'string';
356 value: string;
357}
358export type ScriptSpecialNumber = 'NaN' | '-0' | 'Infinity' | '-Infinity';
359export interface ScriptNumberValue {
360 type: 'number';
361 value: Number | ScriptSpecialNumber;
362}
363export interface ScriptBooleanValue {
364 type: 'boolean';
365 value: boolean;
366}
367export interface ScriptBigIntValue {
368 type: 'bigint';
369 value: string;
370}
371export type ScriptRealmInfo = ScriptWindowRealmInfo | ScriptDedicatedWorkerRealmInfo | ScriptSharedWorkerRealmInfo | ScriptServiceWorkerRealmInfo | ScriptWorkerRealmInfo | ScriptPaintWorkletRealmInfo | ScriptAudioWorkletRealmInfo | ScriptWorkletRealmInfo;
372export interface ScriptBaseRealmInfo {
373 realm: ScriptRealm;
374 origin: string;
375}
376export interface ScriptWindowRealmInfo extends ScriptBaseRealmInfo {
377 type: 'window';
378 context: BrowsingContextBrowsingContext;
379 sandbox?: string;
380}
381export interface ScriptDedicatedWorkerRealmInfo extends ScriptBaseRealmInfo {
382 type: 'dedicated-worker';
383}
384export interface ScriptSharedWorkerRealmInfo extends ScriptBaseRealmInfo {
385 type: 'shared-worker';
386}
387export interface ScriptServiceWorkerRealmInfo extends ScriptBaseRealmInfo {
388 type: 'service-worker';
389}
390export interface ScriptWorkerRealmInfo extends ScriptBaseRealmInfo {
391 type: 'worker';
392}
393export interface ScriptPaintWorkletRealmInfo extends ScriptBaseRealmInfo {
394 type: 'paint-worklet';
395}
396export interface ScriptAudioWorkletRealmInfo extends ScriptBaseRealmInfo {
397 type: 'audio-worklet';
398}
399export interface ScriptWorkletRealmInfo extends ScriptBaseRealmInfo {
400 type: 'worklet';
401}
402export type ScriptRealmType = 'window' | 'dedicated-worker' | 'shared-worker' | 'service-worker' | 'worker' | 'paint-worklet' | 'audio-worklet' | 'worklet';
403export type ScriptRemoteValue = ScriptPrimitiveProtocolValue | ScriptSymbolRemoteValue | ScriptArrayRemoteValue | ScriptObjectRemoteValue | ScriptFunctionRemoteValue | ScriptRegExpRemoteValue | ScriptDateRemoteValue | ScriptMapRemoteValue | ScriptSetRemoteValue | ScriptWeakMapRemoteValue | ScriptWeakSetRemoteValue | ScriptIteratorRemoteValue | ScriptGeneratorRemoteValue | ScriptErrorRemoteValue | ScriptProxyRemoteValue | ScriptPromiseRemoteValue | ScriptTypedArrayRemoteValue | ScriptArrayBufferRemoteValue | ScriptNodeListRemoteValue | ScriptHtmlCollectionRemoteValue | ScriptNodeRemoteValue | ScriptWindowProxyRemoteValue;
404export type ScriptListRemoteValue = (ScriptRemoteValue)[];
405export type ScriptMappingRemoteValue = (ScriptRemoteValue | ScriptRemoteValue)[];
406export interface ScriptSymbolRemoteValue {
407 type: 'symbol';
408 handle?: ScriptHandle;
409 internalId?: ScriptInternalId;
410}
411export interface ScriptArrayRemoteValue {
412 type: 'array';
413 handle?: ScriptHandle;
414 internalId?: ScriptInternalId;
415 value?: ScriptListRemoteValue;
416}
417export interface ScriptObjectRemoteValue {
418 type: 'object';
419 handle?: ScriptHandle;
420 internalId?: ScriptInternalId;
421 value?: ScriptMappingRemoteValue;
422}
423export interface ScriptFunctionRemoteValue {
424 type: 'function';
425 handle?: ScriptHandle;
426 internalId?: ScriptInternalId;
427}
428export interface ScriptRegExpValue {
429 pattern: string;
430 flags?: string;
431}
432export interface ScriptRegExpLocalValue {
433 type: 'regexp';
434 value: ScriptRegExpValue;
435}
436export interface ScriptRegExpRemoteValue extends ScriptRegExpLocalValue {
437 handle?: ScriptHandle;
438 internalId?: ScriptInternalId;
439}
440export interface ScriptDateLocalValue {
441 type: 'date';
442 value: string;
443}
444export interface ScriptDateRemoteValue extends ScriptDateLocalValue {
445 handle?: ScriptHandle;
446 internalId?: ScriptInternalId;
447}
448export interface ScriptMapRemoteValue {
449 type: 'map';
450 handle?: ScriptHandle;
451 internalId?: ScriptInternalId;
452 value?: ScriptMappingRemoteValue;
453}
454export interface ScriptSetRemoteValue {
455 type: 'set';
456 handle?: ScriptHandle;
457 internalId?: ScriptInternalId;
458 value?: ScriptListRemoteValue;
459}
460export interface ScriptWeakMapRemoteValue {
461 type: 'weakmap';
462 handle?: ScriptHandle;
463 internalId?: ScriptInternalId;
464}
465export interface ScriptWeakSetRemoteValue {
466 type: 'weakset';
467 handle?: ScriptHandle;
468 internalId?: ScriptInternalId;
469}
470export interface ScriptIteratorRemoteValue {
471 type: 'iterator';
472 handle?: ScriptHandle;
473 internalId?: ScriptInternalId;
474}
475export interface ScriptGeneratorRemoteValue {
476 type: 'generator';
477 handle?: ScriptHandle;
478 internalId?: ScriptInternalId;
479}
480export interface ScriptErrorRemoteValue {
481 type: 'error';
482 handle?: ScriptHandle;
483 internalId?: ScriptInternalId;
484}
485export interface ScriptProxyRemoteValue {
486 type: 'proxy';
487 handle?: ScriptHandle;
488 internalId?: ScriptInternalId;
489}
490export interface ScriptPromiseRemoteValue {
491 type: 'promise';
492 handle?: ScriptHandle;
493 internalId?: ScriptInternalId;
494}
495export interface ScriptTypedArrayRemoteValue {
496 type: 'typedarray';
497 handle?: ScriptHandle;
498 internalId?: ScriptInternalId;
499}
500export interface ScriptArrayBufferRemoteValue {
501 type: 'arraybuffer';
502 handle?: ScriptHandle;
503 internalId?: ScriptInternalId;
504}
505export interface ScriptNodeListRemoteValue {
506 type: 'nodelist';
507 handle?: ScriptHandle;
508 internalId?: ScriptInternalId;
509 value?: ScriptListRemoteValue;
510}
511export interface ScriptHtmlCollectionRemoteValue {
512 type: 'htmlcollection';
513 handle?: ScriptHandle;
514 internalId?: ScriptInternalId;
515 value?: ScriptListRemoteValue;
516}
517export interface ScriptNodeRemoteValue {
518 type: 'node';
519 sharedId?: ScriptSharedId;
520 handle?: ScriptHandle;
521 internalId?: ScriptInternalId;
522 value?: ScriptNodeProperties;
523}
524export interface ScriptNodeProperties {
525 nodeType: JsUint;
526 childNodeCount: JsUint;
527 attributes?: Record<string, string>;
528 children?: ScriptNodeRemoteValue[];
529 localName?: string;
530 mode?: 'open' | 'closed';
531 namespaceUri?: string;
532 nodeValue?: string;
533 shadowRoot?: ScriptNodeRemoteValue | null;
534}
535export interface ScriptWindowProxyRemoteValue {
536 type: 'window';
537 value: ScriptWindowProxyProperties;
538 handle?: ScriptHandle;
539 internalId?: ScriptInternalId;
540}
541export interface ScriptWindowProxyProperties {
542 context: BrowsingContextBrowsingContext;
543}
544export type ScriptResultOwnership = 'root' | 'none';
545export type ScriptSharedId = string;
546export interface ScriptStackFrame {
547 columnNumber: JsUint;
548 functionName: string;
549 lineNumber: JsUint;
550 url: string;
551}
552export interface ScriptStackTrace {
553 callFrames: ScriptStackFrame[];
554}
555export interface ScriptSource {
556 realm: ScriptRealm;
557 context?: BrowsingContextBrowsingContext;
558}
559export interface ScriptAddPreloadScriptResult {
560 script: ScriptPreloadScript;
561}
562export interface ScriptGetRealmsResult {
563 realms: ScriptRealmInfo[];
564}
565export interface ScriptMessage {
566 method: 'script.message';
567 params: ScriptMessageParameters;
568}
569export interface ScriptMessageParameters {
570 channel: ScriptChannel;
571 data: ScriptRemoteValue;
572 source: ScriptSource;
573}
574export interface ScriptRealmCreated {
575 method: 'script.realmCreated';
576 params: ScriptRealmInfo;
577}
578export interface ScriptRealmDestroyed {
579 method: 'script.realmDestroyed';
580 params: ScriptRealmDestroyedParameters;
581}
582export interface ScriptRealmDestroyedParameters {
583 realm: ScriptRealm;
584}
585export interface LogEvent extends LogEntryAdded {
586}
587export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
588export type LogEntry = LogGenericLogEntry | LogConsoleLogEntry | LogJavascriptLogEntry;
589export interface LogBaseLogEntry {
590 level: LogLevel;
591 source: ScriptSource;
592 text: string | null;
593 timestamp: JsUint;
594 stackTrace?: ScriptStackTrace;
595}
596export interface LogGenericLogEntry extends LogBaseLogEntry {
597 type: string;
598}
599export interface LogConsoleLogEntry extends LogBaseLogEntry {
600 type: 'console';
601 method: string;
602 args: ScriptRemoteValue[];
603}
604export interface LogJavascriptLogEntry extends LogBaseLogEntry {
605 type: 'javascript';
606}
607export interface LogEntryAdded {
608 method: 'log.entryAdded';
609 params: LogEntry;
610}
611//# sourceMappingURL=localTypes.d.ts.map
\No newline at end of file