wait. Until (expectedconditions) no longer works in selenium

So far, I have used 2.45 In version 0, all waiting is completed as follows:

webdriverwait wait = new webdriverwait(webKitUtility.getWebDriver(),5);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("role")));

But I updated selenium to 3.1 0, I received an error:

"Method until (predict) in fluentwait type is not applicable to parameter (expectedcondition)"

I see from 2.45 0 to 3.1 Some things have been discarded I'm investigating what's the best way now, but I'm not sure Most of the things I find on Google are old information, explained in the same way as used so far

Solution

I had the same problem

I use webdriverwait's not deprecated The until () method fixes it by adding the following to my Maven POM In XML:

<dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>21.0</version>
</dependency>

Besides, my code looks the same as before

More specifically, there are now two Until() method

Old (deprecated): public void until (final predicate < T > istrue) {}

And new: public < V > V until (function istrue) {}

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>