> ## Documentation Index
> Fetch the complete documentation index at: https://docs.therefrain.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Actions

> Reference for the 12 runbook action types.

## Overview

Each step has an `action` object with a required `type` field. The available fields depend on the action type.

## Common action fields

| Field      | Type                        | Required | Description                                               |
| ---------- | --------------------------- | :------: | --------------------------------------------------------- |
| `type`     | ActionType                  |    Yes   | One of the 12 action types below                          |
| `selector` | [Selector](/yaml/selectors) |  Depends | Target element (required for click, input, select, hover) |
| `value`    | string                      |  Depends | Text value — supports `{{variable}}` template syntax      |

## Action types

### `click`

Click on a DOM element.

```yaml theme={null}
action:
  type: click
  selector:
    tagName: button
    innerText: "Submit"
```

| Field      | Required | Description      |
| ---------- | :------: | ---------------- |
| `selector` |    Yes   | Element to click |

### `input`

Enter text into a form field. The field is cleared before typing.

```yaml theme={null}
action:
  type: input
  value: "{{email}}"
  selector:
    tagName: input
    inputType: email
```

| Field      | Required | Description                                       |
| ---------- | :------: | ------------------------------------------------- |
| `selector` |    Yes   | Input element                                     |
| `value`    |    Yes   | Text to enter (supports `{{variable}}` templates) |

### `select`

Choose an option from a `<select>` dropdown.

```yaml theme={null}
action:
  type: select
  value: "us-west-2"
  optionText: "US West (Oregon)"
  selector:
    tagName: select
    name: "region"
```

| Field        | Required | Description                                        |
| ------------ | :------: | -------------------------------------------------- |
| `selector`   |    Yes   | Select element                                     |
| `value`      |    No    | Option `value` attribute                           |
| `optionText` |    No    | Visible option text (used when `value` is not set) |

### `navigate`

Navigate the browser to a URL.

```yaml theme={null}
action:
  type: navigate
  url: "https://app.example.com/dashboard"
```

| Field | Required | Description     |
| ----- | :------: | --------------- |
| `url` |    Yes   | Destination URL |

### `scroll`

Scroll the page. No additional fields required — the executor scrolls the viewport.

```yaml theme={null}
action:
  type: scroll
```

### `wait`

Wait for a specified condition or duration. Useful for pages that load asynchronously.

```yaml theme={null}
action:
  type: wait
```

### `hover`

Hover over an element to trigger menus or tooltips.

```yaml theme={null}
action:
  type: hover
  selector:
    tagName: div
    ariaLabel: "User menu"
```

| Field      | Required | Description      |
| ---------- | :------: | ---------------- |
| `selector` |    Yes   | Element to hover |

### `extract`

Run a JavaScript expression in the page context and capture the result.

```yaml theme={null}
action:
  type: extract
  script: "document.querySelector('.total').textContent"
captures:
  - name: totalAmount
    strategy: expression
    expression: "{{__extracted}}"
```

| Field    | Required | Description                        |
| -------- | :------: | ---------------------------------- |
| `script` |    Yes   | JavaScript to evaluate in the page |

<Tip>
  The extracted value is available as `{{__extracted}}` for use in [captures](/yaml/captures).
</Tip>

### `download`

Download a file triggered by a click or navigation.

```yaml theme={null}
action:
  type: download
  downloadPath: "./downloads/report.csv"
  selector:
    tagName: a
    innerText: "Download CSV"
```

| Field          | Required | Description                        |
| -------------- | :------: | ---------------------------------- |
| `selector`     |    No    | Element that triggers the download |
| `downloadPath` |    No    | Local path to save the file        |

### `export`

Export a [memory collection](/yaml/memory-operations) to a CSV or JSON file.

```yaml theme={null}
action:
  type: export
  exportCollection: "products"
  exportFormat: csv
  exportPath: "./output/products.csv"
```

| Field              | Required | Description                   |
| ------------------ | :------: | ----------------------------- |
| `exportCollection` |    Yes   | Name of the memory collection |
| `exportFormat`     |    Yes   | `csv` or `json`               |
| `exportPath`       |    Yes   | Output file path              |

### `memory`

Perform a [memory operation](/yaml/memory-operations) (append or aggregate). This action type is a shorthand — you can also use `memoryOperations` on any step.

```yaml theme={null}
action:
  type: memory
```

See [Memory Operations](/yaml/memory-operations) for details.

### `key`

Press a keyboard key or key combination.

```yaml theme={null}
action:
  type: key
  keys: "Enter"
```

| Field  | Required | Description                                                                    |
| ------ | :------: | ------------------------------------------------------------------------------ |
| `keys` |    Yes   | Key name in Playwright format (e.g., `Enter`, `Tab`, `ArrowDown`, `Control+a`) |

## Summary table

| Action     | Selector |   Value  | Extra fields                                     |
| ---------- | :------: | :------: | ------------------------------------------------ |
| `click`    | Required |     —    | —                                                |
| `input`    | Required | Required | —                                                |
| `select`   | Required | Optional | `optionText`                                     |
| `navigate` |     —    |     —    | `url`                                            |
| `scroll`   |     —    |     —    | —                                                |
| `wait`     |     —    |     —    | —                                                |
| `hover`    | Required |     —    | —                                                |
| `extract`  |     —    |     —    | `script`                                         |
| `download` | Optional |     —    | `downloadPath`                                   |
| `export`   |     —    |     —    | `exportCollection`, `exportFormat`, `exportPath` |
| `memory`   |     —    |     —    | —                                                |
| `key`      |     —    |     —    | `keys`                                           |
