Skip to main content

Overview

The Get Text node (Element Query node) extracts information from web page elements including text content, attributes, element counts, visibility states, and bounding boxes. Results are stored in the workflow context for use in subsequent nodes.

Actions

getText

Extract text content from an element.
outputVariable
string
default:"text"
Context variable name to store the extracted text.

getAttribute

Extract an attribute value from an element.
attributeName
string
required
Name of the attribute to extract (e.g., href, src, class, data-id).Supports variable interpolation: ${data.attrName}
outputVariable
string
default:"attribute"
Context variable name to store the attribute value.

getCount

Count the number of elements matching the selector.
outputVariable
string
default:"count"
Context variable name to store the count.

isVisible

Check if an element is visible on the page.
outputVariable
string
default:"isVisible"
Context variable name to store the boolean result.

isEnabled

Check if an element is enabled (not disabled).
outputVariable
string
default:"isEnabled"
Context variable name to store the boolean result.

isChecked

Check if a checkbox or radio button is checked.
outputVariable
string
default:"isChecked"
Context variable name to store the boolean result.

getBoundingBox

Get the element’s position and size.
outputVariable
string
default:"boundingBox"
Context variable name to store the bounding box object {x, y, width, height}.

getAllText

Extract text content from all elements matching the selector.
outputVariable
string
default:"text"
Context variable name to store the array of text strings.

Configuration

selector
string
required
Element selector to query. Supports variable interpolation: ${data.elementSelector}
action
string
required
Action to perform: getText, getAttribute, getCount, isVisible, isEnabled, isChecked, getBoundingBox, or getAllText
selectorType
string
default:"css"
Type of selector: css, xpath, text, getByRole, getByText, getByLabel, etc.
selectorModifiers
object
Advanced selector modifiers.Properties:
  • nth: Select nth element (0-based)
  • filterText: Filter by text content
  • filterSelector: Filter by child selector
  • chainSelector: Scoped sub-query
timeout
number
default:"30000"
Maximum time in milliseconds to wait for the element.
failSilently
boolean
default:"false"
If true, errors don’t stop workflow execution.

Advanced Features

Waiting

waitForSelector
string
Wait for another element before/after extraction.
waitForUrl
string
Wait for URL to match pattern.
waitForCondition
string
Wait for JavaScript condition to be true.
waitAfterOperation
boolean
default:"false"
Execute waits after extraction instead of before.

Retry Logic

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

Extract Text

{
  "type": "elementQuery",
  "data": {
    "action": "getText",
    "selector": "h1.title",
    "outputVariable": "pageTitle"
  }
}

Extract Attributes

{
  "type": "elementQuery",
  "data": {
    "action": "getAttribute",
    "selector": "a.download-link",
    "attributeName": "href",
    "outputVariable": "downloadUrl"
  }
}

Check Element State

{
  "type": "elementQuery",
  "data": {
    "action": "isVisible",
    "selector": ".error-message",
    "outputVariable": "hasError"
  }
}

Count Elements

{
  "type": "elementQuery",
  "data": {
    "action": "getCount",
    "selector": ".list-item",
    "outputVariable": "itemCount"
  }
}

Get Bounding Box

Element Position
{
  "type": "elementQuery",
  "data": {
    "action": "getBoundingBox",
    "selector": "#modal-dialog",
    "outputVariable": "modalBounds"
  }
}

Advanced Selectors

{
  "type": "elementQuery",
  "data": {
    "action": "getText",
    "selector": ".product-card",
    "selectorModifiers": {
      "nth": 2
    },
    "outputVariable": "thirdProduct"
  }
}

With Wait and Retry

Resilient Extraction
{
  "type": "elementQuery",
  "data": {
    "action": "getText",
    "selector": ".dynamic-content",
    "outputVariable": "content",
    "waitForSelector": ".loaded",
    "retryEnabled": true,
    "retryCount": 3,
    "retryDelay": 1000
  }
}

Accessing Extracted Data

Extracted data is stored in the workflow context and can be accessed in subsequent nodes:
const title = context.getData('pageTitle');
const count = context.getData('itemCount');
const bounds = context.getData('modalBounds');

console.log(`Found ${count} items`);
console.log(`Modal at: ${bounds.x}, ${bounds.y}`);

Output Data Types

ActionOutput TypeExample
getTextstring"Product Title"
getAttributestring | null"https://example.com"
getCountnumber42
isVisiblebooleantrue
isEnabledbooleanfalse
isCheckedbooleantrue
getBoundingBoxobject{x: 100, y: 200, width: 300, height: 150}
getAllTextstring[]["Item 1", "Item 2", "Item 3"]

Notes

The getText action returns the text content, not the HTML. Use getAttribute with innerHTML or outerHTML to get HTML content.
If an element is not found, getAttribute returns null and getText returns an empty string. Use getCount first to check if elements exist.
The getAllText action is useful for extracting data from lists, tables, or multiple similar elements on a page.

Common Patterns

Extract and Validate

[
  {
    "type": "elementQuery",
    "data": {
      "action": "getText",
      "selector": ".success-message",
      "outputVariable": "message"
    }
  },
  {
    "type": "verify",
    "data": {
      "domain": "browser",
      "verificationType": "text",
      "expectedValue": "Success",
      "actualValue": "${data.message}"
    }
  }
]

Conditional Logic

const itemCount = context.getData('itemCount');
if (itemCount > 10) {
  context.setData('shouldPaginate', true);
}

Build docs developers (and LLMs) love