update docs (#493)

This commit is contained in:
Chris Tate
2026-02-17 21:37:41 -06:00
committed by GitHub
parent 19dd2d0c0b
commit 76df589aea
10 changed files with 161 additions and 70 deletions
+15 -11
View File
@@ -95,7 +95,7 @@ agent-browser find role button click --name "Submit"
```bash ```bash
agent-browser open <url> # Navigate to URL (aliases: goto, navigate) agent-browser open <url> # Navigate to URL (aliases: goto, navigate)
agent-browser click <sel> # Click element agent-browser click <sel> # Click element (--new-tab to open in new tab)
agent-browser dblclick <sel> # Double-click element agent-browser dblclick <sel> # Double-click element
agent-browser focus <sel> # Focus element agent-browser focus <sel> # Focus element
agent-browser type <sel> <text> # Type into element agent-browser type <sel> <text> # Type into element
@@ -130,6 +130,7 @@ agent-browser get title # Get page title
agent-browser get url # Get current URL agent-browser get url # Get current URL
agent-browser get count <sel> # Count matching elements agent-browser get count <sel> # Count matching elements
agent-browser get box <sel> # Get bounding box agent-browser get box <sel> # Get bounding box
agent-browser get styles <sel> # Get computed styles
``` ```
### Check State ### Check State
@@ -155,7 +156,9 @@ agent-browser find last <sel> <action> [value] # Last match
agent-browser find nth <n> <sel> <action> [value] # Nth match agent-browser find nth <n> <sel> <action> [value] # Nth match
``` ```
**Actions:** `click`, `fill`, `check`, `hover`, `text` **Actions:** `click`, `fill`, `type`, `hover`, `focus`, `check`, `uncheck`, `text`
**Options:** `--name <name>` (filter role by accessible name), `--exact` (require exact text match)
**Examples:** **Examples:**
```bash ```bash
@@ -401,24 +404,25 @@ The `-C` flag is useful for modern web apps that use custom clickable elements (
| Option | Description | | Option | Description |
|--------|-------------| |--------|-------------|
| `--session <name>` | Use isolated session (or `AGENT_BROWSER_SESSION` env) | | `--session <name>` | Use isolated session (or `AGENT_BROWSER_SESSION` env) |
| `--session-name <name>` | Auto-save/restore session state (or `AGENT_BROWSER_SESSION_NAME` env) |
| `--profile <path>` | Persistent browser profile directory (or `AGENT_BROWSER_PROFILE` env) | | `--profile <path>` | Persistent browser profile directory (or `AGENT_BROWSER_PROFILE` env) |
| `--state <path>` | Load storage state from JSON file (or `AGENT_BROWSER_STATE` env) |
| `--headers <json>` | Set HTTP headers scoped to the URL's origin | | `--headers <json>` | Set HTTP headers scoped to the URL's origin |
| `--executable-path <path>` | Custom browser executable (or `AGENT_BROWSER_EXECUTABLE_PATH` env) | | `--executable-path <path>` | Custom browser executable (or `AGENT_BROWSER_EXECUTABLE_PATH` env) |
| `--extension <path>` | Load browser extension (repeatable; or `AGENT_BROWSER_EXTENSIONS` env) |
| `--args <args>` | Browser launch args, comma or newline separated (or `AGENT_BROWSER_ARGS` env) | | `--args <args>` | Browser launch args, comma or newline separated (or `AGENT_BROWSER_ARGS` env) |
| `--user-agent <ua>` | Custom User-Agent string (or `AGENT_BROWSER_USER_AGENT` env) | | `--user-agent <ua>` | Custom User-Agent string (or `AGENT_BROWSER_USER_AGENT` env) |
| `--proxy <url>` | Proxy server URL with optional auth (or `AGENT_BROWSER_PROXY` env) | | `--proxy <url>` | Proxy server URL with optional auth (or `AGENT_BROWSER_PROXY` env) |
| `--proxy-bypass <hosts>` | Hosts to bypass proxy (or `AGENT_BROWSER_PROXY_BYPASS` env) | | `--proxy-bypass <hosts>` | Hosts to bypass proxy (or `AGENT_BROWSER_PROXY_BYPASS` env) |
| `-p, --provider <name>` | Cloud browser provider (or `AGENT_BROWSER_PROVIDER` env) |
| `--json` | JSON output (for agents) |
| `--full, -f` | Full page screenshot |
| `--name, -n` | Locator name filter |
| `--exact` | Exact text match |
| `--headed` | Show browser window (not headless) |
| `--cdp <port>` | Connect via Chrome DevTools Protocol |
| `--auto-connect` | Auto-discover and connect to running Chrome (or `AGENT_BROWSER_AUTO_CONNECT` env) |
| `--session-name <name>` | Auto-save/restore session state (or `AGENT_BROWSER_SESSION_NAME` env) |
| `--ignore-https-errors` | Ignore HTTPS certificate errors (useful for self-signed certs) | | `--ignore-https-errors` | Ignore HTTPS certificate errors (useful for self-signed certs) |
| `--allow-file-access` | Allow file:// URLs to access local files (Chromium only) | | `--allow-file-access` | Allow file:// URLs to access local files (Chromium only) |
| `-p, --provider <name>` | Cloud browser provider (or `AGENT_BROWSER_PROVIDER` env) |
| `--device <name>` | iOS device name, e.g. "iPhone 15 Pro" (or `AGENT_BROWSER_IOS_DEVICE` env) |
| `--json` | JSON output (for agents) |
| `--full, -f` | Full page screenshot |
| `--headed` | Show browser window (not headless) |
| `--cdp <port\|url>` | Connect via Chrome DevTools Protocol (port or WebSocket URL) |
| `--auto-connect` | Auto-discover and connect to running Chrome (or `AGENT_BROWSER_AUTO_CONNECT` env) |
| `--debug` | Debug output | | `--debug` | Debug output |
## Selectors ## Selectors
+1
View File
@@ -1887,6 +1887,7 @@ Environment:
AGENT_BROWSER_ENCRYPTION_KEY 64-char hex key for AES-256-GCM state encryption AGENT_BROWSER_ENCRYPTION_KEY 64-char hex key for AES-256-GCM state encryption
AGENT_BROWSER_STATE_EXPIRE_DAYS Auto-delete states older than N days (default: 30) AGENT_BROWSER_STATE_EXPIRE_DAYS Auto-delete states older than N days (default: 30)
AGENT_BROWSER_EXECUTABLE_PATH Custom browser executable path AGENT_BROWSER_EXECUTABLE_PATH Custom browser executable path
AGENT_BROWSER_EXTENSIONS Comma-separated browser extension paths
AGENT_BROWSER_PROVIDER Browser provider (ios, browserbase, kernel, browseruse) AGENT_BROWSER_PROVIDER Browser provider (ios, browserbase, kernel, browseruse)
AGENT_BROWSER_AUTO_CONNECT Auto-discover and connect to running Chrome AGENT_BROWSER_AUTO_CONNECT Auto-discover and connect to running Chrome
AGENT_BROWSER_STREAM_PORT Enable WebSocket streaming on port (e.g., 9223) AGENT_BROWSER_STREAM_PORT Enable WebSocket streaming on port (e.g., 9223)
+5 -1
View File
@@ -74,7 +74,7 @@ This enables control of:
| --- | --- | | --- | --- |
| `--session <name>` | Use isolated session | | `--session <name>` | Use isolated session |
| `--profile <path>` | Persistent browser profile directory | | `--profile <path>` | Persistent browser profile directory |
| `-p <provider>` | Cloud browser provider (`browserbase`, `browseruse`) | | `-p <provider>` | Cloud browser provider (`browserbase`, `browseruse`, `kernel`) |
| `--headers <json>` | HTTP headers scoped to origin | | `--headers <json>` | HTTP headers scoped to origin |
| `--executable-path` | Custom browser executable | | `--executable-path` | Custom browser executable |
| `--args <args>` | Browser launch args (comma-separated) | | `--args <args>` | Browser launch args (comma-separated) |
@@ -104,6 +104,10 @@ agent-browser -p browserbase open https://example.com
export BROWSER_USE_API_KEY="your-api-key" export BROWSER_USE_API_KEY="your-api-key"
agent-browser -p browseruse open https://example.com agent-browser -p browseruse open https://example.com
# Kernel
export KERNEL_API_KEY="your-api-key"
agent-browser -p kernel open https://example.com
# Or via environment variable # Or via environment variable
export AGENT_BROWSER_PROVIDER=browserbase export AGENT_BROWSER_PROVIDER=browserbase
agent-browser open https://example.com agent-browser open https://example.com
+57 -8
View File
@@ -6,20 +6,28 @@ export const metadata = { title: "Commands" }
```bash ```bash
agent-browser open <url> # Navigate (aliases: goto, navigate) agent-browser open <url> # Navigate (aliases: goto, navigate)
agent-browser click <sel> # Click element agent-browser click <sel> # Click element (--new-tab to open in new tab)
agent-browser dblclick <sel> # Double-click agent-browser dblclick <sel> # Double-click
agent-browser fill <sel> <text> # Clear and fill agent-browser fill <sel> <text> # Clear and fill
agent-browser type <sel> <text> # Type into element agent-browser type <sel> <text> # Type into element
agent-browser press <key> # Press key (Enter, Tab, Control+a) agent-browser press <key> # Press key (Enter, Tab, Control+a) (alias: key)
agent-browser keydown <key> # Hold key down
agent-browser keyup <key> # Release key
agent-browser hover <sel> # Hover element agent-browser hover <sel> # Hover element
agent-browser focus <sel> # Focus element
agent-browser select <sel> <val> # Select dropdown option agent-browser select <sel> <val> # Select dropdown option
agent-browser check <sel> # Check checkbox agent-browser check <sel> # Check checkbox
agent-browser uncheck <sel> # Uncheck checkbox agent-browser uncheck <sel> # Uncheck checkbox
agent-browser scroll <dir> [px] # Scroll (up/down/left/right) agent-browser scroll <dir> [px] # Scroll (up/down/left/right)
agent-browser scrollintoview <sel> # Scroll element into view
agent-browser drag <src> <dst> # Drag and drop
agent-browser upload <sel> <files> # Upload files
agent-browser screenshot [path] # Screenshot (--full for full page) agent-browser screenshot [path] # Screenshot (--full for full page)
agent-browser pdf <path> # Save page as PDF
agent-browser snapshot # Accessibility tree with refs agent-browser snapshot # Accessibility tree with refs
agent-browser eval <js> # Run JavaScript agent-browser eval <js> # Run JavaScript
agent-browser close # Close browser agent-browser connect <port|url> # Connect to browser via CDP
agent-browser close # Close browser (aliases: quit, exit)
``` ```
## Get info ## Get info
@@ -33,6 +41,7 @@ agent-browser get title # Get page title
agent-browser get url # Get current URL agent-browser get url # Get current URL
agent-browser get count <sel> # Count matching elements agent-browser get count <sel> # Count matching elements
agent-browser get box <sel> # Get bounding box agent-browser get box <sel> # Get bounding box
agent-browser get styles <sel> # Get computed styles
``` ```
## Check state ## Check state
@@ -45,24 +54,35 @@ agent-browser is checked <sel> # Check if checked
## Find elements ## Find elements
Semantic locators with actions (`click`, `fill`, `check`, `hover`, `text`): Semantic locators with actions (`click`, `fill`, `type`, `hover`, `focus`, `check`, `uncheck`, `text`):
```bash ```bash
agent-browser find role <role> <action> [value] agent-browser find role <role> <action> [value]
agent-browser find text <text> <action> agent-browser find text <text> <action>
agent-browser find label <label> <action> [value] agent-browser find label <label> <action> [value]
agent-browser find placeholder <ph> <action> [value] agent-browser find placeholder <ph> <action> [value]
agent-browser find alt <text> <action>
agent-browser find title <text> <action>
agent-browser find testid <id> <action> [value] agent-browser find testid <id> <action> [value]
agent-browser find first <sel> <action> [value] agent-browser find first <sel> <action> [value]
agent-browser find last <sel> <action> [value]
agent-browser find nth <n> <sel> <action> [value] agent-browser find nth <n> <sel> <action> [value]
``` ```
Options:
- `--name <name>` -- filter role by accessible name
- `--exact` -- require exact text match
Examples: Examples:
```bash ```bash
agent-browser find role button click --name "Submit" agent-browser find role button click --name "Submit"
agent-browser find label "Email" fill "test@test.com" agent-browser find label "Email" fill "test@test.com"
agent-browser find alt "Logo" click
agent-browser find first ".item" click agent-browser find first ".item" click
agent-browser find last ".item" text
agent-browser find nth 2 ".card" hover
``` ```
## Wait ## Wait
@@ -128,6 +148,8 @@ agent-browser network route <url> --abort # Block requests
agent-browser network route <url> --body <json> # Mock response agent-browser network route <url> --body <json> # Mock response
agent-browser network unroute [url] # Remove routes agent-browser network unroute [url] # Remove routes
agent-browser network requests # View tracked requests agent-browser network requests # View tracked requests
agent-browser network requests --clear # Clear request log
agent-browser network requests --filter <pat> # Filter by URL pattern
``` ```
## Tabs & frames ## Tabs & frames
@@ -137,17 +159,30 @@ agent-browser tab # List tabs
agent-browser tab new [url] # New tab agent-browser tab new [url] # New tab
agent-browser tab <n> # Switch to tab agent-browser tab <n> # Switch to tab
agent-browser tab close [n] # Close tab agent-browser tab close [n] # Close tab
agent-browser window new # Open new browser window
agent-browser frame <sel> # Switch to iframe agent-browser frame <sel> # Switch to iframe
agent-browser frame main # Back to main frame agent-browser frame main # Back to main frame
``` ```
## Dialogs
```bash
agent-browser dialog accept [text] # Accept dialog (with optional prompt text)
agent-browser dialog dismiss # Dismiss dialog
```
## Debug ## Debug
```bash ```bash
agent-browser trace start [path] # Start trace agent-browser trace start [path] # Start trace
agent-browser trace stop [path] # Stop and save trace agent-browser trace stop [path] # Stop and save trace
agent-browser record start <path> # Start video recording (WebM)
agent-browser record stop # Stop and save video
agent-browser record restart <path> # Stop current and start new recording
agent-browser console # View console messages agent-browser console # View console messages
agent-browser console --clear # Clear console log
agent-browser errors # View page errors agent-browser errors # View page errors
agent-browser errors --clear # Clear error log
agent-browser highlight <sel> # Highlight element agent-browser highlight <sel> # Highlight element
``` ```
@@ -164,6 +199,13 @@ agent-browser state clear --all # Clear all saved states
agent-browser state clean --older-than <days> # Delete old states agent-browser state clean --older-than <days> # Delete old states
``` ```
## Sessions
```bash
agent-browser session # Show current session name
agent-browser session list # List active sessions
```
## Navigation ## Navigation
```bash ```bash
@@ -176,18 +218,25 @@ agent-browser reload # Reload page
```bash ```bash
--session <name> # Isolated browser session --session <name> # Isolated browser session
--session-name <name> # Auto-save/restore session state (cookies, localStorage)
--profile <path> # Persistent browser profile directory --profile <path> # Persistent browser profile directory
--headed # Show browser window (not headless) --state <path> # Load storage state from JSON file
--cdp <port> # Connect via Chrome DevTools Protocol --headers <json> # HTTP headers scoped to URL's origin
--auto-connect # Auto-discover and connect to running Chrome
--executable-path <path> # Custom browser executable --executable-path <path> # Custom browser executable
--extension <path> # Load browser extension (repeatable)
--args <args> # Browser launch args (comma separated) --args <args> # Browser launch args (comma separated)
--user-agent <ua> # Custom User-Agent string --user-agent <ua> # Custom User-Agent string
--proxy <url> # Proxy server URL --proxy <url> # Proxy server URL
--headers <json> # HTTP headers scoped to URL's origin --proxy-bypass <hosts> # Hosts to bypass proxy
--ignore-https-errors # Ignore HTTPS certificate errors --ignore-https-errors # Ignore HTTPS certificate errors
--allow-file-access # Allow file:// URLs to access local files (Chromium only) --allow-file-access # Allow file:// URLs to access local files (Chromium only)
-p, --provider <name> # Browser provider (ios, browserbase, kernel, browseruse)
--device <name> # iOS device name (e.g., "iPhone 15 Pro")
--json # JSON output (for scripts) --json # JSON output (for scripts)
--full, -f # Full page screenshot
--headed # Show browser window (not headless)
--cdp <port|url> # Connect via Chrome DevTools Protocol (port or WebSocket URL)
--auto-connect # Auto-discover and connect to running Chrome
--debug # Debug output --debug # Debug output
``` ```
+29 -32
View File
@@ -3,20 +3,7 @@
import Link from "next/link"; import Link from "next/link";
import { usePathname } from "next/navigation"; import { usePathname } from "next/navigation";
import { useMobileNav } from "./mobile-nav-context"; import { useMobileNav } from "./mobile-nav-context";
import { navigation } from "@/lib/docs-navigation";
const navigation = [
{ name: "Introduction", href: "/" },
{ name: "Installation", href: "/installation" },
{ name: "Quick Start", href: "/quick-start" },
{ name: "Commands", href: "/commands" },
{ name: "Selectors", href: "/selectors" },
{ name: "Sessions", href: "/sessions" },
{ name: "Snapshots", href: "/snapshots" },
{ name: "Streaming", href: "/streaming" },
{ name: "CDP Mode", href: "/cdp-mode" },
{ name: "iOS Simulator", href: "/ios" },
{ name: "Changelog", href: "/changelog" },
];
export function Sidebar() { export function Sidebar() {
const pathname = usePathname(); const pathname = usePathname();
@@ -43,24 +30,34 @@ export function Sidebar() {
`} `}
> >
<div className="h-full overflow-y-auto py-5 pl-3 pr-5"> <div className="h-full overflow-y-auto py-5 pl-3 pr-5">
<nav className="space-y-0.5"> <nav className="space-y-4">
{navigation.map((item) => { {navigation.map((section, sectionIndex) => (
const isActive = pathname === item.href; <div key={section.title ?? sectionIndex}>
{section.title && (
return ( <div className="px-2 pb-1 text-xs font-medium text-muted-foreground/60 uppercase tracking-wider">
<Link {section.title}
key={item.name} </div>
href={item.href} )}
className={`block px-2 py-1.5 text-sm transition-colors ${ <div className="space-y-0.5">
isActive {section.items.map((item) => {
? "text-foreground" const isActive = pathname === item.href;
: "text-muted-foreground hover:text-foreground" return (
}`} <Link
> key={item.href}
{item.name} href={item.href}
</Link> className={`block px-2 py-1.5 text-sm transition-colors ${
); isActive
})} ? "text-foreground"
: "text-muted-foreground hover:text-foreground"
}`}
>
{item.name}
</Link>
);
})}
</div>
</div>
))}
</nav> </nav>
</div> </div>
</aside> </aside>
+39 -12
View File
@@ -3,16 +3,43 @@ export type NavItem = {
href: string; href: string;
}; };
export const allDocsPages: NavItem[] = [ export type NavSection = {
{ name: "Introduction", href: "/" }, title: string | null;
{ name: "Installation", href: "/installation" }, items: NavItem[];
{ name: "Quick Start", href: "/quick-start" }, };
{ name: "Commands", href: "/commands" },
{ name: "Selectors", href: "/selectors" }, export const navigation: NavSection[] = [
{ name: "Sessions", href: "/sessions" }, {
{ name: "Snapshots", href: "/snapshots" }, title: null,
{ name: "Streaming", href: "/streaming" }, items: [
{ name: "CDP Mode", href: "/cdp-mode" }, { name: "Introduction", href: "/" },
{ name: "iOS Simulator", href: "/ios" }, { name: "Installation", href: "/installation" },
{ name: "Changelog", href: "/changelog" }, { name: "Quick Start", href: "/quick-start" },
],
},
{
title: "Reference",
items: [
{ name: "Commands", href: "/commands" },
{ name: "Selectors", href: "/selectors" },
{ name: "Snapshots", href: "/snapshots" },
],
},
{
title: "Features",
items: [
{ name: "Sessions", href: "/sessions" },
{ name: "CDP Mode", href: "/cdp-mode" },
{ name: "Streaming", href: "/streaming" },
{ name: "iOS Simulator", href: "/ios" },
],
},
{
title: null,
items: [{ name: "Changelog", href: "/changelog" }],
},
]; ];
export const allDocsPages: NavItem[] = navigation.flatMap(
(section) => section.items
);
+1
View File
@@ -41,6 +41,7 @@ agent-browser snapshot -s "#selector" # Scope to CSS selector
# Interaction (use @refs from snapshot) # Interaction (use @refs from snapshot)
agent-browser click @e1 # Click element agent-browser click @e1 # Click element
agent-browser click @e1 --new-tab # Click and open in new tab
agent-browser fill @e2 "text" # Clear and type text agent-browser fill @e2 "text" # Clear and type text
agent-browser type @e2 "text" # Type without clearing agent-browser type @e2 "text" # Type without clearing
agent-browser select @e1 "option" # Select dropdown option agent-browser select @e1 "option" # Select dropdown option
@@ -29,6 +29,7 @@ agent-browser snapshot -s "#main" # Scope to CSS selector
```bash ```bash
agent-browser click @e1 # Click 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 dblclick @e1 # Double-click
agent-browser focus @e1 # Focus element agent-browser focus @e1 # Focus element
agent-browser fill @e2 "text" # Clear and type agent-browser fill @e2 "text" # Clear and type
@@ -223,6 +224,7 @@ agent-browser --full ... # Full page screenshot (-f)
agent-browser --cdp <port> ... # Connect via Chrome DevTools Protocol agent-browser --cdp <port> ... # Connect via Chrome DevTools Protocol
agent-browser -p <provider> ... # Cloud browser provider (--provider) agent-browser -p <provider> ... # Cloud browser provider (--provider)
agent-browser --proxy <url> ... # Use proxy server 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 --headers <json> ... # HTTP headers scoped to URL's origin
agent-browser --executable-path <p> # Custom browser executable agent-browser --executable-path <p> # Custom browser executable
agent-browser --extension <path> ... # Load browser extension (repeatable) agent-browser --extension <path> ... # Load browser extension (repeatable)
@@ -17,10 +17,13 @@ Proxy configuration for geo-testing, rate limiting avoidance, and corporate envi
## Basic Proxy Configuration ## Basic Proxy Configuration
Set proxy via environment variable before starting: Use the `--proxy` flag or set proxy via environment variable:
```bash ```bash
# HTTP proxy # Via CLI flag
agent-browser --proxy "http://proxy.example.com:8080" open https://example.com
# Via environment variable
export HTTP_PROXY="http://proxy.example.com:8080" export HTTP_PROXY="http://proxy.example.com:8080"
agent-browser open https://example.com agent-browser open https://example.com
@@ -58,10 +61,13 @@ agent-browser open https://example.com
## Proxy Bypass ## Proxy Bypass
Skip proxy for specific domains: Skip proxy for specific domains using `--proxy-bypass` or `NO_PROXY`:
```bash ```bash
# Bypass proxy for local addresses # Via CLI flag
agent-browser --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" export NO_PROXY="localhost,127.0.0.1,.internal.company.com"
agent-browser open https://internal.company.com # Direct connection agent-browser open https://internal.company.com # Direct connection
agent-browser open https://external.com # Via proxy agent-browser open https://external.com # Via proxy
@@ -174,8 +174,8 @@ agent-browser snapshot -i
### Element Not Visible in Snapshot ### Element Not Visible in Snapshot
```bash ```bash
# Scroll to reveal element # Scroll down to reveal element
agent-browser scroll --bottom agent-browser scroll down 1000
agent-browser snapshot -i agent-browser snapshot -i
# Or wait for dynamic content # Or wait for dynamic content