2017-05-11 121 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