Home > Software engineering >  How to use Http Request Sampler to click on a checkbox
How to use Http Request Sampler to click on a checkbox

Time:03-24

I have an HTML rendered page, in which I need to access <tr selected> see full picture below: enter image description here

so when the checkbox is selected we have:

<tr  selected>

and when not selected, its:

<tr >

How can I use an HTTP sampler to click on the checkbox, perhaps using XPath or CSSSelector? not sure how I would traverse from <input to <tr and force "selected"

CodePudding user response:

As per JMeter project main page:

JMeter is not a browser, it works at protocol level. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever displayed at a time).

so JMeter doesn't actually "click" anything.

So if "clicking" triggers a HTTP request (you can check it using "Network" tab of your browser developer tools) - you can simulate the same request using JMeter's HTTP Request sampler)

If the "click" doesn't trigger the network request - you won't be able to do this using JMeter (unless you want to kick off a real browser via WebDriver Sampler which provides JMeter integration with Selenium browser automation framework)

  • Related