Skip to content

__XPath

JMeter __XPath function reference: syntax, parameters, and practical examples for parameterizing test plans with dynamic values.

Difficulty
intermediate
Guide type
reference
Estimated read time
1 min read
Last verified version
Verified JMeter 5.6

Also documented in context in the full Functions and Variables reference.

The XPath function reads an XML file and matches the XPath. Each time the function is called, the next match will be returned. At end of file, it will wrap around to the start. If no nodes matched, then the function will return the empty string, and a warning message will be written to the JMeter log file.

Example:

Terminal window
\${__XPath(/path/to/build.xml, //target/@name)}

This will match all targets in build.xml and return the contents of the next name attribute

NameRequiredDescription
XML file to parseYesa XML file to parse
XPathYesa XPath expression to match nodes in the XML file
On this page