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

# Action Node

> Single atomic actions in automations

An `action_node` represents a single atomic action. Each node contains exactly one action type.

## Structure

```json theme={null}
{
  "type": "action_node",
  "interaction_action": {
    "click_element": {
      "command": "get_by_role(\"button\", name=\"Submit\")",
      "prompt_instructions": "Click the submit button"
    }
  },
  "before_sleep_time": 0.0,
  "end_sleep_time": 1.0
}
```

## Action Types

Each action node contains exactly one of:

| Action                 | Purpose                       | Documentation                                                |
| ---------------------- | ----------------------------- | ------------------------------------------------------------ |
| `interaction_action`   | Click, type, select, navigate | [Interaction Actions](/docs/action-types/interaction-action) |
| `extraction_action`    | Extract data, screenshots     | [Extraction Actions](/docs/action-types/extraction-action)   |
| `assertion_action`     | Verify page conditions        | [Assertion Actions](/docs/action-types/assertion-action)     |
| `python_script_action` | Custom Python code            | [Python Scripts](/docs/action-types/python-script-action)    |
| `sleep_action`         | Pure wait / timing step       | [Sleep Action](/docs/action-types/sleep-action)              |

## Timing Properties

| Property                | Type    | Default                             | Description                   |
| ----------------------- | ------- | ----------------------------------- | ----------------------------- |
| `before_sleep_time`     | `float` | `0.0` (extractions: `3.0`)          | Seconds to wait before action |
| `end_sleep_time`        | `float` | `1.0` (extractions: `0.0`)          | Seconds to wait after action  |
| `expect_new_tab`        | `bool`  | `False`                             | Action opens a new tab        |
| `max_new_tab_wait_time` | `float` | `0.0` (if expect\_new\_tab: `10.0`) | Max wait for new tab          |

### Default Timing by Action Type

| Action Type | `before_sleep_time` | `end_sleep_time` |
| ----------- | ------------------- | ---------------- |
| Interaction | `0.0`               | `1.0`            |
| Extraction  | `3.0`               | `0.0`            |
| Assertion   | `0.0`               | `0.0`            |
| 2FA         | `0.0`               | `0.0`            |

## Examples

### Basic Click

```json theme={null}
{
  "type": "action_node",
  "interaction_action": {
    "click_element": {
      "command": "get_by_role(\"button\", name=\"Continue\")",
      "prompt_instructions": "Click continue"
    }
  }
}
```

### With Custom Timing

```json theme={null}
{
  "type": "action_node",
  "interaction_action": {
    "click_element": {
      "command": "get_by_role(\"button\", name=\"Submit\")"
    }
  },
  "before_sleep_time": 2.0,
  "end_sleep_time": 3.0
}
```

### Sleep-Only Node

Use a `sleep_action` when you want to pause without performing any browser interaction. `sleep_time` is specified in seconds:

```json theme={null}
{
  "type": "action_node",
  "sleep_action": {
    "sleep_time": 5.0
  }
}
```

### Fail State Node

A `fail_state_action` is used to handle failure states in the automation. It will stop the automation, raise an exception with the provided failure message and mark it as failed.

```json theme={null}
{
  "type": "action_node",
  "fail_state_action": {
    "failure_message": "Automation completed at one of the failure states."
  }
}
```

`fail_state_action` can also be used with variables.

```json theme={null}
{
  "type": "action_node",
  "fail_state_action": {
    "failure_message": "Error in login process for user {username[0]}"
  }
}
```

### Opens New Tab

```json theme={null}
{
  "type": "action_node",
  "interaction_action": {
    "click_element": {
      "command": "get_by_role(\"link\", name=\"View Details\")"
    }
  },
  "expect_new_tab": true
}
```

<Tip>
  See [Timing & Retries](/docs/advanced/timing-retries) for detailed timing configuration.
</Tip>
