JMeter – HTML Link Parser

JMeter - HTML Link Parser

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 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. 

Practical Example:

Let’s you have a scenario where you need to render the website dynamically that 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?

  1. Add a sampler under thread group
  2. Provide the address of the website (application) in ‘Server Name or IP’
  3. Add another sampler, provide the same address of the website (application) in ‘Server Name or IP’ and ‘.*’ (dot asterisk) as a value in ‘Path’ attribute
  4. Add HTML Link Parser PreProcessor under the second sampler (which is added in 3rd point)
  5. Add a listener and run the thread. I ran the thread for 3 iterations (Refer GIF)
JMeter - HTML Link Parser

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:

  1. Select the ‘Sampler’ element (where you want to pass a dynamic HTML link).
  2. Right-click on the sample
  3. Hover the mouse on ‘Add’
  4. Hover the mouse on ‘PreProcessor’
  5. 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)

Leave a Reply

Your email address will not be published. Required fields are marked *