java - WebDriverWait 在 Selenium 4 中已弃用

标签 java selenium selenium-webdriver webdriverwait selenium4

我得到了

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/

相关文章:

java - 这个算法的大O复杂度是多少

java - SimpleDateFormat 不识别月份

java - 如何在android中以分钟和秒为单位获取音频长度

来自 django 文档的 Python selenium Web 驱动程序示例错误 : 'f.QueryInterface is not a function'

python - 为什么当元素存在时, Selenium 会超时

angularjs - 无法通过 Protractor JS 在 IE11 上运行多重兼容性测试

python - 如何在 Catalina 上使用带有 Selenium 的 Brave Web 浏览器?

java - Elasticsearch postfiler 取消过滤器

java - 使用Java和Selenium后如何找到 Canvas 上按钮的坐标并单击它们?

java - 如何使用网络驱动程序关闭网页上的模式对话框 - Java