Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

This video tutorial demonstrates, how you may use XPath in vREST:

XPath is used to locate the data in XML object. XPath is currently used in the following two functionalities of vREST:

  1. Variable Extractor tab
    In variable extractor tab of a test case, you need to specify the x-path in "JSON Path / XML PATH / Utility Method" column.
  2. XML Body Assertions
    In Assertions tab, you need to specify  XPath for XML Body assertions in "Property" column.

Below are some examples of most common scenarios for XML path expressions.


<?xml version="1.0"?>
   <book id="book1">
      <author>Author Name 1</author>
      <title>Book Title 1</title>
      <genre>Book Genre</genre>
      <description>Book Description...</description>
   <book id="book2">
      <author>Author Name 2</author>
      <title>Book Title 2</title>
      <genre>Book Genre</genre>
      <description>Book Description ...</description>


  1. Accessing Node Attribute (Id of first book)
    1. XPath Expression: /catalog/book[1]/@id
    2. Value: book1
  2. Accessing Node Text Content (Author of first book)
    1. XPath Expression: /catalog/book[1]/author/text()
    2. Value: Author Name 1
  • No labels