|
|
|
@ -5,8 +5,10 @@
|
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// Copied from upstream: https://github.com/GoogleChromeLabs/chromium-bidi/blob/main/src/protocol/generated/webdriver-bidi.ts
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* THIS FILE IS AUTOGENERATED by cddlconv 0.1.5.
|
|
|
|
|
* THIS FILE IS AUTOGENERATED by cddlconv 0.1.6.
|
|
|
|
|
* Run `node tools/generate-bidi-types.mjs` to regenerate.
|
|
|
|
|
* @see https://github.com/w3c/webdriver-bidi/blob/master/index.bs
|
|
|
|
|
*/
|
|
|
|
@ -26,6 +28,7 @@ export type CommandResponse = {
|
|
|
|
|
} & Extensible;
|
|
|
|
|
export type EventData =
|
|
|
|
|
| BrowsingContextEvent
|
|
|
|
|
| InputEvent
|
|
|
|
|
| LogEvent
|
|
|
|
|
| NetworkEvent
|
|
|
|
|
| ScriptEvent;
|
|
|
|
@ -36,14 +39,16 @@ export type CommandData =
|
|
|
|
|
| NetworkCommand
|
|
|
|
|
| ScriptCommand
|
|
|
|
|
| SessionCommand
|
|
|
|
|
| StorageCommand;
|
|
|
|
|
| StorageCommand
|
|
|
|
|
| WebExtensionCommand;
|
|
|
|
|
export type ResultData =
|
|
|
|
|
| BrowsingContextResult
|
|
|
|
|
| EmptyResult
|
|
|
|
|
| NetworkResult
|
|
|
|
|
| ScriptResult
|
|
|
|
|
| SessionResult
|
|
|
|
|
| StorageResult;
|
|
|
|
|
| StorageResult
|
|
|
|
|
| WebExtensionResult;
|
|
|
|
|
export type EmptyParams = Extensible;
|
|
|
|
|
export type Message = CommandResponse | ErrorResponse | Event;
|
|
|
|
|
export type ErrorResponse = {
|
|
|
|
@ -71,6 +76,7 @@ export const enum ErrorCode {
|
|
|
|
|
InvalidArgument = 'invalid argument',
|
|
|
|
|
InvalidSelector = 'invalid selector',
|
|
|
|
|
InvalidSessionId = 'invalid session id',
|
|
|
|
|
InvalidWebExtension = 'invalid web extension',
|
|
|
|
|
MoveTargetOutOfBounds = 'move target out of bounds',
|
|
|
|
|
NoSuchAlert = 'no such alert',
|
|
|
|
|
NoSuchElement = 'no such element',
|
|
|
|
@ -83,6 +89,7 @@ export const enum ErrorCode {
|
|
|
|
|
NoSuchScript = 'no such script',
|
|
|
|
|
NoSuchStoragePartition = 'no such storage partition',
|
|
|
|
|
NoSuchUserContext = 'no such user context',
|
|
|
|
|
NoSuchWebExtension = 'no such web extension',
|
|
|
|
|
SessionNotCreated = 'session not created',
|
|
|
|
|
UnableToCaptureScreen = 'unable to capture screen',
|
|
|
|
|
UnableToCloseBrowser = 'unable to close browser',
|
|
|
|
@ -105,10 +112,12 @@ export namespace Session {
|
|
|
|
|
| Session.DirectProxyConfiguration
|
|
|
|
|
| Session.ManualProxyConfiguration
|
|
|
|
|
| Session.PacProxyConfiguration
|
|
|
|
|
| Session.SystemProxyConfiguration
|
|
|
|
|
| Record<string, never>;
|
|
|
|
|
| Session.SystemProxyConfiguration;
|
|
|
|
|
}
|
|
|
|
|
export type SessionResult = Session.NewResult | Session.StatusResult;
|
|
|
|
|
export type SessionResult =
|
|
|
|
|
| Session.NewResult
|
|
|
|
|
| Session.StatusResult
|
|
|
|
|
| Session.SubscribeResult;
|
|
|
|
|
export namespace Session {
|
|
|
|
|
export type CapabilitiesRequest = {
|
|
|
|
|
alwaysMatch?: Session.CapabilityRequest;
|
|
|
|
@ -171,6 +180,7 @@ export namespace Session {
|
|
|
|
|
beforeUnload?: Session.UserPromptHandlerType;
|
|
|
|
|
confirm?: Session.UserPromptHandlerType;
|
|
|
|
|
default?: Session.UserPromptHandlerType;
|
|
|
|
|
file?: Session.UserPromptHandlerType;
|
|
|
|
|
prompt?: Session.UserPromptHandlerType;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
@ -181,6 +191,9 @@ export namespace Session {
|
|
|
|
|
Ignore = 'ignore',
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
export namespace Session {
|
|
|
|
|
export type Subscription = string;
|
|
|
|
|
}
|
|
|
|
|
export namespace Session {
|
|
|
|
|
export type SubscriptionRequest = {
|
|
|
|
|
events: [string, ...string[]];
|
|
|
|
@ -188,6 +201,21 @@ export namespace Session {
|
|
|
|
|
BrowsingContext.BrowsingContext,
|
|
|
|
|
...BrowsingContext.BrowsingContext[],
|
|
|
|
|
];
|
|
|
|
|
userContexts?: [Browser.UserContext, ...Browser.UserContext[]];
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace Session {
|
|
|
|
|
export type UnsubscribeByIdRequest = {
|
|
|
|
|
subscriptions: [Session.Subscription, ...Session.Subscription[]];
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace Session {
|
|
|
|
|
export type UnsubscribeByAttributesRequest = {
|
|
|
|
|
events: [string, ...string[]];
|
|
|
|
|
contexts?: [
|
|
|
|
|
BrowsingContext.BrowsingContext,
|
|
|
|
|
...BrowsingContext.BrowsingContext[],
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace Session {
|
|
|
|
@ -241,20 +269,46 @@ export namespace Session {
|
|
|
|
|
params: Session.SubscriptionRequest;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace Session {
|
|
|
|
|
export type SubscribeResult = {
|
|
|
|
|
subscription: Session.Subscription;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace Session {
|
|
|
|
|
export type Unsubscribe = {
|
|
|
|
|
method: 'session.unsubscribe';
|
|
|
|
|
params: Session.SubscriptionRequest;
|
|
|
|
|
params: Session.UnsubscribeParameters;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace Session {
|
|
|
|
|
export type UnsubscribeParameters =
|
|
|
|
|
| Session.UnsubscribeByAttributesRequest
|
|
|
|
|
| Session.UnsubscribeByIdRequest;
|
|
|
|
|
}
|
|
|
|
|
export type BrowserCommand =
|
|
|
|
|
| Browser.Close
|
|
|
|
|
| Browser.CreateUserContext
|
|
|
|
|
| Browser.GetClientWindows
|
|
|
|
|
| Browser.GetUserContexts
|
|
|
|
|
| Browser.RemoveUserContext;
|
|
|
|
|
| Browser.RemoveUserContext
|
|
|
|
|
| Browser.SetClientWindowState;
|
|
|
|
|
export type BrowserResult =
|
|
|
|
|
| Browser.CreateUserContextResult
|
|
|
|
|
| Browser.GetUserContextsResult;
|
|
|
|
|
export namespace Browser {
|
|
|
|
|
export type ClientWindow = string;
|
|
|
|
|
}
|
|
|
|
|
export namespace Browser {
|
|
|
|
|
export type ClientWindowInfo = {
|
|
|
|
|
active: boolean;
|
|
|
|
|
clientWindow: Browser.ClientWindow;
|
|
|
|
|
height: JsUint;
|
|
|
|
|
state: 'fullscreen' | 'maximized' | 'minimized' | 'normal';
|
|
|
|
|
width: JsUint;
|
|
|
|
|
x: JsInt;
|
|
|
|
|
y: JsInt;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace Browser {
|
|
|
|
|
export type UserContext = string;
|
|
|
|
|
}
|
|
|
|
@ -278,6 +332,17 @@ export namespace Browser {
|
|
|
|
|
export namespace Browser {
|
|
|
|
|
export type CreateUserContextResult = Browser.UserContextInfo;
|
|
|
|
|
}
|
|
|
|
|
export namespace Browser {
|
|
|
|
|
export type GetClientWindows = {
|
|
|
|
|
method: 'browser.getClientWindows';
|
|
|
|
|
params: EmptyParams;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace Browser {
|
|
|
|
|
export type GetClientWindowsResult = {
|
|
|
|
|
clientWindows: [...Browser.ClientWindowInfo[]];
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace Browser {
|
|
|
|
|
export type GetUserContexts = {
|
|
|
|
|
method: 'browser.getUserContexts';
|
|
|
|
@ -300,6 +365,31 @@ export namespace Browser {
|
|
|
|
|
userContext: Browser.UserContext;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace Browser {
|
|
|
|
|
export type SetClientWindowState = {
|
|
|
|
|
method: 'browser.setClientWindowState';
|
|
|
|
|
params: Browser.SetClientWindowStateParameters;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace Browser {
|
|
|
|
|
export type SetClientWindowStateParameters = {
|
|
|
|
|
clientWindow: Browser.ClientWindow;
|
|
|
|
|
} & (Browser.ClientWindowNamedState | Browser.ClientWindowRectState);
|
|
|
|
|
}
|
|
|
|
|
export namespace Browser {
|
|
|
|
|
export type ClientWindowNamedState = {
|
|
|
|
|
state: 'fullscreen' | 'maximized' | 'minimized';
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace Browser {
|
|
|
|
|
export type ClientWindowRectState = {
|
|
|
|
|
state: 'normal';
|
|
|
|
|
width?: JsUint;
|
|
|
|
|
height?: JsUint;
|
|
|
|
|
x?: JsInt;
|
|
|
|
|
y?: JsInt;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export type BrowsingContextCommand =
|
|
|
|
|
| BrowsingContext.Activate
|
|
|
|
|
| BrowsingContext.CaptureScreenshot
|
|
|
|
@ -319,8 +409,10 @@ export type BrowsingContextEvent =
|
|
|
|
|
| BrowsingContext.DomContentLoaded
|
|
|
|
|
| BrowsingContext.DownloadWillBegin
|
|
|
|
|
| BrowsingContext.FragmentNavigated
|
|
|
|
|
| BrowsingContext.HistoryUpdated
|
|
|
|
|
| BrowsingContext.Load
|
|
|
|
|
| BrowsingContext.NavigationAborted
|
|
|
|
|
| BrowsingContext.NavigationCommitted
|
|
|
|
|
| BrowsingContext.NavigationFailed
|
|
|
|
|
| BrowsingContext.NavigationStarted
|
|
|
|
|
| BrowsingContext.UserPromptClosed
|
|
|
|
@ -342,6 +434,7 @@ export namespace BrowsingContext {
|
|
|
|
|
export namespace BrowsingContext {
|
|
|
|
|
export type Info = {
|
|
|
|
|
children: BrowsingContext.InfoList | null;
|
|
|
|
|
clientWindow: Browser.ClientWindow;
|
|
|
|
|
context: BrowsingContext.BrowsingContext;
|
|
|
|
|
originalOpener: BrowsingContext.BrowsingContext | null;
|
|
|
|
|
url: string;
|
|
|
|
@ -353,6 +446,7 @@ export namespace BrowsingContext {
|
|
|
|
|
export type Locator =
|
|
|
|
|
| BrowsingContext.AccessibilityLocator
|
|
|
|
|
| BrowsingContext.CssLocator
|
|
|
|
|
| BrowsingContext.ContextLocator
|
|
|
|
|
| BrowsingContext.InnerTextLocator
|
|
|
|
|
| BrowsingContext.XPathLocator;
|
|
|
|
|
}
|
|
|
|
@ -371,6 +465,14 @@ export namespace BrowsingContext {
|
|
|
|
|
value: string;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace BrowsingContext {
|
|
|
|
|
export type ContextLocator = {
|
|
|
|
|
type: 'context';
|
|
|
|
|
value: {
|
|
|
|
|
context: BrowsingContext.BrowsingContext;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace BrowsingContext {
|
|
|
|
|
export type InnerTextLocator = {
|
|
|
|
|
type: 'innerText';
|
|
|
|
@ -691,12 +793,13 @@ export namespace BrowsingContext {
|
|
|
|
|
}
|
|
|
|
|
export namespace BrowsingContext {
|
|
|
|
|
export type SetViewportParameters = {
|
|
|
|
|
context: BrowsingContext.BrowsingContext;
|
|
|
|
|
context?: BrowsingContext.BrowsingContext;
|
|
|
|
|
viewport?: BrowsingContext.Viewport | null;
|
|
|
|
|
/**
|
|
|
|
|
* Must be greater than `0`.
|
|
|
|
|
*/
|
|
|
|
|
devicePixelRatio?: number | null;
|
|
|
|
|
userContexts?: [Browser.UserContext, ...Browser.UserContext[]];
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace BrowsingContext {
|
|
|
|
@ -744,6 +847,18 @@ export namespace BrowsingContext {
|
|
|
|
|
params: BrowsingContext.NavigationInfo;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace BrowsingContext {
|
|
|
|
|
export type HistoryUpdated = {
|
|
|
|
|
method: 'browsingContext.historyUpdated';
|
|
|
|
|
params: BrowsingContext.HistoryUpdatedParameters;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace BrowsingContext {
|
|
|
|
|
export type HistoryUpdatedParameters = {
|
|
|
|
|
context: BrowsingContext.BrowsingContext;
|
|
|
|
|
url: string;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace BrowsingContext {
|
|
|
|
|
export type DomContentLoaded = {
|
|
|
|
|
method: 'browsingContext.domContentLoaded';
|
|
|
|
@ -768,6 +883,12 @@ export namespace BrowsingContext {
|
|
|
|
|
params: BrowsingContext.NavigationInfo;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace BrowsingContext {
|
|
|
|
|
export type NavigationCommitted = {
|
|
|
|
|
method: 'browsingContext.navigationCommitted';
|
|
|
|
|
params: BrowsingContext.NavigationInfo;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace BrowsingContext {
|
|
|
|
|
export type NavigationFailed = {
|
|
|
|
|
method: 'browsingContext.navigationFailed';
|
|
|
|
@ -909,11 +1030,11 @@ export namespace Network {
|
|
|
|
|
}
|
|
|
|
|
export namespace Network {
|
|
|
|
|
export type Initiator = {
|
|
|
|
|
type: 'parser' | 'script' | 'preflight' | 'other';
|
|
|
|
|
columnNumber?: JsUint;
|
|
|
|
|
lineNumber?: JsUint;
|
|
|
|
|
stackTrace?: Script.StackTrace;
|
|
|
|
|
request?: Network.Request;
|
|
|
|
|
stackTrace?: Script.StackTrace;
|
|
|
|
|
type?: 'parser' | 'script' | 'preflight' | 'other';
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace Network {
|
|
|
|
@ -931,6 +1052,8 @@ export namespace Network {
|
|
|
|
|
cookies: [...Network.Cookie[]];
|
|
|
|
|
headersSize: JsUint;
|
|
|
|
|
bodySize: JsUint | null;
|
|
|
|
|
destination: string;
|
|
|
|
|
initiatorType: string | null;
|
|
|
|
|
timings: Network.FetchTimingInfo;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
@ -1136,7 +1259,7 @@ export namespace Network {
|
|
|
|
|
}
|
|
|
|
|
export namespace Network {
|
|
|
|
|
export type BeforeRequestSentParameters = Network.BaseParameters & {
|
|
|
|
|
initiator: Network.Initiator;
|
|
|
|
|
initiator?: Network.Initiator;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace Network {
|
|
|
|
@ -1718,6 +1841,7 @@ export namespace Script {
|
|
|
|
|
BrowsingContext.BrowsingContext,
|
|
|
|
|
...BrowsingContext.BrowsingContext[],
|
|
|
|
|
];
|
|
|
|
|
userContexts?: [Browser.UserContext, ...Browser.UserContext[]];
|
|
|
|
|
sandbox?: string;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
@ -1996,6 +2120,7 @@ export type InputCommand =
|
|
|
|
|
| Input.PerformActions
|
|
|
|
|
| Input.ReleaseActions
|
|
|
|
|
| Input.SetFiles;
|
|
|
|
|
export type InputEvent = Input.FileDialogOpened;
|
|
|
|
|
export namespace Input {
|
|
|
|
|
export type ElementOrigin = {
|
|
|
|
|
type: 'element';
|
|
|
|
@ -2117,8 +2242,8 @@ export namespace Input {
|
|
|
|
|
export namespace Input {
|
|
|
|
|
export type PointerMoveAction = {
|
|
|
|
|
type: 'pointerMove';
|
|
|
|
|
x: JsInt;
|
|
|
|
|
y: JsInt;
|
|
|
|
|
x: number;
|
|
|
|
|
y: number;
|
|
|
|
|
duration?: JsUint;
|
|
|
|
|
origin?: Input.Origin;
|
|
|
|
|
} & Input.PointerCommonProperties;
|
|
|
|
@ -2202,3 +2327,72 @@ export namespace Input {
|
|
|
|
|
files: [...string[]];
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace Input {
|
|
|
|
|
export type FileDialogOpened = {
|
|
|
|
|
method: 'input.fileDialogOpened';
|
|
|
|
|
params: Input.FileDialogInfo;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace Input {
|
|
|
|
|
export type FileDialogInfo = {
|
|
|
|
|
context: BrowsingContext.BrowsingContext;
|
|
|
|
|
element?: Script.SharedReference;
|
|
|
|
|
multiple: boolean;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export type WebExtensionCommand = WebExtension.Install | WebExtension.Uninstall;
|
|
|
|
|
export type WebExtensionResult = WebExtension.InstallResult;
|
|
|
|
|
export namespace WebExtension {
|
|
|
|
|
export type Extension = string;
|
|
|
|
|
}
|
|
|
|
|
export namespace WebExtension {
|
|
|
|
|
export type InstallParameters = {
|
|
|
|
|
extensionData: WebExtension.ExtensionData;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace WebExtension {
|
|
|
|
|
export type Install = {
|
|
|
|
|
method: 'webExtension.install';
|
|
|
|
|
params: WebExtension.InstallParameters;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace WebExtension {
|
|
|
|
|
export type ExtensionData =
|
|
|
|
|
| WebExtension.ExtensionArchivePath
|
|
|
|
|
| WebExtension.ExtensionBase64Encoded
|
|
|
|
|
| WebExtension.ExtensionPath;
|
|
|
|
|
}
|
|
|
|
|
export namespace WebExtension {
|
|
|
|
|
export type ExtensionPath = {
|
|
|
|
|
type: 'path';
|
|
|
|
|
path: string;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace WebExtension {
|
|
|
|
|
export type ExtensionArchivePath = {
|
|
|
|
|
type: 'archivePath';
|
|
|
|
|
path: string;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace WebExtension {
|
|
|
|
|
export type ExtensionBase64Encoded = {
|
|
|
|
|
type: 'base64';
|
|
|
|
|
value: string;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace WebExtension {
|
|
|
|
|
export type InstallResult = {
|
|
|
|
|
extension: WebExtension.Extension;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace WebExtension {
|
|
|
|
|
export type Uninstall = {
|
|
|
|
|
method: 'webExtension.uninstall';
|
|
|
|
|
params: WebExtension.UninstallParameters;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
export namespace WebExtension {
|
|
|
|
|
export type UninstallParameters = {
|
|
|
|
|
extension: WebExtension.Extension;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|