2017-05-11 66 views
1
WebDriverWait wait = new WebDriverWait(driver, timoutInSeconds); 
List<WebElement> elements = 
wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(by)); 

它的Maven項目,我已經升級到硒從2.53.0版本3.4.0,並添加番石榴的依賴與21.0版。 早些時候所有的等待都在起作用。當升級到最新的硒3.4.0版本時,所有等待中斷。執行測試時會收到以下錯誤。WebDriverWait wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(所))不宜與硒工作3.4.0

java.lang.NoSuchMethodError: org.openqa.selenium.support.ui.WebDriverWait.until(Ljava/util/function/Function;)Ljava/lang/Object;

很多網友說加入番石榴依賴這個問題已經不存在,但我甚至增加番石榴依賴後看到了這個問題。

+0

這裏是加入Maven依賴 <依賴性> com.google.guava 番石榴 21.0 <依賴性> org.seleniumhq.selenium 硒-java的 3.4.0 編譯 user3766763

+0

1 )你是否先運行'mvn clean'? 2)發表你的整個'pom.xml' - 和** not **在評論中,但編輯你的原始文章。 – SiKing

回答

0

看在這一個WebDriverWait.until no longer available in Selenium-java-3.2 and Selenium-java-3.3 releases

第三評論我加了番石榴依賴+現在用流利的等待和它的正常工作

+0

我試過了,它沒有工作。如下所示添加番石榴依賴和更新的代碼仍然錯誤是相同的。 \t 等待等待=新FluentWait (駕駛員) \t \t \t .withTimeout(timoutInSeconds,TimeUnit.SECONDS) \t \t \t .pollingEvery(5,TimeUnit.SECONDS) \t \t \t .ignoring(NoSuchElementException.class) ; \t \t \t WebElement富= wait.until(新功能(){ \t \t \t公共WebElement申請(駕駛員的webdriver){ \t \t \t返回driver.findElement(通過); \t \t \t } \t \t \t}); – user3766763

+0

也試過這個。最後的WebElement元素=(新的WebDriverWait(驅動程序,10))仍然是相同的錯誤 。直到(新ExpectedCondition (){ \t \t \t @Override \t \t \t公共WebElement申請( \t \t \t \t \t最終的webdriver d){ \t \t \t \t WebElement weReturn = NULL; \t \t \t \t最終WebElement bodyText = driver.findElement(by); \t \t \t \t if(bodyText!= null){ \t \t \t \t \t weReturn = bodyText; \t \t \t \t} \t \t \t \t回報weReturn; \t \t \t} \t \t}); – user3766763