Skip to main content

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.

Web automation requires careful timing. Pages load at different speeds, elements appear dynamically, and networks can be slow.

Timing Controls

LevelProperties
Automationmax_retries
Action Nodebefore_sleep_time, end_sleep_time, expect_new_tab, max_new_tab_wait_time
Interaction Actionmax_tries, max_timeout_seconds_per_try

Sleep Times

before_sleep_time

Wait before executing the action. Use when page needs to load or settle.
{
  "type": "action_node",
  "interaction_action": { ... },
  "before_sleep_time": 3.0
}

end_sleep_time

Wait after action completes. Use when subsequent actions depend on this action’s effects.
{
  "type": "action_node",
  "interaction_action": { ... },
  "end_sleep_time": 2.0
}

Default Values

Action Typebefore_sleep_timeend_sleep_time
Interaction0.01.0
Extraction3.00.0
Assertion0.00.0
2FA0.00.0
Sleep times must be between 0 and 10 seconds.

Automation-Level Retries

max_retries on the automation reruns the entire automation when an unexpected error occurs (e.g. browser crash, network failure).
PropertyTypeDefaultDescription
max_retriesint0Total run attempts. 1 = no retry, 1 = one retry, etc.
{
  "url": "https://example.com",
  "max_retries": 3,
  "nodes": [ ... ]
}
AssertionError failures (e.g. failed assertions) are never retried regardless of max_retries. Retries only apply to unexpected runtime errors.

Element-Level Retry Configuration

Control how Optexity retries finding elements.
PropertyTypeDefaultDescription
max_triesint10Maximum retry attempts
max_timeout_seconds_per_tryfloat1.0Timeout per attempt
{
  "interaction_action": {
    "max_tries": 15,
    "max_timeout_seconds_per_try": 2.0,
    "click_element": { ... }
  }
}

How Retries Work

  1. Attempt to find element using command or xpath
  2. If not found within timeout, retry
  3. After all tries exhausted, use AI with prompt_instructions
  4. If AI can’t find it, action fails
Increase max_tries rather than timeout per try. This finds elements faster when they appear while still handling slow pages.

Handling New Tabs

expect_new_tab

Set when action opens a new browser tab:
{
  "type": "action_node",
  "interaction_action": {
    "click_element": {
      "command": "get_by_role(\"link\", name=\"Open Report\")"
    }
  },
  "expect_new_tab": true
}
When expect_new_tab=True:
  • max_new_tab_wait_time automatically set to 10.0
  • Automation waits for new tab
  • Focus switches to new tab

Common Patterns

Slow-Loading Pages

{
  "type": "action_node",
  "interaction_action": {
    "click_element": {
      "command": "get_by_role(\"button\", name=\"Search\")"
    }
  },
  "end_sleep_time": 5.0
}

Dynamic AJAX Content

{
  "type": "action_node",
  "interaction_action": {
    "max_tries": 15,
    "max_timeout_seconds_per_try": 1.0,
    "click_element": {
      "command": "get_by_text(\"Results loaded\")"
    }
  },
  "before_sleep_time": 2.0
}

Optional Elements

{
  "type": "action_node",
  "interaction_action": {
    "max_tries": 3,
    "click_element": {
      "command": "get_by_role(\"button\", name=\"Dismiss\")",
      "skip_prompt": true,
      "assert_locator_presence": true
    }
  }
}

Troubleshooting

SymptomLikely CauseSolution
”Element not found”Page not loadedIncrease before_sleep_time
Clicking wrong elementPage still loadingIncrease before_sleep_time
Missing extracted dataContent not renderedIncrease wait before extraction
Next action failsPrevious effect not readyIncrease end_sleep_time
Random failuresRace conditionsIncrease retries and timeouts

Best Practices

PracticeRecommendation
Start conservativeUse longer waits initially, optimize later
Use defaultsLet action-type defaults handle most cases
Wait before extractionEnsure page stability
Wait after navigationGive pages time to load
Increase retriesPrefer more tries over longer timeouts