Browser automation CLI for AI agents
$git clone https://github.com/vercel-labs/agent-browserInstalls into the current project.
Install agent-browser by running `git clone https://github.com/vercel-labs/agent-browser`, then use it for the current task and follow its documentation at https://github.com/vercel-labs/agent-browser.
| 1 | # agent-browser |
| 2 | |
| 3 | Browser automation CLI for AI agents. Fast native Rust CLI. |
| 4 | |
| 5 | [](https://skills.sh/vercel-labs/agent-browser) |
| 6 | |
| 7 | ## Installation |
| 8 | |
| 9 | ### Global Installation (recommended) |
| 10 | |
| 11 | Installs the native Rust binary: |
| 12 | |
| 13 | ```bash |
| 14 | npm install -g agent-browser |
| 15 | agent-browser install # Download Chrome from Chrome for Testing (first time only) |
| 16 | ``` |
| 17 | |
| 18 | ### Project Installation (local dependency) |
| 19 | |
| 20 | For projects that want to pin the version in `package.json`: |
| 21 | |
| 22 | ```bash |
| 23 | npm install agent-browser |
| 24 | agent-browser install |
| 25 | ``` |
| 26 | |
| 27 | Then use via `package.json` scripts or by invoking `agent-browser` directly. |
| 28 | |
| 29 | ### Homebrew (macOS) |
| 30 | |
| 31 | ```bash |
| 32 | brew install agent-browser |
| 33 | agent-browser install # Download Chrome from Chrome for Testing (first time only) |
| 34 | ``` |
| 35 | |
| 36 | ### Cargo (Rust) |
| 37 | |
| 38 | ```bash |
| 39 | cargo install agent-browser |
| 40 | agent-browser install # Download Chrome from Chrome for Testing (first time only) |
| 41 | ``` |
| 42 | |
| 43 | ### From Source |
| 44 | |
| 45 | Requires Node.js 24+, pnpm 11+, and Rust. |
| 46 | |
| 47 | ```bash |
| 48 | git clone https://github.com/vercel-labs/agent-browser |
| 49 | cd agent-browser |
| 50 | pnpm install |
| 51 | pnpm build |
| 52 | pnpm build:native # Requires Rust (https://rustup.rs) |
| 53 | pnpm link --global # Makes agent-browser available globally |
| 54 | agent-browser install |
| 55 | ``` |
| 56 | |
| 57 | ### Linux Dependencies |
| 58 | |
| 59 | On Linux, install system dependencies: |
| 60 | |
| 61 | ```bash |
| 62 | agent-browser install --with-deps |
| 63 | ``` |
| 64 | |
| 65 | This exits nonzero if the package manager cannot install every required browser library. |
| 66 | |
| 67 | ### Updating |
| 68 | |
| 69 | Upgrade to the latest version: |
| 70 | |
| 71 | ```bash |
| 72 | agent-browser upgrade |
| 73 | ``` |
| 74 | |
| 75 | Detects your installation method (npm, Homebrew, or Cargo) and runs the appropriate update command automatically. |
| 76 | |
| 77 | ### Requirements |
| 78 | |
| 79 | - **Chrome** - Run `agent-browser install` to download Chrome from [Chrome for Testing](https://developer.chrome.com/blog/chrome-for-testing/) (Google's official automation channel). Existing Chrome, Brave, Playwright, and Puppeteer installations are detected automatically. No Playwright or Node.js required for the daemon. |
| 80 | - **Node.js 24+ and pnpm 11+** - Only needed when building from source. |
| 81 | - **Rust** - Only needed when building from source (see From Source above). |
| 82 | |
| 83 | ## Quick Start |
| 84 | |
| 85 | ```bash |
| 86 | agent-browser open example.com |
| 87 | agent-browser snapshot # Get accessibility tree with refs |
| 88 | agent-browser click @e2 # Click by ref from snapshot |
| 89 | agent-browser fill @e3 "test@example.com" # Fill by ref |
| 90 | agent-browser get text @e1 # Get text by ref |
| 91 | agent-browser screenshot page.png |
| 92 | agent-browser close |
| 93 | ``` |
| 94 | |
| 95 | Clicks fail early when another element covers the target's click point, for example a consent banner or modal. Dismiss or interact with the reported covering element, then take a fresh snapshot before retrying the original ref. |
| 96 | |
| 97 | Headless Chromium screenshots hide native scrollbars for consistent image output. Pass `--hide-scrollbars false` when launching to keep native scrollbars visible. |
| 98 | |
| 99 | ### Traditional Selectors (also supported) |
| 100 | |
| 101 | ```bash |
| 102 | agent-browser click "#submit" |
| 103 | agent-browser fill "#email" "test@example.com" |
| 104 | agent-browser find role button click --name "Submit" |
| 105 | ``` |
| 106 | |
| 107 | ## Commands |
| 108 | |
| 109 | ### Core Commands |
| 110 | |
| 111 | ```bash |
| 112 | agent-browser open # Launch browser (no navigation); stays on about:blank |
| 113 | agent-browser open <url> # Launch + navigate to URL (aliases: goto, navigate) |
| 114 | agent-browser read [url] # Fetch agent-readable text, or read rendered active-tab DOM |
| 115 | agent-browser click <sel> # Click element (--new-tab to open in new tab) |
| 116 | agent-browser dblclick <sel> # Double-click element |
| 117 | agent-browser focus <sel> # Focus element |
| 118 | agent-browser type <sel> <text> # Type into element |
| 119 | agent-browser fill <sel> <text> # Clear and fill |
| 120 | agent-browser press <key> # Press key (Enter, Tab, Control+a) (alias: key) |
| 121 | agent-browser keyboard type <text> # Type with real keystrokes (no selector, current focus) |
| 122 | agent-browser keyboard inserttext <text> # Insert text without key events (no selector) |
| 123 | agent-browser keydown <key> # Hold key down |
| 124 | agent-browser keyup <key> # Release key |
| 125 | agent-browser hover <sel> # Hover element |
| 126 | agent-browser select <sel> <val> # Select dropdown option |
| 127 | agent-browser check <sel> # Check checkbox |
| 128 | agent-browser uncheck <sel> # Uncheck checkbox |
| 129 | agent-browser scroll <dir> [px] # Scroll (up/down/left/right, --selector <sel>) |
| 130 | agent-browser scrollintoview <sel> # Scroll element into view (alias: scrollinto) |
| 131 | agent-browser drag <src> <tgt> # Drag and drop |
| 132 | agent-browser upload <sel> <files> # Upload files |
| 133 | agent-browser screenshot [path] # Take screenshot (--full for full page, saves to a temporary directory if no path) |
| 134 | agent-browser screenshot --annotate # Annotated screenshot with numbered element labels |
| 135 | agent-browser screenshot --screenshot-dir ./shots # Save to custom directory |
| 136 | agent-browser screenshot --screenshot-format jpeg --screenshot-quality 80 |
| 137 | agent-browser pdf <path> |