# dev-browser
> Let your AI agent use a browser through sandboxed Playwright scripts

## Summary
Browser automation CLI for AI agents — sandboxed Playwright scripts with persistent pages, auto-connect to Chrome, and AI-friendly page snapshots.

## Capabilities
- Control browsers via sandboxed JavaScript in QuickJS WASM
- Full Playwright API: goto, click, fill, locators, evaluate, screenshots
- Persistent page sessions across multiple scripts
- Auto-connect to running Chrome or launch fresh Chromium
- AI-friendly page snapshots via snapshotForAI()
- Headless and headed modes
- Sandboxed file I/O restricted to ~/.dev-browser/tmp/

## When to Use
- You want an AI agent to interact with web pages
- You need browser automation with sandboxed script execution
- You want to let an agent write Playwright code to browse the web

## When NOT to Use
- You only need to fetch static page content (use curl or firecrawl)
- You need browser automation without Node.js

## Key Flags
- `--headless`: Run browser in headless mode
- `--connect`: Attach to a running Chrome instance

## Usage Patterns
### Install and set up
```
npm i -g dev-browser && dev-browser install
```
Install globally and download Chromium

### Run headless
```
dev-browser --headless
```
Launch a headless browser session for scripting

### Connect to running Chrome
```
dev-browser --connect
```
Attach to an already running Chrome instance

## Input / Output
- **stdin**: JavaScript/Playwright scripts
- **stdout**: Script output, page snapshots, screenshot paths

## Installation
- **npm**: `npm install -g dev-browser`

## Related Tools
- [browserbase-cli](/tools/browserbase-cli) (alternative): Cloud browser sessions with bot protection bypass
- [firecrawl-cli](/tools/firecrawl-cli) (complementary): Web scraping focused on LLM-ready content extraction

---
Source: https://littlescripts.sh/tools/dev-browser
