Reputation: 1783
I need to parse a html page that can contain multiple (unspecified how many) links. Here an example (pseudo html):
<a href="../entrygroups/GROUPIDENTIFIER/3">edit</a>
[...]
<a href="../entrygroups/GROUPIDENTIFIER/7">edit</a>
[...]
<a href="../entrygroups/GROUPIDENTIFIER/12">edit</a>
[...]
<a href="../entrygroups/GROUPIDENTIFIER/16">edit</a>
I am basically just interested in the numbers 3
,7
,12
,16
of the url.
Is there a way to put those values into some sort of array and loop over them (in a for each kind of way).
Is this possible and if so, how would I do this? I looked at the regular expression extractor but it seems that that one can only assign a fixed set of groups to a fixed set of variables.
Upvotes: 1
Views: 5063
Reputation: 168092
Extract the values using Regular Expression Extractor configured like:
Add ForEach Controller configured like:
Refer the "GROUPIDENTIFIER" value as ${current_edit}
where required
See Using Regular Expressions in JMeter guide for another example of looping through all links found in the page with the Regular Expression Extractor and ForEach Controller.
Upvotes: 4
Reputation: 13980
Actually RegEx extractor is able to do exactly what you want, if you specify Match No. field with less than 0, e.g. -1:
As a result, you will get N variables (using your input as example):
id_1=3
id_2=7
id_3=12
id_4=16
There also will be variable which has a count of matches:
id_matchNr=4
Upvotes: 2