Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Webdriverio Webdriverio Bidi LocalTypes

From Leeroopedia
Knowledge Sources
Domains Bidi_Protocol, Type_Definitions
Last Updated 2026-02-12 00:00 GMT

Overview

The Bidi_LocalTypes module provides auto-generated TypeScript type definitions for all WebDriver Bidi protocol local message types, covering responses and events received from the browser.

Description

This file defines over 200 interfaces and type aliases that model the local (browser-to-client) side of the WebDriver Bidi protocol. The root type Message is a union of CommandResponse, ErrorResponse, and Event, representing all possible messages received over the Bidi WebSocket connection. It includes result types for every protocol domain: Session (SessionStatusResult, SessionNewResult, SessionSubscribeResult), Browser (BrowserCreateUserContextResult, BrowserGetClientWindowsResult, BrowserGetUserContextsResult), BrowsingContext (CaptureScreenshotResult, CreateResult, GetTreeResult, LocateNodesResult, NavigateResult, PrintResult, TraverseHistoryResult), Network (AddInterceptResult, and event parameter types for AuthRequired, BeforeRequestSent, FetchError, ResponseCompleted, ResponseStarted), Script (EvaluateResult, AddPreloadScriptResult, GetRealmsResult, and the full remote value hierarchy), Storage (GetCookiesResult, SetCookieResult, DeleteCookiesResult), Log (LogEntry variants), Input (FileDialogOpened), and WebExtension (InstallResult).

The file is auto-generated from the W3C WebDriver Bidi specification using npm run generate:bidi and should not be edited manually.

Usage

Use these types when consuming WebDriver Bidi protocol responses or events. They are imported as local namespace throughout the webdriver package to type-check command return values and event payloads.

Code Reference

Source Location

Signature

// Root message union
export type Message = CommandResponse | ErrorResponse | Event

export interface CommandResponse extends Extensible {
    type: 'success';
    id: JsUint;
    result: ResultData;
}

export interface ErrorResponse extends Extensible {
    type: 'error';
    id: JsUint | null;
    error: ErrorCode;
    message: string;
    stacktrace?: string;
}

export interface Event extends Extensible {
    type: 'event';
}

export type ResultData = BrowsingContextResult | EmptyResult | NetworkResult
    | ScriptResult | SessionResult | StorageResult | WebExtensionResult

export type ErrorCode = 'invalid argument' | 'invalid selector' | 'invalid session id'
    | 'invalid web extension' | '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'
    | 'no such storage partition' | 'no such user context' | 'no such web extension'
    | 'session not created' | 'unable to capture screen' | 'unable to close browser'
    | 'unable to set cookie' | 'unable to set file input'
    | 'underspecified storage partition' | 'unknown command' | 'unknown error'
    | 'unsupported operation'

export type EventData = BrowsingContextEvent | InputEvent | LogEvent
    | NetworkEvent | ScriptEvent

Import

import type * as local from './localTypes.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 responses and events.

Outputs

Name Type Description
Message ErrorResponse | Event Root union type for all incoming Bidi WebSocket messages.
ResultData EmptyResult | NetworkResult | ScriptResult | SessionResult | StorageResult | WebExtensionResult Union of all successful command result types.
EventData InputEvent | LogEvent | NetworkEvent | ScriptEvent Union of all event payload types organized by domain.
ErrorCode string literal union All 25 possible Bidi protocol error codes.

Usage Examples

import type * as local from './bidi/localTypes.js'

// Type a session status result
const status: local.SessionStatusResult = {
    ready: true,
    message: 'Session is ready'
};

// Type a navigation result
const navResult: local.BrowsingContextNavigateResult = {
    navigation: 'nav-123',
    url: 'https://example.com'
};

// Type a script evaluation result (success case)
const evalResult: local.ScriptEvaluateResultSuccess = {
    type: 'success',
    result: { type: 'string', value: 'hello world' },
    realm: 'realm-1'
};

// Type an error response
const errorResp: local.ErrorResponse = {
    type: 'error',
    id: 42,
    error: 'no such element',
    message: 'Element not found'
};

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment