我得到了
Warning: (143,13) 'WebDriverWait(org.openqa.selenium.WebDriver, long)' is deprecated
在 Selenium 4.0.0-alpha-3 中。
但是官方Selenium page仅列出
WebDriverWait(WebDriver driver, Clock clock, Sleeper sleeper, long timeOutInSeconds, long sleepTimeOut)
已弃用。
出了什么问题?我正在使用 IntelliJ,这可能是他们的问题吗?
最佳答案
它没有出现在文档中,但是如果您查看 source code您将看到@Deprecated
注释
@Deprecated
public WebDriverWait(WebDriver driver, long timeoutInSeconds) {
this(driver, Duration.ofSeconds(timeoutInSeconds));
}
在构造函数描述中你有解决方案
@deprecated Instead, use {@link WebDriverWait#WebDriverWait(WebDriver, Duration)}.
无论如何,这是从已弃用的构造函数中调用的构造函数。
new WebDriverWait(driver, Duration.ofSeconds(10));
关于java - WebDriverWait 在 Selenium 4 中已弃用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58993667/