Skip to main content

How to Data-Drive Xpaths

In some scenarios, the XPath used by an accessor may need to be dynamically generated based on test data. Test Designer supports data-driven XPaths by using variables within the XPath expression.

The following example shows how to use a variable as part of an XPath:

byXPath("//*[@id='" + $Test + "']")

In this example, $Test is replaced with the value provided by the test data, allowing the same accessor to interact with different elements during test execution.