[英]Jmeter Groovy webdriver By.xpath
I am using JMeter+Groovy and want to wait for the element to display in an UI, but it is failing with this error:我正在使用 JMeter+Groovy 并希望等待元素显示在 UI 中,但它因以下错误而失败:
2020-10-06 16:02:03,775 ERROR cgjpwsWebDriverSampler: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: By for class: Script42
2020-10-06 16:02:03,775 错误 cgjpwsWebDriverSampler: javax.script.ScriptException: groovy.lang.MissingPropertyException: 没有这样的属性: By for class: Script42
My code is:我的代码是:
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()
在脚本开始时为缺少的类添加导入:
import org.openqa.selenium.By;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.