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
+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