Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Microsoft Playwright BidiChromium

From Leeroopedia
Knowledge Sources
Domains BiDi, Chromium
Last Updated 2026-02-12 00:00 GMT

Overview

Concrete tool for launching and connecting to Chromium browsers using the WebDriver BiDi protocol provided by the Playwright library.

Description

The `BidiChromium` class extends `BrowserType` to provide Chromium-specific browser launching via the BiDi protocol. Since Chrome does not natively support BiDi, it dynamically loads the `bidiOverCdp` module to create a BiDi transport layer over the Chrome DevTools Protocol (CDP). The class handles Chromium-specific launch arguments (including GPU flags, disabled features, and headless configuration), rewrites startup log messages for common errors (missing X server), and manages the connection lifecycle including the `kBidiOverCdpWrapper` transport wrapper.

Usage

Use BidiChromium when launching Chromium-based browsers through Playwright's BiDi protocol path, which is the alternative transport to the direct CDP connection used by `CRBrowser`.

Code Reference

Source Location

Signature

export class BidiChromium extends BrowserType {
  constructor(parent: SdkObject);
  override async connectToTransport(transport: ConnectionTransport, options: BrowserOptions, browserLogsCollector: RecentLogsCollector): Promise<BidiBrowser>;
  override doRewriteStartupLog(logs: string): string;
  override defaultArgs(options: types.LaunchOptions, isPersistent: boolean, userDataDir: string): string[];
}

Import

import { BidiChromium } from '../server/bidi/bidiChromium';

I/O Contract

Inputs

Name Type Required Description
parent SdkObject Yes Parent SDK object for instrumentation
transport ConnectionTransport Yes The raw transport to the Chromium process
options BrowserOptions Yes Browser launch configuration options
browserLogsCollector RecentLogsCollector Yes Collector for recent browser stderr logs

Outputs

Name Type Description
browser BidiBrowser Connected BidiBrowser instance wrapping the Chromium process
args string[] Chromium command-line arguments for launching

Usage Examples

import { BidiChromium } from '../server/bidi/bidiChromium';

const bidiChromium = new BidiChromium(playwrightSdkObject);
const args = bidiChromium.defaultArgs(launchOptions, false, '/tmp/userdata');
const browser = await bidiChromium.connectToTransport(transport, browserOptions, logsCollector);

Related Pages

Page Connections

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