如何单击:: element(Groovy,jmeter)?

发布于 2025-01-30 05:37:48 字数 898 浏览 3 评论 0原文

我用Groovy在Jmeter的客户端工作,并有这种情况:

要使提交按钮处于活动状态,我只需要在脚本中的上一步上模拟此复选框即可。

您能否让我知道,使用此元素之前的::指向 /打开此复选框的方法是什么?

//既不

// input [ @class ='checkbox'和 @name ='goomection']

wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@class='checkbox' and @name='Information']")));

WebElement checkbox_Information = driver.findElement(By.xpath("//input[@class='checkbox' and @name='Information']"));

checkbox_Information.click();

nor

// label [ @class ='checkbox -label'和 @for ='groundy'

]消息,例如:

响应消息:javax.script.scriptexception:javax.script.scriptexception:org.openqa.selenium.timeoutexception:预期条件失败:等待元素可单击: '复选框'和 @name ='信息'](用500毫秒间隔尝试30秒)

I work on client-side in JMeter with groovy and have this situation:
enter image description here

To make SUBMIT button active, I just need to emulate checking this checkbox on previous step in the script.

Could you please let me know, what are the ways to point to / switch on this checkbox, using this ::before element?

Neither

//input[@class='checkbox' and @name='Information']

wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@class='checkbox' and @name='Information']")));

WebElement checkbox_Information = driver.findElement(By.xpath("//input[@class='checkbox' and @name='Information']"));

checkbox_Information.click();

nor

//label[@class='checkbox-label' and @for='Information']"

could help - in both cases here are error messages, for example:

Response message:javax.script.ScriptException: javax.script.ScriptException: org.openqa.selenium.TimeoutException: Expected condition failed: waiting for element to be clickable: By.xpath: //input[@class='checkbox' and @name='Information'] (tried for 30 second(s) with 500 milliseconds interval)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

弄潮 2025-02-06 05:37:48

如果您:

  1. 请勿将代码邮寄为图像
  2. “错误消息”
  3. 显示(至少部分)

到目前为止您的代码,如果您谈论的是jmeter的 webdriver采样器您可以尝试:

  1. 确保可见复选框,不被弹出窗口覆盖和可单击

  2. usu an 明确等待确保可以与

    进行交互的复选框

  3. ,如果没有任何帮助,则可以使用 javascript ,类似:

      wds.browser.executescript('document.getElementById(“ information”)。click();')
     

The chance of getting a comprehensive response will be much hire if you:

  1. Don't post code as an image
  2. Provide these "errors messages"
  3. Show (at least partially) your code

So far if you're talking about JMeter's WebDriver Sampler you can try:

  1. Ensuring that the checkbox is visible, not covered by popups and clickable

  2. Usu an Explicit Wait to ensure that the checkbox can be interacted with

  3. And if nothing helps as the last resort you can "click" the checkbox using JavaScript, something like:

    WDS.browser.executeScript('document.getElementById("Information").click();')
    
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文