Move JS metadata exports out of page.mdx files into per-directory layout.tsx files. MDX files now contain pure markdown content, making them render cleanly on GitHub without visible JS import/export lines. No content changes — only the metadata mechanism is relocated. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
91 lines
2.4 KiB
Plaintext
91 lines
2.4 KiB
Plaintext
# Quick Start
|
|
|
|
## Core workflow
|
|
|
|
Every browser automation follows this pattern:
|
|
|
|
```bash
|
|
# 1. Navigate
|
|
agent-browser open example.com
|
|
|
|
# 2. Snapshot to get element refs
|
|
agent-browser snapshot -i
|
|
# Output:
|
|
# @e1 [heading] "Example Domain"
|
|
# @e2 [link] "More information..."
|
|
|
|
# 3. Interact using refs
|
|
agent-browser click @e2
|
|
|
|
# 4. Re-snapshot after page changes
|
|
agent-browser snapshot -i
|
|
```
|
|
|
|
## Common commands
|
|
|
|
```bash
|
|
agent-browser open example.com
|
|
agent-browser snapshot -i # Get interactive elements with refs
|
|
agent-browser click @e2 # Click by ref
|
|
agent-browser fill @e3 "test@example.com" # Fill input by ref
|
|
agent-browser get text @e1 # Get text content
|
|
agent-browser screenshot # Save to temp directory
|
|
agent-browser screenshot page.png # Save to specific path
|
|
agent-browser close
|
|
```
|
|
|
|
## Traditional selectors
|
|
|
|
CSS selectors and semantic locators also supported:
|
|
|
|
```bash
|
|
agent-browser click "#submit"
|
|
agent-browser fill "#email" "test@example.com"
|
|
agent-browser find role button click --name "Submit"
|
|
```
|
|
|
|
## Headed mode
|
|
|
|
Show browser window for debugging:
|
|
|
|
```bash
|
|
agent-browser open example.com --headed
|
|
```
|
|
|
|
## Wait for content
|
|
|
|
```bash
|
|
agent-browser wait @e1 # Wait for element
|
|
agent-browser wait --load networkidle # Wait for network idle
|
|
agent-browser wait --url "**/dashboard" # Wait for URL pattern
|
|
agent-browser wait 2000 # Wait milliseconds
|
|
```
|
|
|
|
## Command chaining
|
|
|
|
Chain commands with `&&` in a single shell call. The browser persists via a background daemon, so chaining is safe and efficient:
|
|
|
|
```bash
|
|
# Open, wait, and snapshot in one call
|
|
agent-browser open example.com && agent-browser wait --load networkidle && agent-browser snapshot -i
|
|
|
|
# Chain multiple interactions
|
|
agent-browser fill @e1 "user@example.com" && agent-browser fill @e2 "pass" && agent-browser click @e3
|
|
|
|
# Navigate and capture
|
|
agent-browser open example.com && agent-browser wait --load networkidle && agent-browser screenshot page.png
|
|
```
|
|
|
|
Use `&&` when you don't need intermediate output. Run commands separately when you need to parse output first (e.g., snapshot to discover refs before interacting).
|
|
|
|
## JSON output
|
|
|
|
For programmatic parsing in scripts:
|
|
|
|
```bash
|
|
agent-browser snapshot --json
|
|
agent-browser get text @e1 --json
|
|
```
|
|
|
|
Note: The default text output is more compact and preferred for AI agents.
|