I am using Fluent wait. I want to return void instead of Web Element or Boolean. How can I do it? I have tried like this. Code snippet is below
Wait<WebDriver> wait = new FluentWait<WebDriver>(driver).withTimeout(Duration.ofSeconds(30))
.pollingEvery(Duration.ofSeconds(3)).ignoring(NoSuchElementException.class)
wait.until(new Function<WebDriver, Void>() {
public void apply(WebDriver driver) {
if( driver.findElement(By.id("foo")).isDisplayed())
driver.findElement(By.id("foo")).click();
}
});
}
However, it gives me error at void:
The return type is incompatible with Function<WebDriver,Void>.apply(WebDriver)
NOTE: I only want return void. Is that possible?