Book Image

JMeter Cookbook

By : Bayo Erinle
Book Image

JMeter Cookbook

By: Bayo Erinle

Overview of this book

Table of Contents (16 chapters)
JMeter Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using XPath Extractor


When it comes to dealing with XML or (X)HTML, JMeter comes bundled with an XPath Extractor component that allows you to extract matches from XML server responses using an XPath query language. For instance, extracting the title of a standard HTML structure can be accomplished using html/head/title, getting all the paragraphs can be accomplished using body/p, and so on. Moreover, when dealing with web services, particularly SOAP services, XMLs are used heavily as a means of exchange. This component is a perfect fit for handling such responses and extracting the needed information.

How to do it…

In this recipe, we will cover how to use XPath Extractor to handle XML server responses. Perform the following steps:

  1. Launch JMeter.

  2. Open the ch2_xpath_extractor.jmx test script located in the scripts/ch2 directory.

  3. Open the HTTP request labeled add_xpath_extractor_here.

  4. Add XPath Extractor to it by navigating to Request | Add | Post Processor | XPath Extractor.

  5. Fill in the values as...