The Search/getColumnData extension evaluates an XPath expression on the current browser document and returns the text content from all matching elements.
This is useful when a journey needs to collect visible column values, labels, table cells, or repeated page text from the DOM and use the extracted values in later validation steps.
Parameters:
-
XPathrequired, a string containing the XPath expression used to select elements from the current HTML document;
Note: The input must be a valid XPath expression. The extension reads textContent from matched DOM nodes, so returned values may include hidden text, spacing, or newline characters present in the selected elements.
NLP usage
Use the extension in a journey by calling Search/getColumnData with the execute command. Pass the XPath value to the matching extension input using as XPath.
Note: The extension runs against the page currently loaded in the browser. If the target elements are loaded dynamically, wait for the page or table content to be available before executing the extension.
execute "Search/getColumnData" using "//table//tr/td[2]" as XPath returning $columnValuesexecute "Search/getColumnData" using "//*[@data-testid='status-column']" as XPath returning $statusValuesYou can also pass the XPath from a variable when the selector is stored earlier in the journey.
execute "Search/getColumnData" using "$columnXPath" as XPath returning $columnValuesstore value "//table//tr/td[2]" in $columnXPath
execute "Search/getColumnData" using "$columnXPath" as XPath returning $columnValuesExample output when multiple elements match the XPath:
[
"Customer Name",
"Policy Number",
"Status"
]This extension does not require any external resource.
The extension should be configured as:
- Run asynchronously: No
- Scope: Global
Limitation: This extension depends on the browser DOM and only checks elements available in the current document when it runs. It does not wait for lazy-loaded content, does not search inside inaccessible iframes or closed shadow DOM, and returns raw textContent without trimming or normalising whitespace. If no element matches, it returns the string No matching elements found; if one or more elements match, it returns an array of text values.
Add the extension to your Virtuoso instance
Select the domain that matches your Virtuoso account.
View source
Last updated: 25/05/2026
Resources:
This extension does not require any external resource.
let elements
try {
elements = document.evaluate(XPath, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null)
} catch (error) {
throw new Error("Invalid XPath expression")
}
let values = []
let alert = ""
if (elements.snapshotLength === 0) {
alert = "No matching elements found"
} else if (elements.snapshotLength === 1) {
values.push(elements.snapshotItem(0).textContent)
alert = values
} else {
for (let i = 0;i < elements.snapshotLength;i++) {
let element = elements.snapshotItem(i)
values.push(element.textContent)
}
alert = values
}
return(alert)
Comments
0 comments
Please sign in to leave a comment.