如何使用 Http Request Sampler 来点击复选框

How to use Http Request Sampler to click on a checkbox

我有一个 HTML 呈现的页面,我需要在其中访问 <tr class="width-full" selected> 请参阅下面的完整图片:

所以当复选框被选中时,我们有:

<tr class="width-full" selected>

如果没有选择,它的:

<tr class="width-full">

如何使用 HTTP 采样器点击复选框,也许使用 XPath 或 CSSSelector? 不确定我将如何从

根据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).

所以 JMeter 实际上并没有“点击”任何东西。

因此,如果“点击”触发 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 采样器)

如果“点击”没有触发网络请求 - 您将无法使用 JMeter 执行此操作(除非您想通过 WebDriver Sampler which provides JMeter integration with Selenium 浏览器自动化框架启动真正的浏览器)