In order to add an XPath Extractor to your JMeter script you need to begin by installing JMeter and create an HTTP Request. If you want to check how you can create a load test with Apache JMeter, please check our previous blog post.
Start by adding a XPath Extractor to your HTTP Request by following the below steps:
Are Your APIs as Reliable as You Think?
Don’t let hidden issues disrupt your service. With LoadFocus’s advanced API Monitoring, catch problems before they impact your users. Ensure flawless performance and avoid costly outages—monitor, test, and optimize your APIs effortlessly.
- Select the HTTP Request on the left side, and Right-click it
- Hover to Add -> Post Processors -> XPath Extractor
- Click on XPath Extractor
Update the XPath Extractor with the desired variable names and expected XPath. We are going to make an HTTP Request to https://example.com/ and based on the HTML response, we are going to extract the H1 tag from the website and use it in the next request.
Update the XPATH Extractor with the following details:
Think your website can handle a traffic spike?
Fair enough, but why leave it to chance? Uncover your website’s true limits with LoadFocus’s cloud-based Load Testing for Web Apps, Websites, and APIs. Avoid the risk of costly downtimes and missed opportunities—find out before your users do!
- Reference Name: The name of the JMeter variable in which to store the result, var1
- XPath Query: Element query in XPath language. Can return more than one match, //html//h1
- Default Value: Default value returned when no match found. It is also returned if the node has no value and the fragment option is not selected, NOTFOUND
In order to run load tests with thousands of threads (users) and to run load tests from different world locations, you can use LoadFocus.com which offers a cloud load testing service, easy to use, which keeps all your tests and test runs in the history automatically.