Skip to main content

XPath capture

I capture the <nodeType> in <xmlRef> by xpath "<expression>" as <name>

Captures XML content from a referenced XML string using the given XPath expression and binds it to the given name in the global scope.

Where

  • <nodeType> is one of:

    • text to capture the text node
    • node to capture a single node
    • nodeset to capture multiple nodes
  • <xmlRef> is the name of the binding containing the XML text

    • Can be the name of any binding that contains or resolves to an XML text value, including a web element in which case the text in the element will be dynamically retrieved and used.
  • <expression> is the XPath selector expression
  • <name> is the name to bind the captured value to

Example

  Given the xml is "<result><status>passed</status></result>"
When I capture the text in the xml by xpath "//result/status" as the status
Then the status should be "passed"
I capture the <nodeType> in <element> by xpath "<expression>" as <name>

Captures XML content from a web element using the given XPath expression and binds it to the given name in the global scope.

Where

  • <nodeType> is one of:

    • text to capture the text node
    • node to capture a single node
    • nodeset to capture multiple nodes
  • <element> is the name of the element containing the XML content
  • <expression> is the XPath selector expression
  • <name> is the name to bind the captured value to

Example

  # assuming a web element contains xml: <result><status>passed</status></result>
Given the xml web element can be located by id "xml"
When I capture the text in the xml web element by xpath "//result/status" as the status
Then the status should be "passed"