【问题标题】:Jmeter Groovy webdriver By.xpathJmeter Groovy webdriver By.xpath
【发布时间】:2020-10-06 05:02:39
【问题描述】:

我正在使用 JMeter+Groovy 并希望等待元素在 UI 中显示,但它失败并出现以下错误:

2020-10-06 16:02:03,775 错误 c.g.j.p.w.s.WebDriverSampler: javax.script.ScriptException: groovy.lang.MissingPropertyException: 没有这样的属性:对于类:Script42

我的代码是:

import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait

def wait = new WebDriverWait(WDS.browser,5000);

WDS.sampleResult.sampleStart(); 
WDS.browser.get('https://google.com/');
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(".//input[@name='q']")));
WDS.sampleResult.sampleEnd()  

【问题讨论】:

    标签: selenium-webdriver groovy jmeter jmeter-plugins


    【解决方案1】:

    在脚本开始时为缺少的类添加导入:

    import org.openqa.selenium.By;
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-06
    • 2017-04-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多