lundi 27 novembre 2017

Selenium 3.7.1 how to use wait.until() with Expected condition?

With selenium 3.7.1 it's not possible to use wait.until() with Expected condition, just with wait.until(Function<? super WebDriver, v> arg). Example code working in another selenium version:

WebDriverWait wait = new WebDriverWait(driver, 10000);
wait.until(ExpectedConditions.alertIsPresent());

After some search I found some users that added this dependency in maven:

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

After that the method is not returning the error, but when I try to compile the log return:

[ERROR]required:java.util.function.Function<superorg.openqa.selenium.WebDriver,V> 
[ERROR]found:org.openqa.selenium.support.ui.ExpectedCondition<org.openqa.selenium.Alert>
[ERROR] reason: no instance(s) of type variable(s) V exist so that argument type org.openqa.selenium.support.ui.ExpectedCondition<org.openqa.selenium.Alert> conforms to formal parameter type java.util.function.Function<? super org.openqa.selenium.WebDriver,V>

Anyone knows how to use the wait.until(ExpectedConditions)?

Aucun commentaire:

Enregistrer un commentaire