Skip to main content

Overview

The Wait node pauses workflow execution until specific conditions are met. It supports waiting for fixed timeouts, element appearance, URL patterns, JavaScript conditions, and API response criteria. It’s essential for handling dynamic content, asynchronous operations, and timing control.

Wait Types

timeout

Wait for a fixed duration.
value
number
required
Duration in milliseconds to wait.
Example:
{
  "waitType": "timeout",
  "value": 5000
}
// Waits 5 seconds

selector

Wait for an element to appear and become visible.
value
string
required
Element selector to wait for. Supports variable interpolation.
selectorType
string
default:"css"
Selector type: css, xpath, text, getByRole, etc.
selectorModifiers
object
Advanced selector modifiers.
timeout
number
default:"30000"
Maximum time to wait for the element.
Example:
{
  "waitType": "selector",
  "value": ".content-loaded",
  "selectorType": "css",
  "timeout": 10000
}

url

Wait for the page URL to match a pattern.
value
string
required
URL pattern to match. Supports regex patterns.
timeout
number
default:"30000"
Maximum time to wait for URL match.
Example:
{
  "waitType": "url",
  "value": ".*dashboard.*",
  "timeout": 15000
}

condition

Wait for a JavaScript condition to become truthy.
value
string
required
JavaScript expression to evaluate. When it returns a truthy value, waiting stops.
timeout
number
default:"30000"
Maximum time to wait for the condition.
Example:
{
  "waitType": "condition",
  "value": "document.querySelector('.loading') === null",
  "timeout": 20000
}

api-response

Wait for and validate an API response.
apiWaitConfig
object
required
Configuration for API response validation.Properties:
  • contextKey: Context variable containing the API response
  • checkType: What to check - status, header, body-path, body-value
  • path: JSON path or header name (for header and body-path checks)
  • expectedValue: Expected value
  • matchType: How to match - equals, contains, startsWith, endsWith, regex
Example:
{
  "waitType": "api-response",
  "value": "apiResponse",
  "apiWaitConfig": {
    "contextKey": "apiResponse",
    "checkType": "status",
    "expectedValue": 200,
    "matchType": "equals"
  }
}

Configuration

waitType
string
required
Type of wait: timeout, selector, url, condition, or api-response
pause
boolean
default:"false"
If true, pauses execution indefinitely until user continues (debug mode). Not supported in parallel execution.
failSilently
boolean
default:"false"
If true, timeout errors log warnings but don’t stop workflow execution.

Retry Configuration

retryEnabled
boolean
default:"false"
Enable automatic retry on failure.
retryCount
number
default:"3"
Number of retry attempts.
retryDelay
number
default:"1000"
Delay between retries in milliseconds.

Examples

Timeout Waits

{
  "type": "wait",
  "data": {
    "waitType": "timeout",
    "value": 3000
  }
}

Element Waits

{
  "type": "wait",
  "data": {
    "waitType": "selector",
    "value": "#main-content",
    "selectorType": "css",
    "timeout": 10000
  }
}

URL Waits

{
  "type": "wait",
  "data": {
    "waitType": "url",
    "value": "https://example.com/success",
    "timeout": 10000
  }
}

Condition Waits

{
  "type": "wait",
  "data": {
    "waitType": "condition",
    "value": "document.querySelector('.loading-spinner') === null",
    "timeout": 30000
  }
}

API Response Waits

{
  "type": "wait",
  "data": {
    "waitType": "api-response",
    "value": "apiResponse",
    "apiWaitConfig": {
      "contextKey": "apiResponse",
      "checkType": "status",
      "expectedValue": 200,
      "matchType": "equals"
    }
  }
}

Pause for Debugging

Debug Pause
{
  "type": "wait",
  "data": {
    "waitType": "timeout",
    "value": 1000,
    "pause": true
  }
}
// Pauses execution until user clicks Continue button

With Retry

Resilient Wait
{
  "type": "wait",
  "data": {
    "waitType": "selector",
    "value": ".dynamic-element",
    "timeout": 5000,
    "retryEnabled": true,
    "retryCount": 3,
    "retryDelay": 2000
  }
}

Fail Silently

Optional Wait
{
  "type": "wait",
  "data": {
    "waitType": "selector",
    "value": ".optional-modal",
    "timeout": 3000,
    "failSilently": true
  }
}

Common Patterns

Wait After Action

[
  {
    "type": "action",
    "data": {
      "action": "click",
      "selector": "button.submit"
    }
  },
  {
    "type": "wait",
    "data": {
      "waitType": "url",
      "value": ".*success.*",
      "timeout": 10000
    }
  }
]

Wait for Multiple Conditions

[
  {
    "type": "wait",
    "data": {
      "waitType": "selector",
      "value": ".content-loaded"
    }
  },
  {
    "type": "wait",
    "data": {
      "waitType": "condition",
      "value": "document.readyState === 'complete'"
    }
  }
]

Polling Pattern

// Use in loop with API wait
for (let i = 0; i < 10; i++) {
  // Check API status
  // Wait 5 seconds
  // Repeat until success
}

Wait Strategies

StrategyUse CaseExample
timeoutFixed delaysAnimation completion
selectorDynamic contentAJAX-loaded elements
urlNavigationPage redirects
conditionComplex logicMultiple element states
api-responseAPI validationAsync operations

Notes

The selector wait type waits for elements to be both present in the DOM and visible on the page.
The pause parameter is only supported in single workflow execution mode. In parallel execution, pause is automatically skipped with a warning.
JavaScript conditions in condition type waits have access to the full browser context including window, document, and global variables.

Best Practices

// Prefer selector/condition over timeout
{
  "waitType": "selector",
  "value": ".loaded"
}
// Better than:
{
  "waitType": "timeout",
  "value": 5000
}

Build docs developers (and LLMs) love