Implementation:Webdriverio Webdriverio Bidi RemoteTypes
| Knowledge Sources | |
|---|---|
| Domains | Bidi_Protocol, Type_Definitions |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
The Bidi_RemoteTypes module provides auto-generated TypeScript type definitions for all WebDriver Bidi protocol remote command types, representing messages sent from the client to the browser.
Description
This file defines over 150 interfaces and type aliases that model the remote (client-to-browser) side of the WebDriver Bidi protocol. The root Command interface carries a numeric id field, and CommandData is a union of all domain-specific command types: BrowserCommand, BrowsingContextCommand, EmulationCommand, InputCommand, NetworkCommand, ScriptCommand, SessionCommand, StorageCommand, and WebExtensionCommand. Each domain command union further breaks down into individual command interfaces (e.g., BrowsingContextNavigate, NetworkAddIntercept) with their corresponding parameter interfaces.
The file includes comprehensive type definitions for locators (BrowsingContextLocator with accessibility, CSS, context, innerText, and XPath variants), input actions (InputSourceActions with none, key, pointer, and wheel sources), network types (NetworkUrlPattern, NetworkAuthCredentials, NetworkCookieHeader), script types (ScriptTarget, ScriptLocalValue, ScriptSerializationOptions), and web extension data types. It is auto-generated from the W3C WebDriver Bidi specification via npm run generate:bidi.
Usage
Use these types when constructing WebDriver Bidi protocol commands to send to the browser. They are imported as remote namespace throughout the webdriver package to type-check command parameters.
Code Reference
Source Location
- Repository: Webdriverio_Webdriverio
- File: packages/webdriver/src/bidi/remoteTypes.ts
Signature
export interface Command {
id: JsUint;
}
export type CommandData = BrowserCommand | BrowsingContextCommand | EmulationCommand
| InputCommand | NetworkCommand | ScriptCommand | SessionCommand
| StorageCommand | WebExtensionCommand
export interface EmptyParams {}
export type SessionCommand = SessionEnd | SessionNew | SessionStatus
| SessionSubscribe | SessionUnsubscribe
export type BrowserCommand = BrowserClose | BrowserCreateUserContext
| BrowserGetClientWindows | BrowserGetUserContexts
| BrowserRemoveUserContext | BrowserSetClientWindowState
export type BrowsingContextCommand = BrowsingContextActivate | BrowsingContextCaptureScreenshot
| BrowsingContextClose | BrowsingContextCreate | BrowsingContextGetTree
| BrowsingContextHandleUserPrompt | BrowsingContextLocateNodes
| BrowsingContextNavigate | BrowsingContextPrint | BrowsingContextReload
| BrowsingContextSetViewport | BrowsingContextTraverseHistory
export type NetworkCommand = NetworkAddIntercept | NetworkContinueRequest
| NetworkContinueResponse | NetworkContinueWithAuth | NetworkFailRequest
| NetworkProvideResponse | NetworkRemoveIntercept | NetworkSetCacheBehavior
export type ScriptCommand = ScriptAddPreloadScript | ScriptCallFunction
| ScriptDisown | ScriptEvaluate | ScriptGetRealms | ScriptRemovePreloadScript
export type StorageCommand = StorageDeleteCookies | StorageGetCookies | StorageSetCookie
export type InputCommand = InputPerformActions | InputReleaseActions | InputSetFiles
export type WebExtensionCommand = WebExtensionInstall | WebExtensionUninstall
Import
import type * as remote from './remoteTypes.js'
import type { CommandData } from './remoteTypes.js'
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| N/A | N/A | N/A | This is a type-only module with no runtime inputs. Types are used at compile time for type-checking Bidi commands. |
Outputs
| Name | Type | Description |
|---|---|---|
| Command | { id: JsUint } |
Base command interface with numeric identifier. |
| CommandData | union of 9 domain command types |
Union of all protocol domain command types for dispatching. |
| EmptyParams | {} |
Empty parameter object for commands that take no parameters. |
| *Parameters | various interfaces |
Parameter interfaces for each specific command (e.g., BrowsingContextNavigateParameters, ScriptEvaluateParameters).
|
Usage Examples
import type * as remote from './bidi/remoteTypes.js'
// Construct a navigate command parameter
const navigateParams: remote.BrowsingContextNavigateParameters = {
context: 'ctx-123',
url: 'https://example.com',
wait: 'complete'
};
// Construct a script evaluate command parameter
const evalParams: remote.ScriptEvaluateParameters = {
expression: 'document.title',
target: { context: 'ctx-123' },
awaitPromise: true
};
// Construct a network intercept parameter
const interceptParams: remote.NetworkAddInterceptParameters = {
phases: ['beforeRequestSent'],
urlPatterns: [{ type: 'pattern', hostname: '*.example.com' }]
};
// Construct an input action parameter
const actionParams: remote.InputPerformActionsParameters = {
context: 'ctx-123',
actions: [{
type: 'key',
id: 'keyboard',
actions: [{ type: 'keyDown', value: 'a' }, { type: 'keyUp', value: 'a' }]
}]
};