In JMeter, HTML Link Parser is a preprocessor which parses the HTML response and extracts the HTML links and data to use them dynamically. This HTML Link Parser reduces the overhead of inputting data manually. No need to create a huge list of data for a dropdown or radio button for creating a scenario where different bots use different values. The PreProcessor modifies the HTTP request by supplying the value which it has parsed from the HTTP response.
Let’s you have a scenario where you need to render the website dynamically which means each user will visit 5 random pages. Then the easiest way in Apache JMeter is to use HTML Link Parser PreProcessor.
How to use it?
- Add a sampler under the thread group
- Provide the address of the website (application) in ‘Server Name or IP’
- Add another sampler, provide the same address of the website (application) in ‘Server Name or IP’ and ‘.*’ (dot asterisk) as a value in the ‘Path’ attribute
- Add HTML Link Parser PreProcessor under the second sampler (which is added in 3rd point)
- Add a listener and run the thread. I ran the thread for 3 iterations (Refer to GIF)
How does HTML Link Parser work?
HTML Link Parser PreProcessor extracts all the HTML links from the response of the previous request and then passes the random link to the successive request (under which HTML Link Parser is added as a child element).
How to add ‘HTML Link Parser’?
You can follow below steps:
- Select the ‘Sampler’ element (where you want to pass a dynamic HTML link).
- Right-click on the sample
- Hover the mouse on ‘Add’
- Hover the mouse on ‘PreProcessor’
- Click ‘HTML Link Parser’
What are the inputs of ‘HTML Link Parser’?
‘HTML Link Parser’ has the following attributes:
- Name: To provide the name of the preprocessor
- Comments: To provide arbitrary comments (if any)
You may be interested:
- Performance Testing Tutorial
- Performance Engineering Tutorial
- Micro Focus LoadRunner Tutorial
- NeoLoad Tutorial