Skip to main content

Installation

Requires Node.js >= 20.0.0 and a running BAP server.

Quick Start

Connection

| Option | Type | Default | Description | |--------|------|---------|-------------| | token | string | — | Authentication token | | maxReconnectAttempts | number | 5 | Max auto-reconnect attempts | | reconnectDelay | number | 1000 | Base delay for reconnect backoff (ms) | | timeout | number | 30000 | Default request timeout (ms) | | sessionId | string | — | Session ID for persistence |

Factory Function

Browser Control

Page Management

Actions

All action methods accept any selector type.

Agent Methods

The three composite methods optimized for AI agent workflows.

observe()

Get an AI-optimized snapshot of the page with interactive elements, stable refs, and optional screenshot annotation.

act()

Execute a multi-step action sequence atomically with pre/post observation fusion.

extract()

Extract structured data from the page using a JSON Schema.

Events

Storage

Contexts and Frames

Emulation

WebMCP Discovery

Error Handling