From 6a49458e4f129309044f8660aba90498d139729c Mon Sep 17 00:00:00 2001 From: wehub-resource-sync Date: Mon, 13 Jul 2026 10:25:58 +0000 Subject: [PATCH] docs: preserve upstream English README --- README.en.md | 1720 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1720 insertions(+) create mode 100644 README.en.md diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000..a55aac3 --- /dev/null +++ b/README.en.md @@ -0,0 +1,1720 @@ +# agent-browser + +Browser automation CLI for AI agents. Fast native Rust CLI. + +[![skills.sh](https://skills.sh/b/vercel-labs/agent-browser)](https://skills.sh/vercel-labs/agent-browser) + +## Installation + +### Global Installation (recommended) + +Installs the native Rust binary: + +```bash +npm install -g agent-browser +agent-browser install # Download Chrome from Chrome for Testing (first time only) +``` + +### Project Installation (local dependency) + +For projects that want to pin the version in `package.json`: + +```bash +npm install agent-browser +agent-browser install +``` + +Then use via `package.json` scripts or by invoking `agent-browser` directly. + +### Homebrew (macOS) + +```bash +brew install agent-browser +agent-browser install # Download Chrome from Chrome for Testing (first time only) +``` + +### Cargo (Rust) + +```bash +cargo install agent-browser +agent-browser install # Download Chrome from Chrome for Testing (first time only) +``` + +### From Source + +Requires Node.js 24+, pnpm 11+, and Rust. + +```bash +git clone https://github.com/vercel-labs/agent-browser +cd agent-browser +pnpm install +pnpm build +pnpm build:native # Requires Rust (https://rustup.rs) +pnpm link --global # Makes agent-browser available globally +agent-browser install +``` + +### Linux Dependencies + +On Linux, install system dependencies: + +```bash +agent-browser install --with-deps +``` + +This exits nonzero if the package manager cannot install every required browser library. + +### Updating + +Upgrade to the latest version: + +```bash +agent-browser upgrade +``` + +Detects your installation method (npm, Homebrew, or Cargo) and runs the appropriate update command automatically. + +### Requirements + +- **Chrome** - Run `agent-browser install` to download Chrome from [Chrome for Testing](https://developer.chrome.com/blog/chrome-for-testing/) (Google's official automation channel). Existing Chrome, Brave, Playwright, and Puppeteer installations are detected automatically. No Playwright or Node.js required for the daemon. +- **Node.js 24+ and pnpm 11+** - Only needed when building from source. +- **Rust** - Only needed when building from source (see From Source above). + +## Quick Start + +```bash +agent-browser open example.com +agent-browser snapshot # Get accessibility tree with refs +agent-browser click @e2 # Click by ref from snapshot +agent-browser fill @e3 "test@example.com" # Fill by ref +agent-browser get text @e1 # Get text by ref +agent-browser screenshot page.png +agent-browser close +``` + +Clicks fail early when another element covers the target's click point, for example a consent banner or modal. Dismiss or interact with the reported covering element, then take a fresh snapshot before retrying the original ref. + +Headless Chromium screenshots hide native scrollbars for consistent image output. Pass `--hide-scrollbars false` when launching to keep native scrollbars visible. + +### Traditional Selectors (also supported) + +```bash +agent-browser click "#submit" +agent-browser fill "#email" "test@example.com" +agent-browser find role button click --name "Submit" +``` + +## Commands + +### Core Commands + +```bash +agent-browser open # Launch browser (no navigation); stays on about:blank +agent-browser open # Launch + navigate to URL (aliases: goto, navigate) +agent-browser read [url] # Fetch agent-readable text, or read rendered active-tab DOM +agent-browser click # Click element (--new-tab to open in new tab) +agent-browser dblclick # Double-click element +agent-browser focus # Focus element +agent-browser type # Type into element +agent-browser fill # Clear and fill +agent-browser press # Press key (Enter, Tab, Control+a) (alias: key) +agent-browser keyboard type # Type with real keystrokes (no selector, current focus) +agent-browser keyboard inserttext # Insert text without key events (no selector) +agent-browser keydown # Hold key down +agent-browser keyup # Release key +agent-browser hover # Hover element +agent-browser select # Select dropdown option +agent-browser check # Check checkbox +agent-browser uncheck # Uncheck checkbox +agent-browser scroll [px] # Scroll (up/down/left/right, --selector ) +agent-browser scrollintoview # Scroll element into view (alias: scrollinto) +agent-browser drag # Drag and drop +agent-browser upload # Upload files +agent-browser screenshot [path] # Take screenshot (--full for full page, saves to a temporary directory if no path) +agent-browser screenshot --annotate # Annotated screenshot with numbered element labels +agent-browser screenshot --screenshot-dir ./shots # Save to custom directory +agent-browser screenshot --screenshot-format jpeg --screenshot-quality 80 +agent-browser pdf # Save as PDF +agent-browser snapshot # Accessibility tree with refs (best for AI) +agent-browser eval # Run JavaScript (-b for base64, --stdin for piped input) +agent-browser connect # Connect to browser via CDP +agent-browser stream enable [--port ] # Start runtime WebSocket streaming +agent-browser stream status # Show runtime streaming state and bound port +agent-browser stream disable # Stop runtime WebSocket streaming +agent-browser close # Close browser (aliases: quit, exit) +agent-browser close --all # Close all active sessions +agent-browser chat "" # AI chat: natural language browser control (single-shot) +agent-browser chat # AI chat: interactive REPL mode +``` + +### Get Info + +```bash +agent-browser get text # Get text content +agent-browser get html # Get innerHTML +agent-browser get value # Get input value +agent-browser get attr # 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 (for DevTools, debugging) +agent-browser get count # Count matching elements +agent-browser get box # Get bounding box +agent-browser get styles # Get computed styles +``` + +### Read Agent-Friendly Text + +```bash +agent-browser read +agent-browser read https://example.com/article +agent-browser read https://example.com/article --filter overview +agent-browser read https://example.com/article --outline +agent-browser read https://docs.example.com --llms index --filter auth +agent-browser read https://docs.example.com --llms full --filter auth +agent-browser read example.com/article --require-md +agent-browser read https://example.com/article --json +``` + +`read` fetches a URL without launching Chrome. Omit the URL to read the rendered DOM of the active tab in the current browser session, including browser auth state and client-side updates. Explicit URL reads send `Accept: text/markdown` by default, try the same URL with `.md` appended when the first response is not markdown, walk ancestor paths toward `/` to find the nearest `llms.txt` for a matching docs link, print markdown or plain text when available, and fall back to readable text extracted from HTML. `--llms` and `--require-md` with no URL use the active tab URL because they depend on HTTP resources. `read` does not read `llms-full.txt` unless you ask for it. + +Options: `--raw` prints the response body without HTML extraction, `--require-md` fails unless the server returns `Content-Type: text/markdown`, `--outline` prints a compact heading outline for one page, `--llms index` prints a compact nearest-ancestor `llms.txt` link list, `--llms full` reads the nearest-ancestor `llms-full.txt`, `--filter ` narrows page sections, llms links/sections, or outline headings, and `--timeout ` changes the request timeout. Global safeguards such as `--allowed-domains`, `--content-boundaries`, and `--max-output` also apply to read fetches and output. + +### Check State + +```bash +agent-browser is visible # Check if visible +agent-browser is enabled # Check if enabled +agent-browser is checked # Check if checked +``` + +### Find Elements (Semantic Locators) + +```bash +agent-browser find role [value] # By ARIA role +agent-browser find text # By text content +agent-browser find label