Java做selenium自動化測試時,關於guava的報錯

使用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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章