I have this piece of code for a FluentWait.
Wait<WebDriver> wait = new FluentWait<WebDriver>(driver)
.withTimeout(30, SECONDS)
.pollingEvery(5, SECONDS)
.ignoring(NoSuchElementException.class);
WebElement foo = wait.until(new Function<WebDriver, WebElement>() {
public WebElement apply(WebDriver driver) {
return driver.findElement(By.id("foo"));
}
});
I understand everything in the first part. Please explain how new Function<WebDriver, WebElement>
works in the second part.
I have looked at the source code (link) from the package com.google.common.base but couldn't wrap my head around it.