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 IPC Driver

From Leeroopedia
Revision as of 11:37, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Microsoft_Playwright_IPC_Driver.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains Inter-Process Communication, Server Infrastructure
Last Updated 2026-02-12 00:00 GMT

Overview

Concrete tool for running the Playwright server as an IPC subprocess that communicates via stdin/stdout pipe transport, provided by the Playwright library.

Description

This module provides the entry points for the Playwright driver process used by non-JavaScript language bindings (Python, .NET, Java). The runDriver() function creates a DispatcherConnection with a RootDispatcher and PlaywrightDispatcher, then connects them to a PipeTransport on process.stdout/process.stdin. It handles JSON serialization (including well-formed string support for non-JS bindings), graceful shutdown on transport close, and SIGINT suppression. The module also exports runServer() for starting a WebSocket-based PlaywrightServer, printApiJson() to dump the API schema, and launchBrowserServer() to launch a browser server from configuration.

Usage

Use these functions when launching the Playwright driver process from language binding CLIs or when starting a remote Playwright server. runDriver() is the primary entry point for the IPC driver subprocess used by non-JavaScript Playwright SDKs.

Code Reference

Source Location

Signature

export function printApiJson(): void;

export function runDriver(): void;

export type RunServerOptions = {
  port?: number;
  host?: string;
  path?: string;
  extension?: boolean;
  maxConnections?: number;
  browserProxyMode?: 'client' | 'tether';
  ownedByTetherClient?: boolean;
};

export async function runServer(options: RunServerOptions): Promise<void>;

export async function launchBrowserServer(browserName: string, configFile?: string): Promise<void>;

Import

import { runDriver, runServer, printApiJson, launchBrowserServer } from 'playwright-core/src/cli/driver';

I/O Contract

Inputs

Name Type Required Description
options (runServer) RunServerOptions No Server configuration including port, host, path, extension mode, and max connections
browserName (launchBrowserServer) string Yes The browser engine name (chromium, firefox, webkit)
configFile (launchBrowserServer) string No Path to a JSON config file with LaunchServerOptions

Outputs

Name Type Description
(runDriver) void Sets up pipe transport on stdin/stdout for IPC communication; runs until transport closes
(runServer) void Starts WebSocket server and prints the endpoint URL to stdout
(printApiJson) void Prints the API JSON schema to stdout
(launchBrowserServer) void Launches a browser server and prints the wsEndpoint to stdout

Usage Examples

// Typically invoked from CLI:
// npx playwright run-driver
runDriver();

// Start a WebSocket server:
await runServer({ port: 3000, path: '/ws' });

// Launch a browser server with config:
await launchBrowserServer('chromium', './browser-config.json');

Related Pages

Page Connections

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