selenium - 无法使用直到 WebDriverWait 的方法
问题描述
我收到以下错误:
The method until(Function<? super WebDriver,V>) in the type FluentWait<WebDriver> is not applicable for the arguments (ExpectedCondition<Boolean>)
我的代码是这样的:
try {
WebDriverWait wait = new WebDriverWait(getDriver(), 60);
wait.until(
ExpectedConditions.invisibilityOfElementLocated(By.cssSelector("div[class='ui-block']")));
} catch (Exception e) {
e.printStackTrace();
}
我的 pom.xml 依赖项如下所示:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.141.59</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>3.141.59</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>3.141.59</version>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>4.2.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.48</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.0.0</version>
</dependency>
我试图寻找这个错误并知道它是由于番石榴依赖性问题,我把它做成了最新的 25-jre 和 21。但没有帮助。有人可以提出解决方案吗?
解决方案
这是兼容性问题。要解决它,您可以使用 Guava 版本 21 + selenium 版本 3.2.0 + JDK 8。
有关更多详细信息,您可以查看以下链接:
我希望它会帮助你。
推荐阅读
- java - 火库;添加用户电子邮件标识符而不创建集合
- vba - 将 TXT 导入 Access 时添加字段
- javascript - 如何在打字稿中指定枚举索引的类型
- react-native - 边框半径因宽度和颜色而异 - React Native
- javascript - 防止 IE11 中的 Ctrl+F4 默认浏览器操作事件
- sql - 为什么选择子查询中的无效字段可以在 BigQuery 中运行?
- azure - Azure 函数,延迟
- globalization - TEIID 中的 Unaccent() 函数替代
- java - Firestore:从查询中获取参数
- php - 如何转换为 unicode 转义?