本文主要描述下如何解決WebDriverWait中的cannot applied的問題。java
webDriverWait.until(ExpectedConditions.presenceOfElementLocated(By.className("ready")));
升級了pom依賴,在使用這個方法的時候忽然報錯git
until (java.util.function.Function<? super org.openqa.selenium.WebDriver,java.lang.Object>) in FluentWait cannot be applied to (org.openqa.selenium.support.ui.ExpectedCondition<org.openqa.selenium.WebElement>)
本身在idea上點進去函數看半天沒啥問題,一直納悶。後來找到緣由了,原來是舊版本guava引發的,舊版的guava這裏還不支持泛型。應該是改動pom形成傳遞依賴成舊版的guava了。這裏須要從新exclude掉,顯式強制引入新版guavagithub
<dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>22.0</version> </dependency>
這樣就大功告成了。web