Skip to main content

Overview

Captures extract values from a step’s result and store them as variables for use in subsequent steps. Add a captures array to any step.

Example

steps:
  - ordinal: 0
    description: "Navigate to order page"
    action:
      type: navigate
      url: "https://app.example.com/orders/123"
    url: "https://app.example.com/orders/123"
    riskLevel: low
    requiresConfirmation: false
    captures:
      - name: orderId
        strategy: url
        pattern: "/orders/(\\d+)"
        group: 1
      - name: pageTitle
        strategy: snapshot
        description: "Page heading text"
      - name: totalAmount
        strategy: ai
        prompt: "What is the total order amount displayed on the page?"

Capture fields

FieldTypeRequiredDescription
namestringYesVariable name to store the captured value
strategyCaptureStrategyYesExtraction method (see below)
descriptionstringNoHuman-readable description
requiredbooleanNoIf true, step fails when capture returns empty (default: false)
patternstringNoRegex pattern for text extraction
groupintegerNoRegex capture group index (0-based)
promptstringNoAI prompt for ai strategy
expressionstringNoTemplate expression for expression strategy

Capture strategies

snapshot

Capture a value from the current page DOM. Use pattern to extract a substring.
captures:
  - name: confirmationCode
    strategy: snapshot
    description: "Confirmation code shown after submission"
    pattern: "Code:\\s*(\\w+)"
    group: 1

url

Extract from the current page URL.
captures:
  - name: orderId
    strategy: url
    pattern: "/orders/(\\d+)"
    group: 1

ai

Use AI to extract a value from the page. Provide a prompt describing what to extract.
captures:
  - name: statusMessage
    strategy: ai
    prompt: "What is the status message displayed in the alert banner?"

expression

Evaluate a template expression. Useful for transforming or combining captured values.
captures:
  - name: fullUrl
    strategy: expression
    expression: "https://app.example.com/orders/{{orderId}}"

evaluate

Run JavaScript in the page context and capture the result.
captures:
  - name: itemCount
    strategy: evaluate
    expression: "document.querySelectorAll('.item-row').length.toString()"

Using captured values

Captured values are available as template variables in subsequent steps:
steps:
  - ordinal: 0
    description: "Extract order ID from URL"
    action:
      type: navigate
      url: "https://app.example.com/orders/123"
    url: "https://app.example.com/orders/123"
    riskLevel: low
    requiresConfirmation: false
    captures:
      - name: orderId
        strategy: url
        pattern: "/orders/(\\d+)"
        group: 1
  - ordinal: 1
    description: "Navigate to order details"
    action:
      type: navigate
      url: "https://app.example.com/orders/{{orderId}}/details"
    url: "https://app.example.com/orders/{{orderId}}/details"
    riskLevel: low
    requiresConfirmation: false

Regex patterns

When using pattern, the value must be a valid regular expression. Use group to select a specific capture group:
  • group: 0 — Entire match (default)
  • group: 1 — First capture group
  • group: 2 — Second capture group
captures:
  - name: price
    strategy: snapshot
    pattern: "\\$([\\d,]+\\.\\d{2})"
    group: 1
    # Captures "1,234.56" from "$1,234.56"