Wait<WebDriver> wait = new FluentWait<WebDriver>(driver)
.withTimeout(Duration.ofSeconds(30))
.pollingEvery(Duration.ofMillis(500))
.ignoring(NoSuchElementException.class);
WebElement foo = wait.until(new Function<WebDriver, WebElement>() {
public WebElement apply(WebDriver driver) {
return driver.findElement(By.name("q"));
}
});
Tried to work on Fluent wait implementation with Selenium 3.141.59 but getting the specified compile time error. I am mainly concerned with "new Function method"
I don't believe this is a duplicate. Question may sound the same but none of the solutions worked for me.
Error Shown:
The type Function is not generic; it cannot be parameterized with arguments <WebDriver, WebElement>