diff --git a/docs/cli-help.md b/docs/cli-help.md new file mode 100644 index 000000000..3ba44e655 --- /dev/null +++ b/docs/cli-help.md @@ -0,0 +1,230 @@ + +# Agent-Browser CLI Help + +## Overview +Agent-Browser is a browser automation CLI for AI agents. This documentation provides an overview of the available commands and their usage. + +--- + +## Core Commands + +### Navigation +- **open/navigate/goto ** + Navigate to a URL. Supports relative URLs (converted to absolute) and special protocols (http, https, about, data, file, chrome-extension, chrome). + +- **back** + Navigate back in browser history. + +- **forward** + Navigate forward in browser history. + +- **reload** + Reload the current page. + +--- + +### Interaction +- **click [--new-tab]** + Click an element by selector. Optionally open in a new tab. + +- **dblclick ** + Double-click an element by selector. + +- **fill ** + Fill a form field with text. + +- **type ** + Type text into an element. + +- **hover ** + Hover over an element. + +- **focus ** + Focus an element. + +- **check ** + Check a checkbox or radio button. + +- **uncheck ** + Uncheck a checkbox or radio button. + +- **select ** + Select an option in a dropdown. + +- **drag ** + Drag an element from source to target. + +- **upload ** + Upload files to an input element. + +- **download ** + Download a file from a specified selector to a path. + +--- + +### Keyboard +- **press/key ** + Press a key. + +- **keydown ** + Press down a key. + +- **keyup ** + Release a key. + +- **keyboard ** + Type text using keyboard actions. + +--- + +### Scroll +- **scroll [direction] [amount] [--selector ]** + Scroll the page. Direction defaults to "down" and amount defaults to 300 pixels. + +- **scrollintoview/scrollinto ** + Scroll an element into view. + +--- + +### Wait +- **wait --url ** + Wait until a URL matches a pattern. + +- **wait --load ** + Wait for network load state (e.g., "networkidle"). + +- **wait --fn ** + Wait for a JavaScript expression to evaluate to true. + +--- + +### Get Information +- **get [args...]** + Retrieve information from the page: + - `text`: Get text content of an element. + - `html`: Get HTML content of an element. + - `value`: Get input value. + - `attr`: Get attribute value. + - `url`: Get current URL. + - `title`: Get page title. + - `count`: Count elements matching a selector. + - `box`: Get bounding box of an element. + - `styles`: Get styles of an element. + - `cdp-url`: Get CDP URL. + +- **is ** + Check if an element is visible, enabled, or checked. + +--- + +### Mouse +- **mouse [args...]** + Perform mouse actions: + - `move `: Move mouse to coordinates. + - `down`: Press mouse button. + - `up`: Release mouse button. + - `wheel [deltaX]`: Scroll with mouse wheel. + +--- + +### Set Configuration +- **set [args...]** + Set various configurations: + - `viewport [scale]`: Set viewport dimensions. + - `device `: Set device configuration. + - `geo `: Set geolocation. + - `offline`: Set offline mode. + - `headers `: Set HTTP headers. + - `credentials `: Set authentication credentials. + - `media `: Set media preferences. + +--- + +### Network +- **network [args...]** + Manage network operations: + - `route [--abort|--body ]`: Route requests. + - `unroute`: Unroute requests. + - `requests [--clear|--filter |--type |--method |--status ]`: List requests. + - `request `: Get request details. + - `har [path]`: Start/stop HAR recording. + +--- + +### Storage +- **storage [get|set|clear] [key] [value]** + Manage browser storage: + - `get`: Retrieve a value. + - `set `: Set a value. + - `clear`: Clear storage. + +--- + +## Common Options +- `--session `: Specify a session name. +- `--json`: Output JSON. +- `--headed`: Run in headed mode. +- `--debug`: Enable debug mode. +- `--headers `: Set HTTP headers. +- `--provider `: Specify a provider. +- `--device `: Specify a device. + +--- + +## Examples +```bash +# Navigate to a URL +agent-browser open https://example.com + +# Click an element +agent-browser click "#submit-button" + +# Fill a form field +agent-browser fill "#username" "myusername" + +# Wait for a URL pattern +agent-browser wait --url "**/dashboard" + +# Set viewport +agent-browser set viewport 1200 800 + +# Get page title +agent-browser get title +``` + +--- + +## Installation +To install and use Agent-Browser, follow these steps: + +1. Clone the repository: + ```bash + git clone https://github.com/dextonai/agent-browser.git + ``` + +2. Build the project: + ```bash + cd agent-browser + npm run build:all-platforms + ``` + +3. Run the CLI: + ```bash + ./bin/agent-browser + ``` + +--- + +## Additional Scripts +- `npm run version:sync`: Sync version information. +- `npm run build:native`: Build native binaries. +- `npm run build:linux`: Build for Linux. +- `npm run build:macos`: Build for macOS. +- `npm run build:windows`: Build for Windows. +- `npm run build:all-platforms`: Build for all platforms. +- `npm run release`: Create a release. +- `npm run postinstall`: Post-installation tasks. +- `npm run changeset`: Manage changesets. +- `npm run ci:version`: CI versioning. +- `npm run ci:publish`: CI publishing. +- `npm run build:dashboard`: Build dashboard.