dev-browser
v0.2.2
Published
CLI for controlling browsers with sandboxed JavaScript scripts
Downloads
319
Maintainers
Readme
Brought to you by Do Browser.
A browser automation tool that lets AI agents and developers control browsers with sandboxed JavaScript scripts.
Key features:
- Sandboxed execution - Scripts run in a QuickJS WASM sandbox with no host access
- Persistent pages - Navigate once, interact across multiple scripts
- Auto-connect - Connect to your running Chrome or launch a fresh Chromium
- Full Playwright API - goto, click, fill, locators, evaluate, screenshots, and more
CLI Installation
npm install -g dev-browser
dev-browser install # installs Playwright + ChromiumWindows is not currently supported.
Quick start
# Launch a headless browser and run a script
dev-browser --headless <<'EOF'
const page = await browser.getPage("main");
await page.goto("https://example.com");
console.log(await page.title());
EOF
# Connect to your running Chrome (enable at chrome://inspect/#remote-debugging)
dev-browser --connect <<'EOF'
const tabs = await browser.listPages();
console.log(JSON.stringify(tabs, null, 2));
EOFUsing with AI agents
After installing, just tell your agent to run dev-browser --help — the help output includes a full LLM usage guide with examples and API reference. No plugin or skill installation needed.
Claude Code
/plugin marketplace add sawyerhood/dev-browser
/plugin install dev-browser@sawyerhood/dev-browserRestart Claude Code after installation.
Amp / Codex
Copy the skill to your skills directory:
# For Amp: ~/.claude/skills | For Codex: ~/.codex/skills
SKILLS_DIR=~/.claude/skills # or ~/.codex/skills
mkdir -p $SKILLS_DIR
git clone https://github.com/sawyerhood/dev-browser /tmp/dev-browser-skill
cp -r /tmp/dev-browser-skill/skills/dev-browser $SKILLS_DIR/dev-browser
rm -rf /tmp/dev-browser-skillScript API
Scripts run in a sandboxed QuickJS runtime (not Node.js). Available globals:
// Browser control
browser.getPage(nameOrId) // Get/create named page, or connect to tab by targetId
browser.newPage() // Create anonymous page (cleaned up after script)
browser.listPages() // List all tabs: [{id, url, title, name}]
browser.closePage(name) // Close a named page
// File I/O (restricted to ~/.dev-browser/tmp/)
await saveScreenshot(buf, name) // Save screenshot buffer, returns path
await writeFile(name, data) // Write file, returns path
await readFile(name) // Read file, returns content
// Output
console.log/warn/error/info // Routed to CLI stdout/stderrPages are full Playwright Page objects — goto, click, fill, locator, evaluate, screenshot, and everything else, including page.snapshotForAI({ track?, depth?, timeout? }), which returns { full, incremental? } for AI-friendly page snapshots.
Benchmarks
| Method | Time | Cost | Turns | Success | | ----------------------- | ------- | ----- | ----- | ------- | | Dev Browser | 3m 53s | $0.88 | 29 | 100% | | Playwright MCP | 4m 31s | $1.45 | 51 | 100% | | Playwright Skill | 8m 07s | $1.45 | 38 | 67% | | Claude Chrome Extension | 12m 54s | $2.81 | 80 | 100% |
See dev-browser-eval for methodology.
License
MIT
