The syntax of the until()
method in selenium docs is as below:
public <V> V until(java.util.function.Function<? super T,V> isTrue)
The usage of the same is like:
WebDriver wait = new WebDriver(driver, 20);
WebElement loginButton = wait.until(ExpectedConditions.elementToBeClickable(By.id("lgn-btn")));
I couldn't relate to the syntax and the usage of the until()
method. I want to know how the syntax is implemented.
Yeah, I know about Generics, which we use to know about the errors at compile time so that we can avoid ClassCastException at runtime. Also, I know about the functional interface, which we use to achieve behavior parameterization.
What I didn't get is the equivalence between the java.util.function.Function<? super T,V> isTrue)
and the ExpectedConditions.elementToBeClickable(By.id("id))
.
What does the expression java.util.function.Function<? super T,V> isTrue
mean?