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
Navigate to a page
--observe flag fuses navigation and observation into a single server call, returning interactive elements with stable refs.Click an element
bash bap click role:button:"Get Started" Semantic selectors target elements by purpose, not
DOM position. They survive redesigns.Architecture
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. Alle<N> refs from snapshots work identically:
| playwright-cli | bap |
|---|---|
playwright-cli open [url] | bap open [url] |
playwright-cli click e15 | bap click e15 |
playwright-cli fill e5 "text" | bap fill e5 "text" |
playwright-cli snapshot | bap snapshot |
playwright-cli screenshot | bap screenshot |
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
| Category | Commands |
|---|---|
| Essentials | goto, observe, act, extract, screenshot |
| Actions | click, fill, type, press, select, check/uncheck, hover, scroll |
| Navigation | open, back, forward, reload, close, close-all |
| Observation | observe, snapshot |
| Sessions & Tabs | sessions, tabs, tab-new, tab-select, frames, frame-switch |
| Workflows | workflow record/stop/run/list, run |
| Debugging | watch, trace, demo, plan |
| Configuration | config, install-skill, skill |