---
name: rodney
description: This skill should be used when the user asks to "browse a website", "take a screenshot", "scrape a page", "interact with a webpage", "automate Chrome", "click a button on a page", "fill out a form", "run JavaScript in the browser", "check if an element exists", "get the accessibility tree", or any task involving headless Chrome browser automation.
version: 0.1.0
---

# Rodney – Chrome Automation CLI

Rodney is a CLI tool that drives a persistent headless Chrome instance. Each command connects to the same long-running browser process via WebSocket, executes an action, and disconnects. This enables multi-step browser workflows from the shell.

## Lifecycle

Start Chrome before any other command. Stop it when done.

```bash
rodney start        # launch headless Chrome
rodney stop         # shut down Chrome
rodney status       # check if Chrome is running
```

Always run `rodney start` first. If a command fails with a connection error, check `rodney status` and restart if needed.

## Navigation

```bash
rodney open <url>       # navigate (auto-prepends http:// if no protocol)
rodney back             # history back
rodney forward          # history forward
rodney reload           # reload current page
```

## Page Info

```bash
rodney url                      # print current URL
rodney title                    # print page title
rodney html [selector]          # print HTML (full page or element)
rodney text <selector>          # print text content of element
rodney attr <selector> <name>   # print attribute value
rodney pdf [file]               # save page as PDF
```

## Interaction

```bash
rodney click <selector>         # click an element
rodney input <selector> <text>  # type text into input
rodney clear <selector>         # clear an input field
rodney file <selector> <path|-> # set file on file input (- for stdin)
rodney download <sel> [file|-]  # download href/src target (- for stdout)
rodney select <selector> <val>  # select dropdown option by value
rodney submit <selector>        # submit a form
rodney hover <selector>         # hover over element
rodney focus <selector>         # focus an element
```

## JavaScript Execution

```bash
rodney js <expression>
```

Expressions are auto-wrapped in an arrow function. Results are returned as pretty-printed JSON.

```bash
rodney js "document.title"
rodney js "document.querySelectorAll('a').length"
```

## Waiting

Use wait commands to synchronize with page state before interacting.

```bash
rodney wait <selector>    # wait for element to appear
rodney waitload           # wait for page load event
rodney waitstable         # wait for DOM to stop changing
rodney waitidle           # wait for network requests to finish
rodney sleep <seconds>    # sleep for N seconds
```

**Best practice:** After `rodney open`, use `rodney waitload` or `rodney waitidle` before extracting content or interacting with elements.

## Screenshots

```bash
rodney screenshot [-w N] [-h N] [file]   # full page screenshot (PNG)
rodney screenshot-el <selector> [file]    # screenshot a specific element
```

## Element Queries

These commands use exit codes to indicate results — useful in conditionals.

```bash
rodney exists <selector>    # exit 0 if exists, 1 if not
rodney count <selector>     # print count of matching elements
rodney visible <selector>   # exit 0 if visible, 1 if not
```

## Tab Management

```bash
rodney pages              # list all open tabs
rodney page <index>       # switch to tab by index
rodney newpage [url]      # open new tab (optionally navigate)
rodney closepage [index]  # close a tab
```

## Accessibility Tree

```bash
rodney ax-tree [--depth N] [--json]              # dump full accessibility tree
rodney ax-find [--name N] [--role R] [--json]    # find nodes by name/role
rodney ax-node <selector> [--json]               # accessibility info for element
```

Use `--json` for structured output when parsing accessibility data.

## Workflow Patterns

### Scrape text from a page

```bash
rodney start
rodney open "https://example.com"
rodney waitload
rodney text "h1"
rodney stop
```

### Fill and submit a form

```bash
rodney open "https://example.com/login"
rodney waitload
rodney input "#username" "user@example.com"
rodney input "#password" "secret"
rodney click "button[type=submit]"
rodney waitidle
```

### Multi-step with conditional checks

```bash
rodney open "https://example.com"
rodney waitload
if rodney exists ".cookie-banner"; then
  rodney click ".cookie-banner .accept"
  rodney waitstable
fi
rodney screenshot page.png
```

## Configuration

| Variable | Purpose | Default |
|---|---|---|
| `ROD_CHROME_BIN` | Path to Chrome/Chromium binary | auto-detect |
| `ROD_TIMEOUT` | Element query timeout | 30s |
| `HTTPS_PROXY` / `HTTP_PROXY` | Proxy settings | none |

State is stored in `~/.rodney/state.json`. Chrome user data persists in `~/.rodney/chrome-data/`.

## Important Notes

- Selectors are CSS selectors throughout (e.g. `#id`, `.class`, `div > span`)
- Rod's auto-wait applies to element queries — commands wait up to `ROD_TIMEOUT` for elements to appear
- The `file` command accepts `-` to read from stdin
- The `download` command accepts `-` to write to stdout
- Authenticated HTTP proxies are handled automatically via a local forwarding proxy

## Additional Resources

### Reference Files

For the full command reference with all flags and details:
- **`references/commands.md`** — Complete command listing from `rodney --help`
