In Jmeter, in addition to regular expressions can be used as associations, there is another way to do associations, that is XPath Extractor. It uses xpath to extract key information and pass variables.
specific usage
Add a post processor - XPath Extractor
Actual operation
Take Tencent News as an example, let's do a drill. We made a request to Tencent News and observed the results.
Now I want to use xpath to take out these urls, let's write an xpath expression to match. It was found that the urls were all matched.
.//a[@class='linkto']/@href What exactly does it mean? It means to perform a step-by-step search through the three-layer tags of a>class>href, find all hrefs under the class=linkto tag, and match them
Here what if I want to match the text title under the href tag? Let's change the expression -- .//a[@class='linkto'], we found that the title is taken out, and we can splicing it later
Now that there is no problem with the expression, we hang the added xpath extractor below the http request. Add a debug to view the results, you can see that these urls have been obtained in the debug
We can add two xpath extractors to extract the url and title respectively for assembly, and run to view the results
Finally, a picture is used to describe the above expression, I hope everyone can understand!
refer to
https://blog.csdn.net/gongbing798930123/article/details/78955597
https://www.blazemeter.com/blog/using-xpath-extractor-jmeter-0
Longyuan Pavilion test home: 317765580