rebrand: agent-browser-stealth → chrome-use, de-fork, reset to v1.0.0
Release binaries / Build macOS ARM64 (push) Has been cancelled
Release binaries / Build macOS x64 (push) Has been cancelled
Release binaries / Build Linux ARM64 (push) Has been cancelled
Release binaries / Build Linux musl ARM64 (push) Has been cancelled
Release binaries / Build Linux musl x64 (push) Has been cancelled
Release binaries / Build Linux x64 (push) Has been cancelled
Release binaries / Build Windows x64 (push) Has been cancelled
Release binaries / Attach binaries to GitHub Release (push) Has been cancelled

Standalone product rename across the whole repo (issue: project identity):

- Binary/package/repo/skill/docs: agent-browser[-stealth] → chrome-use
  (single binary name `chrome-use`; old aliases agent-browser/abs dropped).
- Version: 0.27.0-fork.51 → 1.0.0 (drop the upstream-fork counter).
- Native-messaging host: com.agent_browser.connect → com.leeguoo.chrome_use
  (CLI + ab-connect extension in lockstep — this is a breaking handshake change,
  extension bumped 0.4.2 → 0.5.0, needs a Web Store republish).
- Config dir: ~/.agent-browser → ~/.chrome-use.
- README/zh: reframed from "stealth fork of agent-browser" to a standalone
  product with a small `originally based on vercel-labs/agent-browser` credit.
- Kept AGENT_BROWSER_* env vars working (63 vars across the codebase; renaming
  them would break every existing script/skill for no user-facing gain).

Build green, 802 unit tests pass, fmt + clippy clean. Upstream attribution to
vercel-labs/agent-browser preserved.
This commit is contained in:
leeguooooo
2026-06-12 12:56:21 +09:00
parent b4c1707a01
commit 61060486f4
89 changed files with 1897 additions and 1926 deletions
+179 -179
View File
@@ -1,10 +1,10 @@
---
name: core
description: Core agent-browser usage guide. Read this before running any agent-browser commands. Covers the snapshot-and-ref workflow, navigating pages, interacting with elements (click, fill, type, select), extracting text and data, taking screenshots, managing tabs, handling forms and auth, waiting for content, running multiple browser sessions in parallel, and troubleshooting common failures. Use when the user asks to interact with a website, fill a form, click something, extract data, take a screenshot, log into a site, test a web app, or automate any browser task.
allowed-tools: Bash(agent-browser:*), Bash(agent-browser-stealth:*), Bash(abs:*), Bash(npx agent-browser:*), Bash(npx agent-browser-stealth:*)
description: Core chrome-use usage guide. Read this before running any chrome-use commands. Covers the snapshot-and-ref workflow, navigating pages, interacting with elements (click, fill, type, select), extracting text and data, taking screenshots, managing tabs, handling forms and auth, waiting for content, running multiple browser sessions in parallel, and troubleshooting common failures. Use when the user asks to interact with a website, fill a form, click something, extract data, take a screenshot, log into a site, test a web app, or automate any browser task.
allowed-tools: Bash(chrome-use:*), Bash(chrome-use:*), Bash(abs:*), Bash(npx chrome-use:*), Bash(npx chrome-use:*)
---
# agent-browser core
# chrome-use core
Fast browser automation CLI for AI agents. Chrome/Chromium via CDP, no
Playwright or Puppeteer dependency. Accessibility-tree snapshots with compact
@@ -18,17 +18,17 @@ web pages — see [When to load another skill](#when-to-load-another-skill).
> **Hit a rough edge? Please report it.** If a command surprised you — a
> confusing error, a stale `@ref`, an occluded click, a flaky wait, a missing
> feature, or anything that cost you extra turns — open a quick issue at
> **<https://github.com/leeguooooo/agent-browser-stealth/issues>** with the exact
> **<https://github.com/leeguooooo/chrome-use/issues>** with the exact
> command and what happened vs. what you expected. Agent-filed friction reports
> are how this tool gets sharper; a 30-second issue is genuinely valuable.
## The core loop
```bash
agent-browser open <url> # 1. Open a page
agent-browser snapshot -i # 2. See what's on it (interactive elements only)
agent-browser click @e3 # 3. Act on refs from the snapshot
agent-browser snapshot -i # 4. Re-snapshot after any page change
chrome-use open <url> # 1. Open a page
chrome-use snapshot -i # 2. See what's on it (interactive elements only)
chrome-use click @e3 # 3. Act on refs from the snapshot
chrome-use snapshot -i # 4. Re-snapshot after any page change
```
Refs (`@e1`, `@e2`, ...) are assigned fresh on every snapshot. They become
@@ -38,15 +38,15 @@ next ref interaction.
## Before you automate: pick the cheapest tool
Driving a browser is the heavy option. agent-browser earns its keep when you
Driving a browser is the heavy option. chrome-use earns its keep when you
need a **real, logged-in browser** — not for reading text off a public page.
| You need | Use |
|---|---|
| Discover what exists / find sources | `WebSearch` |
| Specific facts from a static or public page | `WebFetch` or `curl` (no browser) |
| Login state, interaction, JS-rendered or anti-bot pages | **agent-browser** (this skill) |
| A page the user saved before / an internal system | `agent-browser find-url <keywords>` (their bookmarks), then open it |
| Login state, interaction, JS-rendered or anti-bot pages | **chrome-use** (this skill) |
| A page the user saved before / an internal system | `chrome-use find-url <keywords>` (their bookmarks), then open it |
| The user's **own already-open, logged-in** Chrome window | the **extension connect** flow (below) |
Don't hand-build deep URLs with query params — links discovered by *interacting*
@@ -58,24 +58,24 @@ hand-constructed URL often doesn't.
When the task needs the user's *live* logged-in window (their real session, the
window they're looking at — not a fresh browser), use the extension connect flow.
One-time setup:
1. `agent-browser extension install` — registers the native-messaging host.
2. Install the **agent-browser-stealth** extension. Easiest (and restart-stable):
1. `chrome-use extension install` — registers the native-messaging host.
2. Install the **chrome-use** extension. Easiest (and restart-stable):
the **Chrome Web Store**, one-click *Add to Chrome*:
<https://chromewebstore.google.com/detail/agent-browser-stealth/knfcmbamhjmaonkfnjhldjedeobeafmk>
<https://chromewebstore.google.com/detail/chrome-use/knfcmbamhjmaonkfnjhldjedeobeafmk>
(Dev fallback: `chrome://extensions` → Developer mode → *Load unpacked*
`extensions/ab-connect`. Load-unpacked can be disabled on Chrome restart, so
prefer the Store build for unattended setups.)
Once installed, plain `agent-browser open <url>` auto-connects through the
Once installed, plain `chrome-use open <url>` auto-connects through the
extension relay — `auto_connect_cdp` **prefers the live relay over a raw
`--remote-debugging-port`**, so Chrome 136+'s "Allow remote debugging?" consent
popup never fires. `agent-browser extension connect` is the explicit form of the
popup never fires. `chrome-use extension connect` is the explicit form of the
same path. Zero-confirmation, zero-token. Use `--launch` instead when a fresh,
isolated browser is fine.
`--launch` opens an **isolated, empty test profile** — no cookies, no login, no
extensions (so the extension-relay path is off). Its window is labelled
`agent-browser (<session>)` in Chrome's profile menu so a human watching the
`chrome-use (<session>)` in Chrome's profile menu so a human watching the
desktop knows which session owns it. If a launched session needs more:
- **Real cookies / login / extensions** → drop `--launch`, use `--profile auto`
@@ -88,17 +88,17 @@ desktop knows which session owns it. If a launched session needs more:
attempt re-pops it). One of two things is true:
1. **You're on a stale build.** The relay-preference that avoids this dialog
landed in **fork.30**. Run `agent-browser --version`: if it's below
landed in **fork.30**. Run `chrome-use --version`: if it's below
`0.27.0-fork.30`, upgrade and retry:
```bash
curl -fsSL https://raw.githubusercontent.com/leeguooooo/agent-browser-stealth/main/install.sh | sh
curl -fsSL https://raw.githubusercontent.com/leeguooooo/chrome-use/main/install.sh | sh
```
If `which -a agent-browser` shows more than one install, an old **npm/pnpm**
If `which -a chrome-use` shows more than one install, an old **npm/pnpm**
copy (the npm registry lags behind — Releases are the source of truth) may be
shadowing the upgraded one; remove the stale copy
(`npm rm -g agent-browser-stealth` / `pnpm rm -g agent-browser-stealth`) so the
(`npm rm -g chrome-use` / `pnpm rm -g chrome-use`) so the
`install.sh` build wins. A tool that bundles its *own* pinned copy
(e.g. `node .../agent-browser-stealth@0.24.x/.../agent-browser`) needs that
(e.g. `node .../chrome-use@0.24.x/.../chrome-use`) needs that
copy upgraded too.
2. **The extension/relay isn't live.** Tell the user to install the Store
extension (one click, above); after that the relay stays up and the dialog
@@ -135,7 +135,7 @@ You have a **real Chrome with the user's DOM**. Two layers, mix them freely:
readable; best for straightforward forms and navigation. But the a11y view is
*lossy and fragile*: refs go stale on any change, hidden inputs never show up,
overlays can block coordinate clicks.
2. **eval-first** (`agent-browser eval "<js>"`) — your eyes and hands on the real
2. **eval-first** (`chrome-use eval "<js>"`) — your eyes and hands on the real
DOM: read hidden inputs, reach into Shadow DOM / iframes, inspect
`form.elements` and `.validity`, extract the exact shape you want, or call
`el.click()` directly. **The moment the structured path fights you, drop to
@@ -144,47 +144,47 @@ You have a **real Chrome with the user's DOM**. Two layers, mix them freely:
```bash
# "what's actually in this form / why won't it submit?"
agent-browser eval "[...document.forms[0].elements].map(e=>[e.name,e.type,e.value,e.checked])"
agent-browser eval "document.querySelector('[name=point_choice]')?.value"
agent-browser eval "[...document.forms[0].elements].filter(e=>!e.validity.valid).map(e=>e.name+': '+e.validationMessage)"
agent-browser eval "document.querySelector('#stubborn').click()" # direct DOM click, bypasses overlays
chrome-use eval "[...document.forms[0].elements].map(e=>[e.name,e.type,e.value,e.checked])"
chrome-use eval "document.querySelector('[name=point_choice]')?.value"
chrome-use eval "[...document.forms[0].elements].filter(e=>!e.validity.valid).map(e=>e.name+': '+e.validationMessage)"
chrome-use eval "document.querySelector('#stubborn').click()" # direct DOM click, bypasses overlays
```
## Quickstart
```bash
# Install once
npm i -g agent-browser && agent-browser install
npm i -g chrome-use && chrome-use install
# Take a screenshot of a page
agent-browser open https://example.com
agent-browser screenshot home.png
agent-browser close
chrome-use open https://example.com
chrome-use screenshot home.png
chrome-use close
# Search, click a result, and capture it
agent-browser open https://duckduckgo.com
agent-browser snapshot -i # find the search box ref
agent-browser fill @e1 "agent-browser cli"
agent-browser press Enter
agent-browser wait --load networkidle
agent-browser snapshot -i # refs now reflect results
agent-browser click @e5 # click a result
agent-browser screenshot result.png
chrome-use open https://duckduckgo.com
chrome-use snapshot -i # find the search box ref
chrome-use fill @e1 "chrome-use cli"
chrome-use press Enter
chrome-use wait --load networkidle
chrome-use snapshot -i # refs now reflect results
chrome-use click @e5 # click a result
chrome-use screenshot result.png
```
The browser stays running across commands so these feel like a single
session. Use `agent-browser close` (or `close --all`) when you're done.
session. Use `chrome-use close` (or `close --all`) when you're done.
## Reading a page
```bash
agent-browser snapshot # full tree (verbose)
agent-browser snapshot -i # interactive elements only (preferred)
agent-browser snapshot -i -u # include href urls on links
agent-browser snapshot -i -c # compact (no empty structural nodes)
agent-browser snapshot -i -d 3 # cap depth at 3 levels
agent-browser snapshot -s "#main" # scope to a CSS selector
agent-browser snapshot -i --json # machine-readable output
chrome-use snapshot # full tree (verbose)
chrome-use snapshot -i # interactive elements only (preferred)
chrome-use snapshot -i -u # include href urls on links
chrome-use snapshot -i -c # compact (no empty structural nodes)
chrome-use snapshot -i -d 3 # cap depth at 3 levels
chrome-use snapshot -s "#main" # scope to a CSS selector
chrome-use snapshot -i --json # machine-readable output
```
Snapshot output looks like:
@@ -207,32 +207,32 @@ assigned fresh on every snapshot.
For unstructured reading (no refs needed):
```bash
agent-browser get text @e1 # visible text of an element
agent-browser get html @e1 # innerHTML
agent-browser get attr @e1 href # any attribute
agent-browser get value @e1 # input value
agent-browser get title # page title
agent-browser get url # current URL
agent-browser get count ".item" # count matching elements
chrome-use get text @e1 # visible text of an element
chrome-use get html @e1 # innerHTML
chrome-use get attr @e1 href # any attribute
chrome-use get value @e1 # input value
chrome-use get title # page title
chrome-use get url # current URL
chrome-use get count ".item" # count matching elements
```
## Interacting
```bash
agent-browser click @e1 # click
agent-browser click @e1 --new-tab # open link in new tab instead of navigating
agent-browser dblclick @e1 # double-click
agent-browser hover @e1 # hover
agent-browser focus @e1 # focus (useful before keyboard input)
agent-browser fill @e2 "hello" # clear then type
agent-browser type @e2 " world" # type without clearing
agent-browser press Enter # press a key at current focus
agent-browser press Control+a # key combination
agent-browser check @e3 # check checkbox
agent-browser uncheck @e3 # uncheck
agent-browser select @e4 "option-value" # native <select> only
agent-browser select @e4 "a" "b" # select multiple
agent-browser pick @e4 --option "Europe" # ANY combobox (react-select / ARIA /
chrome-use click @e1 # click
chrome-use click @e1 --new-tab # open link in new tab instead of navigating
chrome-use dblclick @e1 # double-click
chrome-use hover @e1 # hover
chrome-use focus @e1 # focus (useful before keyboard input)
chrome-use fill @e2 "hello" # clear then type
chrome-use type @e2 " world" # type without clearing
chrome-use press Enter # press a key at current focus
chrome-use press Control+a # key combination
chrome-use check @e3 # check checkbox
chrome-use uncheck @e3 # uncheck
chrome-use select @e4 "option-value" # native <select> only
chrome-use select @e4 "a" "b" # select multiple
chrome-use pick @e4 --option "Europe" # ANY combobox (react-select / ARIA /
# native): opens it, waits for the menu
# (incl. portal-rendered), matches by
# visible text, fires the right events,
@@ -240,10 +240,10 @@ agent-browser pick @e4 --option "Europe" # ANY combobox (react-select / ARIA /
# (no silent no-op). Use this for custom
# dropdowns where `select` returns ✓ but
# changes nothing.
agent-browser upload @e5 file1.pdf # upload file(s)
agent-browser scroll down 500 # scroll page (up/down/left/right)
agent-browser scrollintoview @e1 # scroll element into view
agent-browser drag @e1 @e2 # drag and drop
chrome-use upload @e5 file1.pdf # upload file(s)
chrome-use scroll down 500 # scroll page (up/down/left/right)
chrome-use scrollintoview @e1 # scroll element into view
chrome-use drag @e1 @e2 # drag and drop
```
### When refs don't work or you don't want to snapshot
@@ -251,22 +251,22 @@ agent-browser drag @e1 @e2 # drag and drop
Use semantic locators:
```bash
agent-browser find role button click --name "Submit"
agent-browser find text "Sign In" click
agent-browser find text "Sign In" click --exact # exact match only
agent-browser find label "Email" fill "user@test.com"
agent-browser find placeholder "Search" type "query"
agent-browser find testid "submit-btn" click
agent-browser find first ".card" click
agent-browser find nth 2 ".card" hover
chrome-use find role button click --name "Submit"
chrome-use find text "Sign In" click
chrome-use find text "Sign In" click --exact # exact match only
chrome-use find label "Email" fill "user@test.com"
chrome-use find placeholder "Search" type "query"
chrome-use find testid "submit-btn" click
chrome-use find first ".card" click
chrome-use find nth 2 ".card" hover
```
Or a raw CSS selector:
```bash
agent-browser click "#submit"
agent-browser fill "input[name=email]" "user@test.com"
agent-browser click "button.primary"
chrome-use click "#submit"
chrome-use fill "input[name=email]" "user@test.com"
chrome-use click "button.primary"
```
Escalation ladder: snapshot + `@eN` refs are quickest for straightforward
@@ -278,16 +278,16 @@ occluded clicks). Don't retry a flaky structured locator three times; drop to
`click` auto-scrolls into view and, if the coordinate click is occluded, falls
back to a DOM `.click()`. If a click *reports success but nothing happened* —
classic for an autocomplete/menu `<li>` that closes on the input's blur — retry
that one with `AGENT_BROWSER_CLICK_MODE=dom agent-browser click ...`, or just
`agent-browser eval "<select the item via JS>"`.
that one with `AGENT_BROWSER_CLICK_MODE=dom chrome-use click ...`, or just
`chrome-use eval "<select the item via JS>"`.
Click a raw pixel point when the only handle you have is a coordinate (canvas,
a marker from a screenshot, a target with no stable selector):
```bash
agent-browser click 449 320 # click viewport point (x y)
agent-browser click 449,320 # same, comma form
agent-browser click --coords 449,320 # same, explicit flag
chrome-use click 449 320 # click viewport point (x y)
chrome-use click 449,320 # same, comma form
chrome-use click --coords 449,320 # same, explicit flag
```
A bare-number argument is always a coordinate, never a selector.
@@ -298,13 +298,13 @@ Agents fail more often from bad waits than from bad selectors. Pick the
right wait for the situation:
```bash
agent-browser wait @e1 # until an element appears
agent-browser wait 2000 # dumb wait, milliseconds (last resort)
agent-browser wait --text "Success" # until the text appears on the page
agent-browser wait --url "**/dashboard" # until URL matches pattern (glob)
agent-browser wait --load networkidle # until network idle (post-navigation)
agent-browser wait --load domcontentloaded # until DOMContentLoaded
agent-browser wait --fn "window.myApp.ready === true" # until JS condition
chrome-use wait @e1 # until an element appears
chrome-use wait 2000 # dumb wait, milliseconds (last resort)
chrome-use wait --text "Success" # until the text appears on the page
chrome-use wait --url "**/dashboard" # until URL matches pattern (glob)
chrome-use wait --load networkidle # until network idle (post-navigation)
chrome-use wait --load domcontentloaded # until DOMContentLoaded
chrome-use wait --fn "window.myApp.ready === true" # until JS condition
```
After any page-changing action, pick one:
@@ -321,42 +321,42 @@ flaky. Timeouts default to 25 seconds.
### Log in
```bash
agent-browser open https://app.example.com/login
agent-browser snapshot -i
chrome-use open https://app.example.com/login
chrome-use snapshot -i
# Pick the email/password refs out of the snapshot, then:
agent-browser fill @e3 "user@example.com"
agent-browser fill @e4 "hunter2"
agent-browser click @e5
agent-browser wait --url "**/dashboard"
agent-browser snapshot -i
chrome-use fill @e3 "user@example.com"
chrome-use fill @e4 "hunter2"
chrome-use click @e5
chrome-use wait --url "**/dashboard"
chrome-use snapshot -i
```
Credentials in shell history are a leak. For anything sensitive, use the
auth vault (see [references/authentication.md](references/authentication.md)):
```bash
agent-browser auth save my-app --url https://app.example.com/login \
chrome-use auth save my-app --url https://app.example.com/login \
--username user@example.com --password-stdin
# (type password, Ctrl+D)
agent-browser auth login my-app # fills + clicks, waits for form
chrome-use auth login my-app # fills + clicks, waits for form
```
### Persist session across runs
```bash
# Log in once, save cookies + localStorage
agent-browser state save ./auth.json
chrome-use state save ./auth.json
# Later runs start already-logged-in
agent-browser --state ./auth.json open https://app.example.com
chrome-use --state ./auth.json open https://app.example.com
```
Or use `--session-name` for auto-save/restore:
```bash
AGENT_BROWSER_SESSION_NAME=my-app agent-browser open https://app.example.com
AGENT_BROWSER_SESSION_NAME=my-app chrome-use open https://app.example.com
# State is auto-saved and restored on subsequent runs with the same name.
```
@@ -369,7 +369,7 @@ re-discover it.** Keep one markdown file per domain (these are your own notes,
not shipped with the skill):
```
~/.agent-browser/site-patterns/<domain>.md
~/.chrome-use/site-patterns/<domain>.md
```
**Before** working on a domain, read its file if it exists (use your normal file
@@ -402,15 +402,15 @@ page every time.
```bash
# Structured snapshot (best for AI reasoning over page content)
agent-browser snapshot -i --json > page.json
chrome-use snapshot -i --json > page.json
# Targeted extraction with refs
agent-browser snapshot -i
agent-browser get text @e5
agent-browser get attr @e10 href
chrome-use snapshot -i
chrome-use get text @e5
chrome-use get attr @e10 href
# Arbitrary shape via JavaScript
cat <<'EOF' | agent-browser eval --stdin
cat <<'EOF' | chrome-use eval --stdin
const rows = document.querySelectorAll("table tbody tr");
Array.from(rows).map(r => ({
name: r.cells[0].innerText,
@@ -421,7 +421,7 @@ EOF
Prefer `eval --stdin` (heredoc), `eval --file <path>`, or `eval -b <base64>`
for any JS with quotes, **non-ASCII identifiers/strings (e.g. Chinese)**, or
large scripts — inline `agent-browser eval "..."` is shell-mangled and works
large scripts — inline `chrome-use eval "..."` is shell-mangled and works
only for simple ASCII expressions.
**`eval` runs in the page's MAIN world and state persists across calls**, so a
@@ -440,10 +440,10 @@ key events (some search-as-you-type widgets) won't react; use `keyboard type` (o
### Screenshot
```bash
agent-browser screenshot # temp path, printed on stdout
agent-browser screenshot page.png # specific path
agent-browser screenshot --full full.png # full scroll height
agent-browser screenshot --annotate map.png # numbered labels + legend keyed to snapshot refs
chrome-use screenshot # temp path, printed on stdout
chrome-use screenshot page.png # specific path
chrome-use screenshot --full full.png # full scroll height
chrome-use screenshot --annotate map.png # numbered labels + legend keyed to snapshot refs
```
Headless Chromium screenshots hide native scrollbars for consistent image output.
@@ -454,11 +454,11 @@ Pass `--hide-scrollbars false` when launching to keep native scrollbars visible.
### Handle multiple pages via tabs
```bash
agent-browser tab # list open tabs (with stable tabId)
agent-browser tabs # alias for `tab` (lists too)
agent-browser tab new https://docs... # open a new tab (and switch to it)
agent-browser tab t2 # switch to tab t2
agent-browser tab close t2 # close tab t2
chrome-use tab # list open tabs (with stable tabId)
chrome-use tabs # alias for `tab` (lists too)
chrome-use tab new https://docs... # open a new tab (and switch to it)
chrome-use tab t2 # switch to tab t2
chrome-use tab close t2 # close tab t2
```
(`tabs` → the `tab` subcommand tree, and `get-text <sel>` → `get text <sel>` —
@@ -475,10 +475,10 @@ Each `--session <name>` is an isolated browser with its own cookies, tabs,
and refs. Useful for testing multi-user flows or parallel scraping:
```bash
agent-browser --session a open https://app.example.com
agent-browser --session b open https://app.example.com
agent-browser --session a fill @e1 "alice@test.com"
agent-browser --session b fill @e1 "bob@test.com"
chrome-use --session a open https://app.example.com
chrome-use --session b open https://app.example.com
chrome-use --session a fill @e1 "alice@test.com"
chrome-use --session b fill @e1 "bob@test.com"
```
`AGENT_BROWSER_SESSION=myapp` sets the default session for the current
@@ -500,23 +500,23 @@ extension (each with a distinct `--session`), not raw `--cdp`.
### Mock network requests
```bash
agent-browser network route "**/api/users" --body '{"users":[]}' # stub a response
agent-browser network route "**/analytics" --abort # block entirely
agent-browser network requests --clear # start capturing fresh
agent-browser network requests # inspect what fired
agent-browser network har start # record all traffic
chrome-use network route "**/api/users" --body '{"users":[]}' # stub a response
chrome-use network route "**/analytics" --abort # block entirely
chrome-use network requests --clear # start capturing fresh
chrome-use network requests # inspect what fired
chrome-use network har start # record all traffic
# ... perform actions ...
agent-browser network har stop /tmp/trace.har
chrome-use network har stop /tmp/trace.har
```
### Record a video of the workflow
```bash
agent-browser record start demo.webm
agent-browser open https://example.com
agent-browser snapshot -i
agent-browser click @e3
agent-browser record stop
chrome-use record start demo.webm
chrome-use open https://example.com
chrome-use snapshot -i
chrome-use click @e3
chrome-use record stop
```
See [references/video-recording.md](references/video-recording.md) for
@@ -527,21 +527,21 @@ codec options, GIF export, and more.
Iframes are auto-inlined in the snapshot — their refs work transparently:
```bash
agent-browser snapshot -i
chrome-use snapshot -i
# @e3 [Iframe] "payment-frame"
# @e4 [input] "Card number"
# @e5 [button] "Pay"
agent-browser fill @e4 "4111111111111111"
agent-browser click @e5
chrome-use fill @e4 "4111111111111111"
chrome-use click @e5
```
To scope a snapshot to an iframe (for focus or deep nesting):
```bash
agent-browser frame @e3 # switch context to the iframe
agent-browser snapshot -i
agent-browser frame main # back to main frame
chrome-use frame @e3 # switch context to the iframe
chrome-use snapshot -i
chrome-use frame main # back to main frame
```
### Dialogs
@@ -550,10 +550,10 @@ agent-browser frame main # back to main frame
`confirm` and `prompt`:
```bash
agent-browser dialog status # is there a pending dialog?
agent-browser dialog accept # accept
agent-browser dialog accept "text" # accept with prompt input
agent-browser dialog dismiss # cancel
chrome-use dialog status # is there a pending dialog?
chrome-use dialog accept # accept
chrome-use dialog accept "text" # accept with prompt input
chrome-use dialog dismiss # cancel
```
## Diagnosing install issues
@@ -563,12 +563,12 @@ stale daemons, version mismatches after `upgrade`, missing Chrome, etc.)
run `doctor` before anything else:
```bash
agent-browser doctor # full diagnosis (env, Chrome, daemons, config, providers, network, launch test)
agent-browser doctor --offline --quick # fast, local-only
agent-browser doctor --fix # also run destructive repairs (reinstall Chrome, purge old state, ...)
agent-browser doctor --json # structured output for programmatic consumption
agent-browser stealth status # stealth self-check: mode + live probes
agent-browser stealth status --json # (webdriver/chrome/plugins/UA) + applied
chrome-use doctor # full diagnosis (env, Chrome, daemons, config, providers, network, launch test)
chrome-use doctor --offline --quick # fast, local-only
chrome-use doctor --fix # also run destructive repairs (reinstall Chrome, purge old state, ...)
chrome-use doctor --json # structured output for programmatic consumption
chrome-use stealth status # stealth self-check: mode + live probes
chrome-use stealth status --json # (webdriver/chrome/plugins/UA) + applied
# overrides. Gate a sensitive flow on this
# instead of driving an external detector.
```
@@ -580,18 +580,18 @@ Destructive actions require `--fix`. Exit code is `0` if all checks pass
## Troubleshooting
**"Ref not found" / "Element not found: @eN"**
Page changed since the snapshot. Run `agent-browser snapshot -i` again,
Page changed since the snapshot. Run `chrome-use snapshot -i` again,
then use the new refs.
**Element exists in the DOM but not in the snapshot**
It's probably off-screen or not yet rendered. Try:
```bash
agent-browser scroll down 1000
agent-browser snapshot -i
chrome-use scroll down 1000
chrome-use snapshot -i
# or
agent-browser wait --text "..."
agent-browser snapshot -i
chrome-use wait --text "..."
chrome-use snapshot -i
```
**Click does nothing / overlay swallows the click**
@@ -602,7 +602,7 @@ dismiss/close button, click it, then re-snapshot.
Your tab was closed, navigated across processes, or its debugger detached
(e.g. it landed on a `chrome://` or Chrome Web Store page, which Chrome
forbids debugging). The session no longer has a live tab — re-run
`agent-browser open <your URL>` to re-attach, then retry. This loud error
`chrome-use open <your URL>` to re-attach, then retry. This loud error
replaces the old silent behaviour where the command ran on some *other*
tab and returned wrong data.
@@ -617,17 +617,17 @@ sanity check on every read.
Some custom input components intercept key events. Try:
```bash
agent-browser focus @e1
agent-browser keyboard inserttext "text" # bypasses key events
chrome-use focus @e1
chrome-use keyboard inserttext "text" # bypasses key events
# or
agent-browser keyboard type "text" # raw keystrokes, no selector
chrome-use keyboard type "text" # raw keystrokes, no selector
```
**Page needs JS you can't get right in one shot**
Use `eval --stdin` with a heredoc instead of inline:
```bash
cat <<'EOF' | agent-browser eval --stdin
cat <<'EOF' | chrome-use eval --stdin
// Complex script with quotes, backticks, whatever
document.querySelectorAll('[data-id]').length
EOF
@@ -665,28 +665,28 @@ and [references/authentication.md](references/authentication.md).
## When to load another skill
- **Electron desktop app** (VS Code, Slack desktop, Discord, Figma, etc.):
`agent-browser skills get electron`
- **Slack workspace automation**: `agent-browser skills get slack`
- **Exploratory testing / QA / bug hunts**: `agent-browser skills get dogfood`
- **Vercel Sandbox microVMs**: `agent-browser skills get vercel-sandbox`
- **AWS Bedrock AgentCore cloud browser**: `agent-browser skills get agentcore`
`chrome-use skills get electron`
- **Slack workspace automation**: `chrome-use skills get slack`
- **Exploratory testing / QA / bug hunts**: `chrome-use skills get dogfood`
- **Vercel Sandbox microVMs**: `chrome-use skills get vercel-sandbox`
- **AWS Bedrock AgentCore cloud browser**: `chrome-use skills get agentcore`
## React / Web Vitals (built-in, any React app)
agent-browser ships with first-class React introspection. Works on any
chrome-use ships with first-class React introspection. Works on any
React app — Next.js, Remix, Vite+React, CRA, TanStack Start, React Native
Web, etc. The `react …` commands require the React DevTools hook to be
installed at launch via `--enable react-devtools`:
```bash
agent-browser open --enable react-devtools http://localhost:3000
agent-browser react tree # component tree
agent-browser react inspect <fiberId> # props, hooks, state, source
agent-browser react renders start # begin re-render recording
agent-browser react renders stop # print render profile
agent-browser react suspense [--only-dynamic] # Suspense boundaries + classifier
agent-browser vitals [url] # LCP/CLS/TTFB/FCP/INP + hydration
agent-browser pushstate <url> # SPA navigation (auto-detects Next router)
chrome-use open --enable react-devtools http://localhost:3000
chrome-use react tree # component tree
chrome-use react inspect <fiberId> # props, hooks, state, source
chrome-use react renders start # begin re-render recording
chrome-use react renders stop # print render profile
chrome-use react suspense [--only-dynamic] # Suspense boundaries + classifier
chrome-use vitals [url] # LCP/CLS/TTFB/FCP/INP + hydration
chrome-use pushstate <url> # SPA navigation (auto-detects Next router)
```
Without `--enable react-devtools`, the `react …` commands error. `vitals`
@@ -706,7 +706,7 @@ instructed. See `references/trust-boundaries.md` for the full rules.
Everything covered here plus the complete command/flag/env listing:
```bash
agent-browser skills get core --full
chrome-use skills get core --full
```
That pulls in:
+70 -70
View File
@@ -44,18 +44,18 @@ Log in to your target site(s) in this Chrome window as you normally would.
```bash
# Auto-discover the running Chrome and save its cookies + localStorage
agent-browser --auto-connect state save ./my-auth.json
chrome-use --auto-connect state save ./my-auth.json
```
**Step 3: Reuse in automation**
```bash
# Load auth at launch
agent-browser --state ./my-auth.json open https://app.example.com/dashboard
chrome-use --state ./my-auth.json open https://app.example.com/dashboard
# Or load into an existing session
agent-browser state load ./my-auth.json
agent-browser open https://app.example.com/dashboard
chrome-use state load ./my-auth.json
chrome-use open https://app.example.com/dashboard
```
This works for any site, including those with complex OAuth flows, SSO, or 2FA -- as long as Chrome already has valid session cookies.
@@ -65,35 +65,35 @@ This works for any site, including those with complex OAuth flows, SSO, or 2FA -
**Tip:** Combine with `--session-name` so the imported auth auto-persists across restarts:
```bash
agent-browser --session-name myapp state load ./my-auth.json
chrome-use --session-name myapp state load ./my-auth.json
# From now on, state is auto-saved/restored for "myapp"
```
## Persistent Profiles
Use `--profile` to point agent-browser at a Chrome user data directory. This persists everything (cookies, IndexedDB, service workers, cache) across browser restarts without explicit save/load:
Use `--profile` to point chrome-use at a Chrome user data directory. This persists everything (cookies, IndexedDB, service workers, cache) across browser restarts without explicit save/load:
```bash
# First run: login once
agent-browser --profile ~/.myapp-profile open https://app.example.com/login
chrome-use --profile ~/.myapp-profile open https://app.example.com/login
# ... complete login flow ...
# All subsequent runs: already authenticated
agent-browser --profile ~/.myapp-profile open https://app.example.com/dashboard
chrome-use --profile ~/.myapp-profile open https://app.example.com/dashboard
```
Use different paths for different projects or test users:
```bash
agent-browser --profile ~/.profiles/admin open https://app.example.com
agent-browser --profile ~/.profiles/viewer open https://app.example.com
chrome-use --profile ~/.profiles/admin open https://app.example.com
chrome-use --profile ~/.profiles/viewer open https://app.example.com
```
Or set via environment variable:
```bash
export AGENT_BROWSER_PROFILE=~/.myapp-profile
agent-browser open https://app.example.com/dashboard
chrome-use open https://app.example.com/dashboard
```
## Session Persistence
@@ -102,42 +102,42 @@ Use `--session-name` to auto-save and restore cookies + localStorage by name, wi
```bash
# Auto-saves state on close, auto-restores on next launch
agent-browser --session-name twitter open https://twitter.com
chrome-use --session-name twitter open https://twitter.com
# ... login flow ...
agent-browser close # state saved to ~/.agent-browser/sessions/
chrome-use close # state saved to ~/.chrome-use/sessions/
# Next time: state is automatically restored
agent-browser --session-name twitter open https://twitter.com
chrome-use --session-name twitter open https://twitter.com
```
Encrypt state at rest:
```bash
export AGENT_BROWSER_ENCRYPTION_KEY=$(openssl rand -hex 32)
agent-browser --session-name secure open https://app.example.com
chrome-use --session-name secure open https://app.example.com
```
## Basic Login Flow
```bash
# Navigate to login page
agent-browser open https://app.example.com/login
agent-browser wait --load networkidle
chrome-use open https://app.example.com/login
chrome-use wait --load networkidle
# Get form elements
agent-browser snapshot -i
chrome-use snapshot -i
# Output: @e1 [input type="email"], @e2 [input type="password"], @e3 [button] "Sign In"
# Fill credentials
agent-browser fill @e1 "user@example.com"
agent-browser fill @e2 "password123"
chrome-use fill @e1 "user@example.com"
chrome-use fill @e2 "password123"
# Submit
agent-browser click @e3
agent-browser wait --load networkidle
chrome-use click @e3
chrome-use wait --load networkidle
# Verify login succeeded
agent-browser get url # Should be dashboard, not login
chrome-use get url # Should be dashboard, not login
```
## Saving Authentication State
@@ -146,15 +146,15 @@ After logging in, save state for reuse:
```bash
# Login first (see above)
agent-browser open https://app.example.com/login
agent-browser snapshot -i
agent-browser fill @e1 "user@example.com"
agent-browser fill @e2 "password123"
agent-browser click @e3
agent-browser wait --url "**/dashboard"
chrome-use open https://app.example.com/login
chrome-use snapshot -i
chrome-use fill @e1 "user@example.com"
chrome-use fill @e2 "password123"
chrome-use click @e3
chrome-use wait --url "**/dashboard"
# Save authenticated state
agent-browser state save ./auth-state.json
chrome-use state save ./auth-state.json
```
## Restoring Authentication
@@ -163,13 +163,13 @@ Skip login by loading saved state:
```bash
# Load saved auth state
agent-browser state load ./auth-state.json
chrome-use state load ./auth-state.json
# Navigate directly to protected page
agent-browser open https://app.example.com/dashboard
chrome-use open https://app.example.com/dashboard
# Verify authenticated
agent-browser snapshot -i
chrome-use snapshot -i
```
## OAuth / SSO Flows
@@ -178,23 +178,23 @@ For OAuth redirects:
```bash
# Start OAuth flow
agent-browser open https://app.example.com/auth/google
chrome-use open https://app.example.com/auth/google
# Handle redirects automatically
agent-browser wait --url "**/accounts.google.com**"
agent-browser snapshot -i
chrome-use wait --url "**/accounts.google.com**"
chrome-use snapshot -i
# Fill Google credentials
agent-browser fill @e1 "user@gmail.com"
agent-browser click @e2 # Next button
agent-browser wait 2000
agent-browser snapshot -i
agent-browser fill @e3 "password"
agent-browser click @e4 # Sign in
chrome-use fill @e1 "user@gmail.com"
chrome-use click @e2 # Next button
chrome-use wait 2000
chrome-use snapshot -i
chrome-use fill @e3 "password"
chrome-use click @e4 # Sign in
# Wait for redirect back
agent-browser wait --url "**/app.example.com**"
agent-browser state save ./oauth-state.json
chrome-use wait --url "**/app.example.com**"
chrome-use state save ./oauth-state.json
```
## Two-Factor Authentication
@@ -203,18 +203,18 @@ Handle 2FA with manual intervention:
```bash
# Login with credentials
agent-browser open https://app.example.com/login --headed # Show browser
agent-browser snapshot -i
agent-browser fill @e1 "user@example.com"
agent-browser fill @e2 "password123"
agent-browser click @e3
chrome-use open https://app.example.com/login --headed # Show browser
chrome-use snapshot -i
chrome-use fill @e1 "user@example.com"
chrome-use fill @e2 "password123"
chrome-use click @e3
# Wait for user to complete 2FA manually
echo "Complete 2FA in the browser window..."
agent-browser wait --url "**/dashboard" --timeout 120000
chrome-use wait --url "**/dashboard" --timeout 120000
# Save state after 2FA
agent-browser state save ./2fa-state.json
chrome-use state save ./2fa-state.json
```
## HTTP Basic Auth
@@ -223,10 +223,10 @@ For sites using HTTP Basic Authentication:
```bash
# Set credentials before navigation
agent-browser set credentials username password
chrome-use set credentials username password
# Navigate to protected resource
agent-browser open https://protected.example.com/api
chrome-use open https://protected.example.com/api
```
## Cookie-Based Auth
@@ -235,10 +235,10 @@ Manually set authentication cookies:
```bash
# Set auth cookie
agent-browser cookies set session_token "abc123xyz"
chrome-use cookies set session_token "abc123xyz"
# Navigate to protected page
agent-browser open https://app.example.com/dashboard
chrome-use open https://app.example.com/dashboard
```
## Token Refresh Handling
@@ -253,24 +253,24 @@ STATE_FILE="./auth-state.json"
# Try loading existing state
if [[ -f "$STATE_FILE" ]]; then
agent-browser state load "$STATE_FILE"
agent-browser open https://app.example.com/dashboard
chrome-use state load "$STATE_FILE"
chrome-use open https://app.example.com/dashboard
# Check if session is still valid
URL=$(agent-browser get url)
URL=$(chrome-use get url)
if [[ "$URL" == *"/login"* ]]; then
echo "Session expired, re-authenticating..."
# Perform fresh login
agent-browser snapshot -i
agent-browser fill @e1 "$USERNAME"
agent-browser fill @e2 "$PASSWORD"
agent-browser click @e3
agent-browser wait --url "**/dashboard"
agent-browser state save "$STATE_FILE"
chrome-use snapshot -i
chrome-use fill @e1 "$USERNAME"
chrome-use fill @e2 "$PASSWORD"
chrome-use click @e3
chrome-use wait --url "**/dashboard"
chrome-use state save "$STATE_FILE"
fi
else
# First-time login
agent-browser open https://app.example.com/login
chrome-use open https://app.example.com/login
# ... login flow ...
fi
```
@@ -284,20 +284,20 @@ fi
2. **Use environment variables for credentials**
```bash
agent-browser fill @e1 "$APP_USERNAME"
agent-browser fill @e2 "$APP_PASSWORD"
chrome-use fill @e1 "$APP_USERNAME"
chrome-use fill @e2 "$APP_PASSWORD"
```
3. **Clean up after automation**
```bash
agent-browser cookies clear
chrome-use cookies clear
rm -f ./auth-state.json
```
4. **Use short-lived sessions for CI/CD**
```bash
# Don't persist state in CI
agent-browser open https://app.example.com/login
chrome-use open https://app.example.com/login
# ... login and perform actions ...
agent-browser close # Session ends, nothing persisted
chrome-use close # Session ends, nothing persisted
```
+198 -198
View File
@@ -1,30 +1,30 @@
# Command Reference
Complete reference for all agent-browser commands. For quick start and common patterns, see SKILL.md.
Complete reference for all chrome-use commands. For quick start and common patterns, see SKILL.md.
## Navigation
```bash
agent-browser open # Launch browser (no navigation); stays on about:blank.
chrome-use open # Launch browser (no navigation); stays on about:blank.
# Pair with `network route`, `cookies set --curl`, or
# `addinitscript` to stage state before the first navigation.
agent-browser open <url> # Launch + navigate (aliases: goto, navigate)
chrome-use open <url> # Launch + navigate (aliases: goto, navigate)
# Supports: https://, http://, file://, about:, data://
# Auto-prepends https:// if no protocol given
agent-browser back # Go back
agent-browser forward # Go forward
agent-browser reload # Reload page
agent-browser pushstate <url> # SPA client-side navigation. Auto-detects
chrome-use back # Go back
chrome-use forward # Go forward
chrome-use reload # Reload page
chrome-use pushstate <url> # SPA client-side navigation. Auto-detects
# window.next.router.push (triggers RSC fetch on Next.js);
# falls back to history.pushState + popstate/navigate events.
agent-browser close # Close browser (aliases: quit, exit)
agent-browser connect 9222 # Connect to browser via CDP port
chrome-use close # Close browser (aliases: quit, exit)
chrome-use connect 9222 # Connect to browser via CDP port
```
### Pre-navigation setup (one-turn batch)
```bash
agent-browser batch \
chrome-use batch \
'["open"]' \
'["network","route","*","--abort","--resource-type","script"]' \
'["cookies","set","--curl","cookies.curl","--domain","localhost"]' \
@@ -40,67 +40,67 @@ prior page.
## Snapshot (page analysis)
```bash
agent-browser snapshot # Full accessibility tree
agent-browser snapshot -i # Interactive elements only (recommended)
agent-browser snapshot -c # Compact output
agent-browser snapshot -d 3 # Limit depth to 3
agent-browser snapshot -s "#main" # Scope to CSS selector
chrome-use snapshot # Full accessibility tree
chrome-use snapshot -i # Interactive elements only (recommended)
chrome-use snapshot -c # Compact output
chrome-use snapshot -d 3 # Limit depth to 3
chrome-use snapshot -s "#main" # Scope to CSS selector
```
## Interactions (use @refs from snapshot)
```bash
agent-browser click @e1 # Click
agent-browser click @e1 --new-tab # Click and open in new tab
agent-browser dblclick @e1 # Double-click
agent-browser focus @e1 # Focus element
agent-browser fill @e2 "text" # Clear and type
agent-browser type @e2 "text" # Type without clearing
agent-browser press Enter # Press key (alias: key)
agent-browser press Control+a # Key combination
agent-browser keydown Shift # Hold key down
agent-browser keyup Shift # Release key
agent-browser hover @e1 # Hover
agent-browser check @e1 # Check checkbox
agent-browser uncheck @e1 # Uncheck checkbox
agent-browser select @e1 "value" # Select dropdown option
agent-browser select @e1 "a" "b" # Select multiple options
agent-browser scroll down 500 # Scroll page (default: down 300px)
agent-browser scrollintoview @e1 # Scroll element into view (alias: scrollinto)
agent-browser drag @e1 @e2 # Drag and drop
agent-browser upload @e1 file.pdf # Upload files
chrome-use click @e1 # Click
chrome-use click @e1 --new-tab # Click and open in new tab
chrome-use dblclick @e1 # Double-click
chrome-use focus @e1 # Focus element
chrome-use fill @e2 "text" # Clear and type
chrome-use type @e2 "text" # Type without clearing
chrome-use press Enter # Press key (alias: key)
chrome-use press Control+a # Key combination
chrome-use keydown Shift # Hold key down
chrome-use keyup Shift # Release key
chrome-use hover @e1 # Hover
chrome-use check @e1 # Check checkbox
chrome-use uncheck @e1 # Uncheck checkbox
chrome-use select @e1 "value" # Select dropdown option
chrome-use select @e1 "a" "b" # Select multiple options
chrome-use scroll down 500 # Scroll page (default: down 300px)
chrome-use scrollintoview @e1 # Scroll element into view (alias: scrollinto)
chrome-use drag @e1 @e2 # Drag and drop
chrome-use upload @e1 file.pdf # Upload files
```
## Get Information
```bash
agent-browser get text @e1 # Get element text
agent-browser get html @e1 # Get innerHTML
agent-browser get value @e1 # Get input value
agent-browser get attr @e1 href # Get attribute
agent-browser get title # Get page title
agent-browser get url # Get current URL
agent-browser get cdp-url # Get CDP WebSocket URL
agent-browser get count ".item" # Count matching elements
agent-browser get box @e1 # Get bounding box
agent-browser get styles @e1 # Get computed styles (font, color, bg, etc.)
chrome-use get text @e1 # Get element text
chrome-use get html @e1 # Get innerHTML
chrome-use get value @e1 # Get input value
chrome-use get attr @e1 href # Get attribute
chrome-use get title # Get page title
chrome-use get url # Get current URL
chrome-use get cdp-url # Get CDP WebSocket URL
chrome-use get count ".item" # Count matching elements
chrome-use get box @e1 # Get bounding box
chrome-use get styles @e1 # Get computed styles (font, color, bg, etc.)
```
## Check State
```bash
agent-browser is visible @e1 # Check if visible
agent-browser is enabled @e1 # Check if enabled
agent-browser is checked @e1 # Check if checked
chrome-use is visible @e1 # Check if visible
chrome-use is enabled @e1 # Check if enabled
chrome-use is checked @e1 # Check if checked
```
## Screenshots and PDF
```bash
agent-browser screenshot # Save to temporary directory
agent-browser screenshot path.png # Save to specific path
agent-browser screenshot --full # Full page
agent-browser pdf output.pdf # Save as PDF
chrome-use screenshot # Save to temporary directory
chrome-use screenshot path.png # Save to specific path
chrome-use screenshot --full # Full page
chrome-use pdf output.pdf # Save as PDF
```
Headless Chromium screenshots hide native scrollbars for consistent image output.
@@ -109,97 +109,97 @@ Pass `--hide-scrollbars false` when launching to keep native scrollbars visible.
## Video Recording
```bash
agent-browser record start ./demo.webm # Start recording
agent-browser click @e1 # Perform actions
agent-browser record stop # Stop and save video
agent-browser record restart ./take2.webm # Stop current + start new
chrome-use record start ./demo.webm # Start recording
chrome-use click @e1 # Perform actions
chrome-use record stop # Stop and save video
chrome-use record restart ./take2.webm # Stop current + start new
```
## Wait
```bash
agent-browser wait @e1 # Wait for element
agent-browser wait 2000 # Wait milliseconds
agent-browser wait --text "Success" # Wait for text (or -t)
agent-browser wait --url "**/dashboard" # Wait for URL pattern (or -u)
agent-browser wait --load networkidle # Wait for network idle (or -l)
agent-browser wait --fn "window.ready" # Wait for JS condition (or -f)
chrome-use wait @e1 # Wait for element
chrome-use wait 2000 # Wait milliseconds
chrome-use wait --text "Success" # Wait for text (or -t)
chrome-use wait --url "**/dashboard" # Wait for URL pattern (or -u)
chrome-use wait --load networkidle # Wait for network idle (or -l)
chrome-use wait --fn "window.ready" # Wait for JS condition (or -f)
```
## Mouse Control
```bash
agent-browser mouse move 100 200 # Move mouse
agent-browser mouse down left # Press button
agent-browser mouse up left # Release button
agent-browser mouse wheel 100 # Scroll wheel
chrome-use mouse move 100 200 # Move mouse
chrome-use mouse down left # Press button
chrome-use mouse up left # Release button
chrome-use mouse wheel 100 # Scroll wheel
```
## Semantic Locators (alternative to refs)
```bash
agent-browser find role button click --name "Submit"
agent-browser find text "Sign In" click
agent-browser find text "Sign In" click --exact # Exact match only
agent-browser find label "Email" fill "user@test.com"
agent-browser find placeholder "Search" type "query"
agent-browser find alt "Logo" click
agent-browser find title "Close" click
agent-browser find testid "submit-btn" click
agent-browser find first ".item" click
agent-browser find last ".item" click
agent-browser find nth 2 "a" hover
chrome-use find role button click --name "Submit"
chrome-use find text "Sign In" click
chrome-use find text "Sign In" click --exact # Exact match only
chrome-use find label "Email" fill "user@test.com"
chrome-use find placeholder "Search" type "query"
chrome-use find alt "Logo" click
chrome-use find title "Close" click
chrome-use find testid "submit-btn" click
chrome-use find first ".item" click
chrome-use find last ".item" click
chrome-use find nth 2 "a" hover
```
## Browser Settings
```bash
agent-browser set viewport 1920 1080 # Set viewport size
agent-browser set viewport 1920 1080 2 # 2x retina (same CSS size, higher res screenshots)
agent-browser set device "iPhone 14" # Emulate device
agent-browser set geo 37.7749 -122.4194 # Set geolocation (alias: geolocation)
agent-browser set offline on # Toggle offline mode
agent-browser set headers '{"X-Key":"v"}' # Extra HTTP headers
agent-browser set credentials user pass # HTTP basic auth (alias: auth)
agent-browser set media dark # Emulate color scheme
agent-browser set media light reduced-motion # Light mode + reduced motion
chrome-use set viewport 1920 1080 # Set viewport size
chrome-use set viewport 1920 1080 2 # 2x retina (same CSS size, higher res screenshots)
chrome-use set device "iPhone 14" # Emulate device
chrome-use set geo 37.7749 -122.4194 # Set geolocation (alias: geolocation)
chrome-use set offline on # Toggle offline mode
chrome-use set headers '{"X-Key":"v"}' # Extra HTTP headers
chrome-use set credentials user pass # HTTP basic auth (alias: auth)
chrome-use set media dark # Emulate color scheme
chrome-use set media light reduced-motion # Light mode + reduced motion
```
## Cookies and Storage
```bash
agent-browser cookies # Get all cookies
agent-browser cookies set name value # Set cookie
agent-browser cookies clear # Clear cookies
agent-browser storage local # Get all localStorage
agent-browser storage local key # Get specific key
agent-browser storage local set k v # Set value
agent-browser storage local clear # Clear all
chrome-use cookies # Get all cookies
chrome-use cookies set name value # Set cookie
chrome-use cookies clear # Clear cookies
chrome-use storage local # Get all localStorage
chrome-use storage local key # Get specific key
chrome-use storage local set k v # Set value
chrome-use storage local clear # Clear all
```
## Network
```bash
agent-browser network route <url> # Intercept requests
agent-browser network route <url> --abort # Block requests
agent-browser network route <url> --body '{}' # Mock response
agent-browser network unroute [url] # Remove routes
agent-browser network requests # View tracked requests
agent-browser network requests --filter api # Filter requests
chrome-use network route <url> # Intercept requests
chrome-use network route <url> --abort # Block requests
chrome-use network route <url> --body '{}' # Mock response
chrome-use network unroute [url] # Remove routes
chrome-use network requests # View tracked requests
chrome-use network requests --filter api # Filter requests
```
## Tabs and Windows
```bash
agent-browser tab # List tabs with tabId and label
agent-browser tab new [url] # New tab
agent-browser tab new --label docs [url] # New tab with a memorable label
agent-browser tab t2 # Switch to tab by id
agent-browser tab docs # Switch to tab by label
agent-browser tab close # Close current tab
agent-browser tab close t2 # Close tab by id
agent-browser tab close docs # Close tab by label
agent-browser window new # New window
chrome-use tab # List tabs with tabId and label
chrome-use tab new [url] # New tab
chrome-use tab new --label docs [url] # New tab with a memorable label
chrome-use tab t2 # Switch to tab by id
chrome-use tab docs # Switch to tab by label
chrome-use tab close # Close current tab
chrome-use tab close t2 # Close tab by id
chrome-use tab close docs # Close tab by label
chrome-use window new # New window
```
Tab ids are stable strings of the form `t1`, `t2`, `t3`. They're never reused
@@ -212,13 +212,13 @@ everywhere a tab ref is accepted. Labels are the agent-friendly way to write
multi-tab workflows:
```bash
agent-browser tab new --label docs https://docs.example.com
agent-browser tab new --label app https://app.example.com
agent-browser tab docs # switch to docs
agent-browser snapshot # populate refs for docs
agent-browser click @e1 # ref click on docs
agent-browser tab app # switch to app
agent-browser tab close docs # close by label
chrome-use tab new --label docs https://docs.example.com
chrome-use tab new --label app https://app.example.com
chrome-use tab docs # switch to docs
chrome-use snapshot # populate refs for docs
chrome-use click @e1 # ref click on docs
chrome-use tab app # switch to app
chrome-use tab close docs # close by label
```
Labels are never auto-generated, never rewritten on navigation, and must be
@@ -229,9 +229,9 @@ that was active when the snapshot ran.
## Frames
```bash
agent-browser frame "#iframe" # Switch to iframe by CSS selector
agent-browser frame @e3 # Switch to iframe by element ref
agent-browser frame main # Back to main frame
chrome-use frame "#iframe" # Switch to iframe by CSS selector
chrome-use frame @e3 # Switch to iframe by element ref
chrome-use frame main # Back to main frame
```
### Iframe support
@@ -239,19 +239,19 @@ agent-browser frame main # Back to main frame
Iframes are detected automatically during snapshots. When the main-frame snapshot runs, `Iframe` nodes are resolved and their content is inlined beneath the iframe element in the output (one level of nesting; iframes within iframes are not expanded).
```bash
agent-browser snapshot -i
chrome-use snapshot -i
# @e3 [Iframe] "payment-frame"
# @e4 [input] "Card number"
# @e5 [button] "Pay"
# Interact directly — refs inside iframes already work
agent-browser fill @e4 "4111111111111111"
agent-browser click @e5
chrome-use fill @e4 "4111111111111111"
chrome-use click @e5
# Or switch frame context for scoped snapshots
agent-browser frame @e3 # Switch using element ref
agent-browser snapshot -i # Snapshot scoped to that iframe
agent-browser frame main # Return to main frame
chrome-use frame @e3 # Switch using element ref
chrome-use snapshot -i # Snapshot scoped to that iframe
chrome-use frame main # Return to main frame
```
The `frame` command accepts:
@@ -264,27 +264,27 @@ The `frame` command accepts:
By default, `alert` and `beforeunload` dialogs are automatically accepted so they never block the agent. `confirm` and `prompt` dialogs still require explicit handling. Use `--no-auto-dialog` to disable this behavior.
```bash
agent-browser dialog accept [text] # Accept dialog
agent-browser dialog dismiss # Dismiss dialog
agent-browser dialog status # Check if a dialog is currently open
chrome-use dialog accept [text] # Accept dialog
chrome-use dialog dismiss # Dismiss dialog
chrome-use dialog status # Check if a dialog is currently open
```
## JavaScript
```bash
agent-browser eval "document.title" # Simple expressions only
agent-browser eval -b "<base64>" # Any JavaScript (base64 encoded)
agent-browser eval --stdin # Read script from stdin
chrome-use eval "document.title" # Simple expressions only
chrome-use eval -b "<base64>" # Any JavaScript (base64 encoded)
chrome-use eval --stdin # Read script from stdin
```
Use `-b`/`--base64` or `--stdin` for reliable execution. Shell escaping with nested quotes and special characters is error-prone.
```bash
# Base64 encode your script, then:
agent-browser eval -b "ZG9jdW1lbnQucXVlcnlTZWxlY3RvcignW3NyYyo9Il9uZXh0Il0nKQ=="
chrome-use eval -b "ZG9jdW1lbnQucXVlcnlTZWxlY3RvcignW3NyYyo9Il9uZXh0Il0nKQ=="
# Or use stdin with heredoc for multiline scripts:
cat <<'EOF' | agent-browser eval --stdin
cat <<'EOF' | chrome-use eval --stdin
const links = document.querySelectorAll('a');
Array.from(links).map(a => a.href);
EOF
@@ -293,49 +293,49 @@ EOF
## State Management
```bash
agent-browser state save auth.json # Save cookies, storage, auth state
agent-browser state load auth.json # Restore saved state
chrome-use state save auth.json # Save cookies, storage, auth state
chrome-use state load auth.json # Restore saved state
```
## Global Options
```bash
agent-browser --session <name> ... # Isolated browser session
agent-browser --json ... # JSON output for parsing
agent-browser --headed ... # Default & always-on (stealth). Headless is FORBIDDEN
chrome-use --session <name> ... # Isolated browser session
chrome-use --json ... # JSON output for parsing
chrome-use --headed ... # Default & always-on (stealth). Headless is FORBIDDEN
# (bot tell); display-less servers: AGENT_BROWSER_ALLOW_HEADLESS=1
agent-browser --full ... # Full page screenshot (-f)
agent-browser --cdp <port> ... # Connect via Chrome DevTools Protocol
agent-browser -p <provider> ... # Cloud browser provider (--provider)
agent-browser --proxy <url> ... # Use proxy server
agent-browser --proxy-bypass <hosts> # Hosts to bypass proxy
agent-browser --headers <json> ... # HTTP headers scoped to URL's origin
agent-browser --executable-path <p> # Custom browser executable
agent-browser --extension <path> ... # Load browser extension (repeatable)
agent-browser --ignore-https-errors # Ignore SSL certificate errors
agent-browser --hide-scrollbars false # Keep native scrollbars visible in headless Chromium screenshots
agent-browser --help # Show help (-h)
agent-browser --version # Show version (-V)
agent-browser <command> --help # Show detailed help for a command
chrome-use --full ... # Full page screenshot (-f)
chrome-use --cdp <port> ... # Connect via Chrome DevTools Protocol
chrome-use -p <provider> ... # Cloud browser provider (--provider)
chrome-use --proxy <url> ... # Use proxy server
chrome-use --proxy-bypass <hosts> # Hosts to bypass proxy
chrome-use --headers <json> ... # HTTP headers scoped to URL's origin
chrome-use --executable-path <p> # Custom browser executable
chrome-use --extension <path> ... # Load browser extension (repeatable)
chrome-use --ignore-https-errors # Ignore SSL certificate errors
chrome-use --hide-scrollbars false # Keep native scrollbars visible in headless Chromium screenshots
chrome-use --help # Show help (-h)
chrome-use --version # Show version (-V)
chrome-use <command> --help # Show detailed help for a command
```
## Drive your real, logged-in Chrome (extension — zero confirmation)
Chrome 136 blocked `--remote-debugging-port` on the default profile, so to drive
the user's *existing* logged-in window, agent-browser uses a Chrome **extension**
the user's *existing* logged-in window, chrome-use uses a Chrome **extension**
over native messaging — no port, no token, no per-use confirmation (the
codex/claude approach).
One-time setup:
```bash
agent-browser extension install # writes the native-messaging host manifest
chrome-use extension install # writes the native-messaging host manifest
```
The native-messaging host accepts **both** extension origins, so either install
works — but prefer the Store build:
1. **Chrome Web Store (recommended)** — one-click *Add to Chrome*:
<https://chromewebstore.google.com/detail/agent-browser-stealth/knfcmbamhjmaonkfnjhldjedeobeafmk>
<https://chromewebstore.google.com/detail/chrome-use/knfcmbamhjmaonkfnjhldjedeobeafmk>
Restart-stable and auto-updating (store id `knfcmbamhjmaonkfnjhldjedeobeafmk`).
2. **Load unpacked (dev)** — load `<repo>/extensions/ab-connect` from source;
its pinned `key` gives the stable id `ciiljdlhd…`. NOTE: Load-unpacked
@@ -347,12 +347,12 @@ CLI can't load an unpacked extension):
> chrome://extensions → enable **Developer mode** (top-right) → **Load unpacked** →
> select `<repo>/extensions/ab-connect` (it appears in the list as
> **agent-browser-stealth**)
> **chrome-use**)
Once loaded, the relay goes live and plain `agent-browser open <url>` connects
Once loaded, the relay goes live and plain `chrome-use open <url>` connects
through it automatically — `auto_connect_cdp` prefers the live extension relay
over a raw `--remote-debugging-port`, so Chrome 136+'s "Allow remote debugging?"
consent popup never appears. `agent-browser extension connect` is the explicit
consent popup never appears. `chrome-use extension connect` is the explicit
form of the same path.
**You can do this load step yourself with a computer-use / GUI-automation tool**
@@ -368,35 +368,35 @@ the folder (one click). After it loads, Chrome assigns the extension a fixed id
Then, any time (pure CLI, zero confirmation):
```bash
agent-browser extension connect # auto-attaches to the live, logged-in tabs
agent-browser tab # list the real tabs it now controls
agent-browser tab t3 # switch the session to one of them
agent-browser snapshot -i / eval / click ... # drive it like any session
agent-browser extension status # is the host installed?
agent-browser extension uninstall # remove the host manifest
chrome-use extension connect # auto-attaches to the live, logged-in tabs
chrome-use tab # list the real tabs it now controls
chrome-use tab t3 # switch the session to one of them
chrome-use snapshot -i / eval / click ... # drive it like any session
chrome-use extension status # is the host installed?
chrome-use extension uninstall # remove the host manifest
```
Security: the extension↔host link is authenticated by Chrome (extension id); the
host↔agent-browser CDP link uses an unguessable URL in a 0600 file. Use this when
host↔chrome-use CDP link uses an unguessable URL in a 0600 file. Use this when
you need the user's real cookies/login on their actual machine. (`--extension
<path>` is unrelated — that loads an extension into a *launched* browser.)
## Debugging
```bash
agent-browser --headed open example.com # Show browser window
agent-browser --cdp 9222 snapshot # Connect via CDP port
agent-browser connect 9222 # Alternative: connect command
agent-browser console # View console messages (needs AGENT_BROWSER_CAPTURE_CONSOLE=1)
agent-browser console --clear # Clear console
agent-browser errors # View page errors (needs AGENT_BROWSER_CAPTURE_CONSOLE=1)
agent-browser errors --clear # Clear errors
agent-browser highlight @e1 # Highlight element
agent-browser inspect # Open Chrome DevTools for this session
agent-browser trace start # Start recording trace
agent-browser trace stop trace.zip # Stop and save trace
agent-browser profiler start # Start Chrome DevTools profiling
agent-browser profiler stop trace.json # Stop and save profile
chrome-use --headed open example.com # Show browser window
chrome-use --cdp 9222 snapshot # Connect via CDP port
chrome-use connect 9222 # Alternative: connect command
chrome-use console # View console messages (needs AGENT_BROWSER_CAPTURE_CONSOLE=1)
chrome-use console --clear # Clear console
chrome-use errors # View page errors (needs AGENT_BROWSER_CAPTURE_CONSOLE=1)
chrome-use errors --clear # Clear errors
chrome-use highlight @e1 # Highlight element
chrome-use inspect # Open Chrome DevTools for this session
chrome-use trace start # Start recording trace
chrome-use trace stop trace.zip # Stop and save trace
chrome-use profiler start # Start Chrome DevTools profiling
chrome-use profiler stop trace.json # Stop and save profile
```
### Finding a page the user saved (`find-url`)
@@ -406,10 +406,10 @@ systems or previously-saved pages that public search can't reach. Local read, no
browser/daemon needed.
```bash
agent-browser find-url jira board # all keywords must match (name or url)
agent-browser find-url --limit 10 invoices
agent-browser find-url --browser edge --profile "Profile 1" wiki
agent-browser find-url grafana --json # {results:[{name,url,folder}], count}
chrome-use find-url jira board # all keywords must match (name or url)
chrome-use find-url --limit 10 invoices
chrome-use find-url --browser edge --profile "Profile 1" wiki
chrome-use find-url grafana --json # {results:[{name,url,folder}], count}
```
Results are most-recently-added first. `javascript:`/`data:` bookmarklets are
@@ -425,13 +425,13 @@ problem (e.g. a hidden `point_choice=none` that the visible UI never exposes):
```bash
# Dump every field's name → value, including hidden inputs and unchecked radios
agent-browser eval "JSON.stringify([...document.forms[0].elements].map(e=>({name:e.name,type:e.type,value:e.value,checked:e.checked})).filter(e=>e.name))"
chrome-use eval "JSON.stringify([...document.forms[0].elements].map(e=>({name:e.name,type:e.type,value:e.value,checked:e.checked})).filter(e=>e.name))"
# Inspect one hidden field directly
agent-browser eval "document.querySelector('[name=point_choice]')?.value"
chrome-use eval "document.querySelector('[name=point_choice]')?.value"
# Why won't it submit? Ask the browser's own validity API
agent-browser eval "[...document.forms[0].elements].filter(e=>!e.validity?.valid).map(e=>e.name+': '+e.validationMessage)"
chrome-use eval "[...document.forms[0].elements].filter(e=>!e.validity?.valid).map(e=>e.name+': '+e.validationMessage)"
```
## React / Web Vitals
@@ -440,30 +440,30 @@ Requires `--enable react-devtools` at launch for the `react ...` commands.
`vitals` and `pushstate` are framework-agnostic.
```bash
agent-browser open --enable react-devtools <url> # Launch with React hook installed
agent-browser react tree # Full component tree
agent-browser react inspect <fiberId> # Props, hooks, state, source
agent-browser react renders start # Begin re-render recording
agent-browser react renders stop [--json] # Stop and print render profile
agent-browser react suspense [--only-dynamic] [--json] # Suspense boundaries + classifier
chrome-use open --enable react-devtools <url> # Launch with React hook installed
chrome-use react tree # Full component tree
chrome-use react inspect <fiberId> # Props, hooks, state, source
chrome-use react renders start # Begin re-render recording
chrome-use react renders stop [--json] # Stop and print render profile
chrome-use react suspense [--only-dynamic] [--json] # Suspense boundaries + classifier
# --only-dynamic hides the "static" list
agent-browser vitals [url] [--json] # LCP/CLS/TTFB/FCP/INP + hydration
agent-browser pushstate <url> # SPA client-side nav (auto-detects Next router)
chrome-use vitals [url] [--json] # LCP/CLS/TTFB/FCP/INP + hydration
chrome-use pushstate <url> # SPA client-side nav (auto-detects Next router)
```
## Init scripts
```bash
agent-browser open --init-script <path> # Register before first navigation (repeatable)
agent-browser addinitscript <js> # Register at runtime (returns identifier)
agent-browser removeinitscript <identifier> # Remove a previously registered init script
chrome-use open --init-script <path> # Register before first navigation (repeatable)
chrome-use addinitscript <js> # Register at runtime (returns identifier)
chrome-use removeinitscript <identifier> # Remove a previously registered init script
```
## cURL cookie import
```bash
agent-browser cookies set --curl <file> # Auto-detects JSON/cURL/Cookie-header
agent-browser cookies set --curl <file> --domain example.com # Scope to a domain
chrome-use cookies set --curl <file> # Auto-detects JSON/cURL/Cookie-header
chrome-use cookies set --curl <file> --domain example.com # Scope to a domain
```
Supported formats: JSON array of `{name, value}`, a cURL dump from
@@ -473,8 +473,8 @@ echo cookie values.
## Network route by resource type
```bash
agent-browser network route '*' --abort --resource-type script # Block scripts only (SSR-lock pattern)
agent-browser network route '*' --resource-type image,font --body '' # Stub images and fonts
chrome-use network route '*' --abort --resource-type script # Block scripts only (SSR-lock pattern)
chrome-use network route '*' --resource-type image,font --body '' # Stub images and fonts
```
## Environment Variables
@@ -488,7 +488,7 @@ AGENT_BROWSER_ENABLE="react-devtools" # Comma-separated built-in init scr
AGENT_BROWSER_HIDE_SCROLLBARS="false" # Keep native scrollbars visible in headless Chromium screenshots
AGENT_BROWSER_PROVIDER="browserbase" # Cloud browser provider
AGENT_BROWSER_STREAM_PORT="9223" # Override WebSocket streaming port (default: OS-assigned)
AGENT_BROWSER_HOME="/path/to/agent-browser" # Custom install location
AGENT_BROWSER_HOME="/path/to/chrome-use" # Custom install location
AGENT_BROWSER_CLICK_MODE="dom" # Click strategy: "" (default: scroll-in + coordinate
# click, DOM-dispatch fallback), "coord" (strict
# coordinate only), "dom" (always element.click())
+21 -21
View File
@@ -18,28 +18,28 @@ Capture Chrome DevTools performance profiles during browser automation for perfo
```bash
# Start profiling
agent-browser profiler start
chrome-use profiler start
# Perform actions
agent-browser navigate https://example.com
agent-browser click "#button"
agent-browser wait 1000
chrome-use navigate https://example.com
chrome-use click "#button"
chrome-use wait 1000
# Stop and save
agent-browser profiler stop ./trace.json
chrome-use profiler stop ./trace.json
```
## Profiler Commands
```bash
# Start profiling with default categories
agent-browser profiler start
chrome-use profiler start
# Start with custom trace categories
agent-browser profiler start --categories "devtools.timeline,v8.execute,blink.user_timing"
chrome-use profiler start --categories "devtools.timeline,v8.execute,blink.user_timing"
# Stop profiling and save to file
agent-browser profiler stop ./trace.json
chrome-use profiler stop ./trace.json
```
## Categories
@@ -61,30 +61,30 @@ Several `disabled-by-default-*` categories are also included for detailed timeli
### Diagnosing Slow Page Loads
```bash
agent-browser profiler start
agent-browser navigate https://app.example.com
agent-browser wait --load networkidle
agent-browser profiler stop ./page-load-profile.json
chrome-use profiler start
chrome-use navigate https://app.example.com
chrome-use wait --load networkidle
chrome-use profiler stop ./page-load-profile.json
```
### Profiling User Interactions
```bash
agent-browser navigate https://app.example.com
agent-browser profiler start
agent-browser click "#submit"
agent-browser wait 2000
agent-browser profiler stop ./interaction-profile.json
chrome-use navigate https://app.example.com
chrome-use profiler start
chrome-use click "#submit"
chrome-use wait 2000
chrome-use profiler stop ./interaction-profile.json
```
### CI Performance Regression Checks
```bash
#!/bin/bash
agent-browser profiler start
agent-browser navigate https://app.example.com
agent-browser wait --load networkidle
agent-browser profiler stop "./profiles/build-${BUILD_ID}.json"
chrome-use profiler start
chrome-use navigate https://app.example.com
chrome-use wait --load networkidle
chrome-use profiler stop "./profiles/build-${BUILD_ID}.json"
```
## Output Format
+21 -21
View File
@@ -21,20 +21,20 @@ Use the `--proxy` flag or set proxy via environment variable:
```bash
# Via CLI flag
agent-browser --proxy "http://proxy.example.com:8080" open https://example.com
chrome-use --proxy "http://proxy.example.com:8080" open https://example.com
# Via environment variable
export HTTP_PROXY="http://proxy.example.com:8080"
agent-browser open https://example.com
chrome-use open https://example.com
# HTTPS proxy
export HTTPS_PROXY="https://proxy.example.com:8080"
agent-browser open https://example.com
chrome-use open https://example.com
# Both
export HTTP_PROXY="http://proxy.example.com:8080"
export HTTPS_PROXY="http://proxy.example.com:8080"
agent-browser open https://example.com
chrome-use open https://example.com
```
## Authenticated Proxy
@@ -44,7 +44,7 @@ For proxies requiring authentication:
```bash
# Include credentials in URL
export HTTP_PROXY="http://username:password@proxy.example.com:8080"
agent-browser open https://example.com
chrome-use open https://example.com
```
## SOCKS Proxy
@@ -52,11 +52,11 @@ agent-browser open https://example.com
```bash
# SOCKS5 proxy
export ALL_PROXY="socks5://proxy.example.com:1080"
agent-browser open https://example.com
chrome-use open https://example.com
# SOCKS5 with auth
export ALL_PROXY="socks5://user:pass@proxy.example.com:1080"
agent-browser open https://example.com
chrome-use open https://example.com
```
## Proxy Bypass
@@ -65,12 +65,12 @@ Skip proxy for specific domains using `--proxy-bypass` or `NO_PROXY`:
```bash
# Via CLI flag
agent-browser --proxy "http://proxy.example.com:8080" --proxy-bypass "localhost,*.internal.com" open https://example.com
chrome-use --proxy "http://proxy.example.com:8080" --proxy-bypass "localhost,*.internal.com" open https://example.com
# Via environment variable
export NO_PROXY="localhost,127.0.0.1,.internal.company.com"
agent-browser open https://internal.company.com # Direct connection
agent-browser open https://external.com # Via proxy
chrome-use open https://internal.company.com # Direct connection
chrome-use open https://external.com # Via proxy
```
## Common Use Cases
@@ -94,9 +94,9 @@ for proxy in "${PROXIES[@]}"; do
region=$(echo "$proxy" | grep -oP '^\w+-\w+')
echo "Testing from: $region"
agent-browser --session "$region" open https://example.com
agent-browser --session "$region" screenshot "./screenshots/$region.png"
agent-browser --session "$region" close
chrome-use --session "$region" open https://example.com
chrome-use --session "$region" screenshot "./screenshots/$region.png"
chrome-use --session "$region" close
done
```
@@ -123,9 +123,9 @@ for i in "${!URLS[@]}"; do
export HTTP_PROXY="${PROXY_LIST[$proxy_index]}"
export HTTPS_PROXY="${PROXY_LIST[$proxy_index]}"
agent-browser open "${URLS[$i]}"
agent-browser get text body > "output-$i.txt"
agent-browser close
chrome-use open "${URLS[$i]}"
chrome-use get text body > "output-$i.txt"
chrome-use close
sleep 1 # Polite delay
done
@@ -142,18 +142,18 @@ export HTTPS_PROXY="http://corpproxy.company.com:8080"
export NO_PROXY="localhost,127.0.0.1,.company.com"
# External sites go through proxy
agent-browser open https://external-vendor.com
chrome-use open https://external-vendor.com
# Internal sites bypass proxy
agent-browser open https://intranet.company.com
chrome-use open https://intranet.company.com
```
## Verifying Proxy Connection
```bash
# Check your apparent IP
agent-browser open https://httpbin.org/ip
agent-browser get text body
chrome-use open https://httpbin.org/ip
chrome-use get text body
# Should show proxy's IP, not your real IP
```
@@ -175,7 +175,7 @@ Some proxies perform SSL inspection. If you encounter certificate errors:
```bash
# For testing only - not recommended for production
agent-browser open https://example.com --ignore-https-errors
chrome-use open https://example.com --ignore-https-errors
```
### Slow Performance
@@ -20,14 +20,14 @@ Use `--session` flag to isolate browser contexts:
```bash
# Session 1: Authentication flow
agent-browser --session auth open https://app.example.com/login
chrome-use --session auth open https://app.example.com/login
# Session 2: Public browsing (separate cookies, storage)
agent-browser --session public open https://example.com
chrome-use --session public open https://example.com
# Commands are isolated by session
agent-browser --session auth fill @e1 "user@example.com"
agent-browser --session public get text body
chrome-use --session auth fill @e1 "user@example.com"
chrome-use --session public get text body
```
## Session Isolation Properties
@@ -46,17 +46,17 @@ Each session has independent:
```bash
# Save cookies, storage, and auth state
agent-browser state save /path/to/auth-state.json
chrome-use state save /path/to/auth-state.json
```
### Load Session State
```bash
# Restore saved state
agent-browser state load /path/to/auth-state.json
chrome-use state load /path/to/auth-state.json
# Continue with authenticated session
agent-browser open https://app.example.com/dashboard
chrome-use open https://app.example.com/dashboard
```
### State File Contents
@@ -82,19 +82,19 @@ STATE_FILE="/tmp/auth-state.json"
# Check if we have saved state
if [[ -f "$STATE_FILE" ]]; then
agent-browser state load "$STATE_FILE"
agent-browser open https://app.example.com/dashboard
chrome-use state load "$STATE_FILE"
chrome-use open https://app.example.com/dashboard
else
# Perform login
agent-browser open https://app.example.com/login
agent-browser snapshot -i
agent-browser fill @e1 "$USERNAME"
agent-browser fill @e2 "$PASSWORD"
agent-browser click @e3
agent-browser wait --load networkidle
chrome-use open https://app.example.com/login
chrome-use snapshot -i
chrome-use fill @e1 "$USERNAME"
chrome-use fill @e2 "$PASSWORD"
chrome-use click @e3
chrome-use wait --load networkidle
# Save for future use
agent-browser state save "$STATE_FILE"
chrome-use state save "$STATE_FILE"
fi
```
@@ -105,32 +105,32 @@ fi
# Scrape multiple sites concurrently
# Start all sessions
agent-browser --session site1 open https://site1.com &
agent-browser --session site2 open https://site2.com &
agent-browser --session site3 open https://site3.com &
chrome-use --session site1 open https://site1.com &
chrome-use --session site2 open https://site2.com &
chrome-use --session site3 open https://site3.com &
wait
# Extract from each
agent-browser --session site1 get text body > site1.txt
agent-browser --session site2 get text body > site2.txt
agent-browser --session site3 get text body > site3.txt
chrome-use --session site1 get text body > site1.txt
chrome-use --session site2 get text body > site2.txt
chrome-use --session site3 get text body > site3.txt
# Cleanup
agent-browser --session site1 close
agent-browser --session site2 close
agent-browser --session site3 close
chrome-use --session site1 close
chrome-use --session site2 close
chrome-use --session site3 close
```
### A/B Testing Sessions
```bash
# Test different user experiences
agent-browser --session variant-a open "https://app.com?variant=a"
agent-browser --session variant-b open "https://app.com?variant=b"
chrome-use --session variant-a open "https://app.com?variant=a"
chrome-use --session variant-b open "https://app.com?variant=b"
# Compare
agent-browser --session variant-a screenshot /tmp/variant-a.png
agent-browser --session variant-b screenshot /tmp/variant-b.png
chrome-use --session variant-a screenshot /tmp/variant-a.png
chrome-use --session variant-b screenshot /tmp/variant-b.png
```
## Default Session
@@ -139,19 +139,19 @@ When `--session` is omitted, commands use the default session:
```bash
# These use the same default session
agent-browser open https://example.com
agent-browser snapshot -i
agent-browser close # Closes default session
chrome-use open https://example.com
chrome-use snapshot -i
chrome-use close # Closes default session
```
## Session Cleanup
```bash
# Close specific session
agent-browser --session auth close
chrome-use --session auth close
# List active sessions
agent-browser session list
chrome-use session list
```
## Best Practices
@@ -160,19 +160,19 @@ agent-browser session list
```bash
# GOOD: Clear purpose
agent-browser --session github-auth open https://github.com
agent-browser --session docs-scrape open https://docs.example.com
chrome-use --session github-auth open https://github.com
chrome-use --session docs-scrape open https://docs.example.com
# AVOID: Generic names
agent-browser --session s1 open https://github.com
chrome-use --session s1 open https://github.com
```
### 2. Always Clean Up
```bash
# Close sessions when done
agent-browser --session auth close
agent-browser --session scrape close
chrome-use --session auth close
chrome-use --session scrape close
```
### 3. Handle State Files Securely
@@ -189,5 +189,5 @@ rm /tmp/auth-state.json
```bash
# Set timeout for automated scripts
timeout 60 agent-browser --session long-task get text body
timeout 60 chrome-use --session long-task get text body
```
+33 -33
View File
@@ -21,7 +21,7 @@ Traditional approach:
Full DOM/HTML → AI parses → CSS selector → Action (~3000-5000 tokens)
```
agent-browser approach:
chrome-use approach:
```
Compact snapshot → @refs assigned → Direct interaction (~200-400 tokens)
```
@@ -30,10 +30,10 @@ Compact snapshot → @refs assigned → Direct interaction (~200-400 tokens)
```bash
# Basic snapshot (shows page structure)
agent-browser snapshot
chrome-use snapshot
# Interactive snapshot (-i flag) - RECOMMENDED
agent-browser snapshot -i
chrome-use snapshot -i
```
### Snapshot Output Format
@@ -66,16 +66,16 @@ Once you have refs, interact directly:
```bash
# Click the "Sign In" button
agent-browser click @e6
chrome-use click @e6
# Fill email input
agent-browser fill @e10 "user@example.com"
chrome-use fill @e10 "user@example.com"
# Fill password
agent-browser fill @e11 "password123"
chrome-use fill @e11 "password123"
# Submit the form
agent-browser click @e12
chrome-use click @e12
```
## Ref Lifecycle
@@ -84,14 +84,14 @@ agent-browser click @e12
```bash
# Get initial snapshot
agent-browser snapshot -i
chrome-use snapshot -i
# @e1 [button] "Next"
# Click triggers page change
agent-browser click @e1
chrome-use click @e1
# MUST re-snapshot to get new refs!
agent-browser snapshot -i
chrome-use snapshot -i
# @e1 [h1] "Page 2" ← Different element now!
```
@@ -101,29 +101,29 @@ agent-browser snapshot -i
```bash
# CORRECT
agent-browser open https://example.com
agent-browser snapshot -i # Get refs first
agent-browser click @e1 # Use ref
chrome-use open https://example.com
chrome-use snapshot -i # Get refs first
chrome-use click @e1 # Use ref
# WRONG
agent-browser open https://example.com
agent-browser click @e1 # Ref doesn't exist yet!
chrome-use open https://example.com
chrome-use click @e1 # Ref doesn't exist yet!
```
### 2. Re-Snapshot After Navigation
```bash
agent-browser click @e5 # Navigates to new page
agent-browser snapshot -i # Get new refs
agent-browser click @e1 # Use new refs
chrome-use click @e5 # Navigates to new page
chrome-use snapshot -i # Get new refs
chrome-use click @e1 # Use new refs
```
### 3. Re-Snapshot After Dynamic Changes
```bash
agent-browser click @e1 # Opens dropdown
agent-browser snapshot -i # See dropdown items
agent-browser click @e7 # Select item
chrome-use click @e1 # Opens dropdown
chrome-use snapshot -i # See dropdown items
chrome-use click @e7 # Select item
```
### 4. Snapshot Specific Regions
@@ -132,7 +132,7 @@ For complex pages, snapshot specific areas:
```bash
# Snapshot just the form
agent-browser snapshot @e9
chrome-use snapshot @e9
```
## Ref Notation Details
@@ -167,7 +167,7 @@ agent-browser snapshot @e9
Snapshots automatically detect and inline iframe content. When the main-frame snapshot runs, each `Iframe` node is resolved and its child accessibility tree is included directly beneath it in the output. Refs assigned to elements inside iframes carry frame context, so interactions like `click`, `fill`, and `type` work without manually switching frames.
```bash
agent-browser snapshot -i
chrome-use snapshot -i
# @e1 [heading] "Checkout"
# @e2 [Iframe] "payment-frame"
# @e3 [input] "Card number"
@@ -176,9 +176,9 @@ agent-browser snapshot -i
# @e6 [button] "Cancel"
# Interact with iframe elements directly using their refs
agent-browser fill @e3 "4111111111111111"
agent-browser fill @e4 "12/28"
agent-browser click @e5
chrome-use fill @e3 "4111111111111111"
chrome-use fill @e4 "12/28"
chrome-use click @e5
```
**Key details:**
@@ -193,27 +193,27 @@ agent-browser click @e5
```bash
# Ref may have changed - re-snapshot
agent-browser snapshot -i
chrome-use snapshot -i
```
### Element Not Visible in Snapshot
```bash
# Scroll down to reveal element
agent-browser scroll down 1000
agent-browser snapshot -i
chrome-use scroll down 1000
chrome-use snapshot -i
# Or wait for dynamic content
agent-browser wait 1000
agent-browser snapshot -i
chrome-use wait 1000
chrome-use snapshot -i
```
### Too Many Elements
```bash
# Snapshot specific container
agent-browser snapshot @e5
chrome-use snapshot @e5
# Or use get text for content-only extraction
agent-browser get text @e5
chrome-use get text @e5
```
@@ -1,6 +1,6 @@
# Trust boundaries
Safety rules that apply to every agent-browser task, across all sites and
Safety rules that apply to every chrome-use task, across all sites and
frameworks. Read before driving a real user's browser session.
**Related**: [SKILL.md](../SKILL.md), [authentication.md](authentication.md).
+42 -42
View File
@@ -17,29 +17,29 @@ Capture browser automation as video for debugging, documentation, or verificatio
```bash
# Start recording
agent-browser record start ./demo.webm
chrome-use record start ./demo.webm
# Perform actions
agent-browser open https://example.com
agent-browser snapshot -i
agent-browser click @e1
agent-browser fill @e2 "test input"
chrome-use open https://example.com
chrome-use snapshot -i
chrome-use click @e1
chrome-use fill @e2 "test input"
# Stop and save
agent-browser record stop
chrome-use record stop
```
## Recording Commands
```bash
# Start recording to file
agent-browser record start ./output.webm
chrome-use record start ./output.webm
# Stop current recording
agent-browser record stop
chrome-use record stop
# Restart with new file (stops current + starts new)
agent-browser record restart ./take2.webm
chrome-use record restart ./take2.webm
```
## Use Cases
@@ -50,18 +50,18 @@ agent-browser record restart ./take2.webm
#!/bin/bash
# Record automation for debugging
agent-browser record start ./debug-$(date +%Y%m%d-%H%M%S).webm
chrome-use record start ./debug-$(date +%Y%m%d-%H%M%S).webm
# Run your automation
agent-browser open https://app.example.com
agent-browser snapshot -i
agent-browser click @e1 || {
chrome-use open https://app.example.com
chrome-use snapshot -i
chrome-use click @e1 || {
echo "Click failed - check recording"
agent-browser record stop
chrome-use record stop
exit 1
}
agent-browser record stop
chrome-use record stop
```
### Documentation Generation
@@ -70,23 +70,23 @@ agent-browser record stop
#!/bin/bash
# Record workflow for documentation
agent-browser record start ./docs/how-to-login.webm
chrome-use record start ./docs/how-to-login.webm
agent-browser open https://app.example.com/login
agent-browser wait 1000 # Pause for visibility
chrome-use open https://app.example.com/login
chrome-use wait 1000 # Pause for visibility
agent-browser snapshot -i
agent-browser fill @e1 "demo@example.com"
agent-browser wait 500
chrome-use snapshot -i
chrome-use fill @e1 "demo@example.com"
chrome-use wait 500
agent-browser fill @e2 "password"
agent-browser wait 500
chrome-use fill @e2 "password"
chrome-use wait 500
agent-browser click @e3
agent-browser wait --load networkidle
agent-browser wait 1000 # Show result
chrome-use click @e3
chrome-use wait --load networkidle
chrome-use wait 1000 # Show result
agent-browser record stop
chrome-use record stop
```
### CI/CD Test Evidence
@@ -99,7 +99,7 @@ TEST_NAME="${1:-e2e-test}"
RECORDING_DIR="./test-recordings"
mkdir -p "$RECORDING_DIR"
agent-browser record start "$RECORDING_DIR/$TEST_NAME-$(date +%s).webm"
chrome-use record start "$RECORDING_DIR/$TEST_NAME-$(date +%s).webm"
# Run test
if run_e2e_test; then
@@ -108,7 +108,7 @@ else
echo "Test failed - recording saved"
fi
agent-browser record stop
chrome-use record stop
```
## Best Practices
@@ -117,16 +117,16 @@ agent-browser record stop
```bash
# Slow down for human viewing
agent-browser click @e1
agent-browser wait 500 # Let viewer see result
chrome-use click @e1
chrome-use wait 500 # Let viewer see result
```
### 2. Use Descriptive Filenames
```bash
# Include context in filename
agent-browser record start ./recordings/login-flow-2024-01-15.webm
agent-browser record start ./recordings/checkout-test-run-42.webm
chrome-use record start ./recordings/login-flow-2024-01-15.webm
chrome-use record start ./recordings/checkout-test-run-42.webm
```
### 3. Handle Recording in Error Cases
@@ -136,12 +136,12 @@ agent-browser record start ./recordings/checkout-test-run-42.webm
set -e
cleanup() {
agent-browser record stop 2>/dev/null || true
agent-browser close 2>/dev/null || true
chrome-use record stop 2>/dev/null || true
chrome-use close 2>/dev/null || true
}
trap cleanup EXIT
agent-browser record start ./automation.webm
chrome-use record start ./automation.webm
# ... automation steps ...
```
@@ -149,15 +149,15 @@ agent-browser record start ./automation.webm
```bash
# Record video AND capture key frames
agent-browser record start ./flow.webm
chrome-use record start ./flow.webm
agent-browser open https://example.com
agent-browser screenshot ./screenshots/step1-homepage.png
chrome-use open https://example.com
chrome-use screenshot ./screenshots/step1-homepage.png
agent-browser click @e1
agent-browser screenshot ./screenshots/step2-after-click.png
chrome-use click @e1
chrome-use screenshot ./screenshots/step2-after-click.png
agent-browser record stop
chrome-use record stop
```
## Output Format
@@ -4,8 +4,8 @@
# Usage: ./authenticated-session.sh <login-url> [state-file]
#
# RECOMMENDED: Use the auth vault instead of this template:
# echo "<pass>" | agent-browser auth save myapp --url <login-url> --username <user> --password-stdin
# agent-browser auth login myapp
# echo "<pass>" | chrome-use auth save myapp --url <login-url> --username <user> --password-stdin
# chrome-use auth login myapp
# The auth vault stores credentials securely and the LLM never sees passwords.
#
# Environment variables:
@@ -34,17 +34,17 @@ echo "Authentication workflow: $LOGIN_URL"
# ================================================================
if [[ -f "$STATE_FILE" ]]; then
echo "Loading saved state from $STATE_FILE..."
if agent-browser --state "$STATE_FILE" open "$LOGIN_URL" 2>/dev/null; then
agent-browser wait --load networkidle
if chrome-use --state "$STATE_FILE" open "$LOGIN_URL" 2>/dev/null; then
chrome-use wait --load networkidle
CURRENT_URL=$(agent-browser get url)
CURRENT_URL=$(chrome-use get url)
if [[ "$CURRENT_URL" != *"login"* ]] && [[ "$CURRENT_URL" != *"signin"* ]]; then
echo "Session restored successfully"
agent-browser snapshot -i
chrome-use snapshot -i
exit 0
fi
echo "Session expired, performing fresh login..."
agent-browser close 2>/dev/null || true
chrome-use close 2>/dev/null || true
else
echo "Failed to load state, re-authenticating..."
fi
@@ -55,13 +55,13 @@ fi
# DISCOVERY MODE: Shows form structure (delete after setup)
# ================================================================
echo "Opening login page..."
agent-browser open "$LOGIN_URL"
agent-browser wait --load networkidle
chrome-use open "$LOGIN_URL"
chrome-use wait --load networkidle
echo ""
echo "Login form structure:"
echo "---"
agent-browser snapshot -i
chrome-use snapshot -i
echo "---"
echo ""
echo "Next steps:"
@@ -70,7 +70,7 @@ echo " 2. Update the LOGIN FLOW section below with your refs"
echo " 3. Set: export APP_USERNAME='...' APP_PASSWORD='...'"
echo " 4. Delete this DISCOVERY MODE section"
echo ""
agent-browser close
chrome-use close
exit 0
# ================================================================
@@ -79,27 +79,27 @@ exit 0
# : "${APP_USERNAME:?Set APP_USERNAME environment variable}"
# : "${APP_PASSWORD:?Set APP_PASSWORD environment variable}"
#
# agent-browser open "$LOGIN_URL"
# agent-browser wait --load networkidle
# agent-browser snapshot -i
# chrome-use open "$LOGIN_URL"
# chrome-use wait --load networkidle
# chrome-use snapshot -i
#
# # Fill credentials (update refs to match your form)
# agent-browser fill @e1 "$APP_USERNAME"
# agent-browser fill @e2 "$APP_PASSWORD"
# agent-browser click @e3
# agent-browser wait --load networkidle
# chrome-use fill @e1 "$APP_USERNAME"
# chrome-use fill @e2 "$APP_PASSWORD"
# chrome-use click @e3
# chrome-use wait --load networkidle
#
# # Verify login succeeded
# FINAL_URL=$(agent-browser get url)
# FINAL_URL=$(chrome-use get url)
# if [[ "$FINAL_URL" == *"login"* ]] || [[ "$FINAL_URL" == *"signin"* ]]; then
# echo "Login failed - still on login page"
# agent-browser screenshot /tmp/login-failed.png
# agent-browser close
# chrome-use screenshot /tmp/login-failed.png
# chrome-use close
# exit 1
# fi
#
# # Save state for future runs
# echo "Saving state to $STATE_FILE"
# agent-browser state save "$STATE_FILE"
# chrome-use state save "$STATE_FILE"
# echo "Login successful"
# agent-browser snapshot -i
# chrome-use snapshot -i
+14 -14
View File
@@ -22,47 +22,47 @@ mkdir -p "$OUTPUT_DIR"
# Optional: Load authentication state
# if [[ -f "./auth-state.json" ]]; then
# echo "Loading authentication state..."
# agent-browser state load "./auth-state.json"
# chrome-use state load "./auth-state.json"
# fi
# Navigate to target
agent-browser open "$TARGET_URL"
agent-browser wait --load networkidle
chrome-use open "$TARGET_URL"
chrome-use wait --load networkidle
# Get metadata
TITLE=$(agent-browser get title)
URL=$(agent-browser get url)
TITLE=$(chrome-use get title)
URL=$(chrome-use get url)
echo "Title: $TITLE"
echo "URL: $URL"
# Capture full page screenshot
agent-browser screenshot --full "$OUTPUT_DIR/page-full.png"
chrome-use screenshot --full "$OUTPUT_DIR/page-full.png"
echo "Saved: $OUTPUT_DIR/page-full.png"
# Get page structure with refs
agent-browser snapshot -i > "$OUTPUT_DIR/page-structure.txt"
chrome-use snapshot -i > "$OUTPUT_DIR/page-structure.txt"
echo "Saved: $OUTPUT_DIR/page-structure.txt"
# Extract all text content
agent-browser get text body > "$OUTPUT_DIR/page-text.txt"
chrome-use get text body > "$OUTPUT_DIR/page-text.txt"
echo "Saved: $OUTPUT_DIR/page-text.txt"
# Save as PDF
agent-browser pdf "$OUTPUT_DIR/page.pdf"
chrome-use pdf "$OUTPUT_DIR/page.pdf"
echo "Saved: $OUTPUT_DIR/page.pdf"
# Optional: Extract specific elements using refs from structure
# agent-browser get text @e5 > "$OUTPUT_DIR/main-content.txt"
# chrome-use get text @e5 > "$OUTPUT_DIR/main-content.txt"
# Optional: Handle infinite scroll pages
# for i in {1..5}; do
# agent-browser scroll down 1000
# agent-browser wait 1000
# chrome-use scroll down 1000
# chrome-use wait 1000
# done
# agent-browser screenshot --full "$OUTPUT_DIR/page-scrolled.png"
# chrome-use screenshot --full "$OUTPUT_DIR/page-scrolled.png"
# Cleanup
agent-browser close
chrome-use close
echo ""
echo "Capture complete:"
+20 -20
View File
@@ -18,45 +18,45 @@ FORM_URL="${1:?Usage: $0 <form-url>}"
echo "Form automation: $FORM_URL"
# Step 1: Navigate to form
agent-browser open "$FORM_URL"
agent-browser wait --load networkidle
chrome-use open "$FORM_URL"
chrome-use wait --load networkidle
# Step 2: Snapshot to discover form elements
echo ""
echo "Form structure:"
agent-browser snapshot -i
chrome-use snapshot -i
# Step 3: Fill form fields (customize these refs based on snapshot output)
#
# Common field types:
# agent-browser fill @e1 "John Doe" # Text input
# agent-browser fill @e2 "user@example.com" # Email input
# agent-browser fill @e3 "SecureP@ss123" # Password input
# agent-browser select @e4 "Option Value" # Dropdown
# agent-browser check @e5 # Checkbox
# agent-browser click @e6 # Radio button
# agent-browser fill @e7 "Multi-line text" # Textarea
# agent-browser upload @e8 /path/to/file.pdf # File upload
# chrome-use fill @e1 "John Doe" # Text input
# chrome-use fill @e2 "user@example.com" # Email input
# chrome-use fill @e3 "SecureP@ss123" # Password input
# chrome-use select @e4 "Option Value" # Dropdown
# chrome-use check @e5 # Checkbox
# chrome-use click @e6 # Radio button
# chrome-use fill @e7 "Multi-line text" # Textarea
# chrome-use upload @e8 /path/to/file.pdf # File upload
#
# Uncomment and modify:
# agent-browser fill @e1 "Test User"
# agent-browser fill @e2 "test@example.com"
# agent-browser click @e3 # Submit button
# chrome-use fill @e1 "Test User"
# chrome-use fill @e2 "test@example.com"
# chrome-use click @e3 # Submit button
# Step 4: Wait for submission
# agent-browser wait --load networkidle
# agent-browser wait --url "**/success" # Or wait for redirect
# chrome-use wait --load networkidle
# chrome-use wait --url "**/success" # Or wait for redirect
# Step 5: Verify result
echo ""
echo "Result:"
agent-browser get url
agent-browser snapshot -i
chrome-use get url
chrome-use snapshot -i
# Optional: Capture evidence
agent-browser screenshot /tmp/form-result.png
chrome-use screenshot /tmp/form-result.png
echo "Screenshot saved: /tmp/form-result.png"
# Cleanup
agent-browser close
chrome-use close
echo "Done"