Skip to main content

bap watch

Long-running command that subscribes to browser events and streams them to the terminal. Runs until Ctrl+C.

Usage

string
Comma-separated list of event types to show. Options: page, console, network, dialog, download. When omitted, all events are shown.
string
default:"pretty"
Output format: pretty (color-coded, human-readable) or json (NDJSON for piping).

Event Types

Page lifecycle events: load, navigation, close.
Browser console output with log level (error, warn, log, debug). 14:30:43 CONSOLE ERROR Uncaught TypeError: Cannot read properties of null 14:30:43 CONSOLE WARN Deprecation: Feature X will be removed in v3
HTTP requests and responses. Responses show status codes, color-coded by range.
Browser dialogs: alert, confirm, prompt. 14:30:44 DIALOG alert: Are you sure you want to leave?
File downloads with state and filename.

JSON Output

With --format=json, each event is emitted as a single JSON line (NDJSON), suitable for piping to other tools:

Use Cases

Debug failing interactions

Run bap watch --filter=console in one terminal while running BAP commands in another. Console errors often explain why clicks or fills fail.

Monitor API calls

Use bap watch --filter=network to see what API calls a page makes. Useful for understanding SPA behavior.

Pipe to log aggregator

bap watch --format=json | jq '.text' to extract console message text, or pipe to any NDJSON-compatible tool.

Catch unexpected dialogs

Use bap watch --filter=dialog to detect alert/confirm/prompt dialogs that might block automation.
bap watch requires a running browser session. If no session exists, start one first with bap open or bap goto.