Jmeter webdriver wait函数-无法使用构造函数org.openqa.selenium.support.



我正在尝试使用JMeter Selenium Webdriver等待功能,但得到错误输出-

ERROR c.g.j.p.w.s.WebDriverSampler: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: wait for class: Script2
import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriverService;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import static org.openqa.selenium.support.ui.WebDriverWait.*;
import static org.openqa.selenium.support.ui.ExpectedConditions.*
import org.openqa.selenium.support.ui.*;
import openqa.selenium.OutputType.*;  
WDS.sampleResult.sampleStart()

WDS.browser.get(page)
//Thread.sleep(2000);
wait.until(ExpectedConditions.visibilityOfElementLocated(org.openqa.selenium.By.id("email")));

我使用最新版本的Jmeter(5.5)和最新的selenium webdriver支持包(4.5.1)。这在以前是可行的。有人能帮帮忙吗?谢谢! !

您忘记复制和粘贴一个重要的命令- WebDriverWait初始化:

WebDriverWait wait = new WebDriverWait(WDS.browser, java.time.Duration.ofSeconds(5))

JMeter: Apache Groovy: What Is Groovy Used For?

相关内容

最新更新