使用Java做selenium
自動化測試時,引入pom.xml
文件
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
Java代碼調用WebDriver
驅動時
Wait(driver).until(windowToBeAvailableAndSwitchToIt(target))
可能會報如下的錯誤
The method until(Function<? super WebDriver,V>) in the type FluentWait<WebDriver> is not applicable for the arguments
解決方案
把Guava 的版本升級到21,就完美解決。
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>21.0</version>
</dependency>
參考鏈接:https://softwaretestingboard.com/q2a/1907/function-webdriver-fluentwait-webdriver-applicable-arguments#axzz60cfO4vgE