CSS/jQuery Extractor usage
CSS/jQuery
Extractor usage:
JMeter offers CSS/jQuery
Extractor that allows you to extract server responses using a
CSS/jQuery-like syntax.
In this example, let us see how to use the CSS/jQuery Extractor component to extract information from server responses.
Steps:
- Launch JMeter.
- Create a Simple Testplan as
below:
3.
Add Thread Group, then
HTTP Request
- Add CSS/JQuery
Expression Extractor by navigating to Request | Add | Post
Processor | CSS/JQuery Extractor.
- Fill in the values as follows:
The Response data for the HTTP Request have the below:
<div class='entry'>
<h3>Must
be heavy baby. This and that...</h3>
<p>Thoughts on Scala</p>
<p>Posted by tom</p>
</div>
<div class='entry'>
<h3>Lorem ipsum dolor sit amet</h3>
<p>Another Post</p>
<p>Posted by jim</p>
</div>
And so on.
Using CSS/JQuery we will capture text with <h3> tag
6.
Save and run the script.
- Open Debug Sampler and
check whether the expression matches the intended query. This is
shown in the following screenshot:
Note: Compared to Regular Expression Extractor, CSS/jQuery
Extractor is resource-intensive as it does a complete HTML parse of the
document to perform its work. Prefer Regular Expression Extractor.
Comments
Post a Comment