> ## 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](https://docs.optexity.com/docs/action-types/interaction-action.md) |
| `extraction_action` | Extract data, screenshots | [Extraction Actions](https://docs.optexity.com/docs/action-types/extraction-action.md) |
| `assertion_action` | Verify page conditions | [Assertion Actions](https://docs.optexity.com/docs/action-types/assertion-action.md) |
| `python_script_action` | Custom Python code | [Python Scripts](https://docs.optexity.com/docs/action-types/python-script-action.md) |
| `dynamic_form_mapping_action` | Extract form keys, fetch values from your endpoint | [Dynamic Form Mapping](https://docs.optexity.com/docs/action-types/dynamic-form-mapping.md) |
| `sleep_action` | Pure wait / timing step | [Sleep Action](https://docs.optexity.com/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 |
| `include_full_page` | `bool` | `False` | Include elements outside the viewport in this node's accessibility tree. Index prediction, extraction, and other axtree reads use the full page when this is `true` |

### Default Timing by Action Type

| Action Type | `before_sleep_time` | `end_sleep_time` |
| - | - | - |
| Interaction | `0.0` | `1.0` |
| Extraction | `3.0` | `0.0` |
| Dynamic form mapping | `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](https://docs.optexity.com/docs/advanced/timing-retries.md) for detailed timing configuration.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.