# mb · mini-browser for agents Browser CLI for agents. Each command is a small Unix tool — reads args, writes stdout, composes with pipes and `&&`.
Eval JS in page — strings print raw, objects print JSON
wait
audit Design audit (colors, fonts, contrast, SEO, a11y)
logs Stream console logs (Ctrl+C to stop)
Flags:
--timeout (default: 30000)
--tab target tab (default: 0)
--json structured output (snap, tab list, logs, audit)
--right right-click
--double double-click
--fps recording frame rate (default: 30)
--scale recording scale factor (default: 1)
```
## Notes
All output goes to stdout. Pipe to grep, jq, wc, or redirect to files as usual.
### Navigation
`go` waits for `networkidle0` before returning, so SPAs render before the next
command runs. For heavy SPAs that fetch data after mount, follow up with
`wait ".selector"` for a content element.
### Observation
`text` calls `querySelector` — returns first match only. `text "p"` may return
empty if the first `` on the page is empty. Use a scoped selector like
`text "main"` or `text "#content"` for better results on noisy pages.
`snap` output format:
```
[0] button "Submit" (512, 380)
[1] textbox "Email" (512, 245) [disabled=true]
```
It returns role, accessible name, center (x,y) coords, and state flags (checked,
expanded, disabled, selected, pressed, haspopup). Only elements in the current
viewport are returned — scroll down and snap again to find more.
### Interaction
`click` supports `--right` for right-click and `--double` for double-click.
`type` without coordinates types at current focus. With coordinates it
triple-clicks the field first (selects all existing text) then types the
replacement.
`fill` matches fields by accessible name, `aria-label`, placeholder, `name`
attribute, id, then label text in that order. Use `fill "#my-input=value"` to
target by CSS selector when labels are missing.
`scroll` defaults to `scroll down 500` if called with no args.
### JavaScript
`js` reads from stdin with `-`:
```bash
echo 'document.title' | mb js -
cat scrape.js | mb js -
```
### Recording
`record start ` spawns a background daemon that captures the active tab
via Chrome's screencast API. Supported formats: `.webm`, `.mp4`, `.gif`.
Use `--fps` and `--scale` to control frame rate and resolution.
`record stop` sends SIGTERM to the daemon and waits up to 60 s for encoding to
finish.
`record status` prints whether a recording is in progress and how long it has
been running.
State is stored in `~/.mb-recorder.json`.
### Wait
`wait` picks its strategy from the argument format:
```
wait 2000 sleep (ms)
wait ".modal" wait for selector
wait networkidle wait for no network activity
wait url:/dashboard wait for URL to contain string
```
### Audit
`audit` collects palette, typography, spacing, contrast (via CDP), accessibility
checks, and basic SEO metadata in a single pass. Pass `--json` for structured
output.
### Tabs
`tab list` prints index, URL, and title for each open tab.
`tab new [url]` opens a new tab (optionally navigating) and prints its index.
`tab close [n]` closes a tab by index (default: last). Cannot close the last
remaining tab.
### JSON output
`--json` on `snap` returns `[{role, name, x, y, state}]`.
`--json` on `tab list` returns `[{index, url, title}]`.
`--json` on `logs` emits JSON lines `{tab, type, time, message}`.
`--json` on `audit` returns the full audit data as a JSON object.
### Overlays
Overlays (cookie banners, modals) block clicks on elements underneath. Dismiss
them first, or remove via JS:
```bash
mb js 'document.querySelector("[class*=cookie]")?.remove()'
mb js 'document.body.style.overflow="auto"'
```