Skip to main content

BAP CLI

CLI-first browser automation from the command line. BAP defaults to installed Chrome, an auto-detected profile when available, and a persistent daemon so agents can work against a real browser instead of starting fresh every time.

Install

Requires Node.js 20+ and Playwright browsers. Install browsers with npx playwright install chromium.

30-Second Demo

1

Navigate to a page

The --observe flag fuses navigation and observation into a single server call, returning interactive elements with stable refs.
2

Click an element

bash bap click role:button:"Get Started" Semantic selectors target elements by purpose, not DOM position. They survive redesigns.
3

Fill a form with composite actions

bap act fill:label:"Email"="user@example.com" \ fill:label:"Password"="secret" \
Returns validated JSON output.

Architecture

The server starts automatically on first use and persists across commands. No manual setup needed.
Use bap close-all to stop the daemon and shut down all browser sessions.

Why BAP CLI?

Composite Actions

Execute multi-step flows in one command instead of one-at-a-time. A login flow is 1 bap act, not 3 separate fill/click calls.

Semantic Selectors

Target elements by ARIA role, visible text, label, or placeholder. Selectors survive DOM changes and redesigns.

Structured Extraction

Extract validated JSON from pages using field names, JSON Schema, or list mode. No HTML parsing needed.

Composite Actions vs playwright-cli

Migrating from playwright-cli

BAP is a drop-in replacement. All e<N> refs from snapshots work identically: BAP adds composite actions, semantic selectors, smart observation, and structured extraction on top.

Output

Commands produce concise, AI-agent-friendly output. Files are saved to .bap/ in the current directory:
  • Snapshots: .bap/snapshot-<timestamp>.yml
  • Screenshots: .bap/screenshot-<timestamp>.png
  • Extractions: .bap/extraction-<timestamp>.json

Command Overview