Issue
I am automating test case. I want to use FluentWait but it is throwing "The method until(Function) in the type Wait is not applicable for the arguments (new Function(){})" error.
Wait<WebDriver> wait = new FluentWait<WebDriver>(driver).
withTimeout(60, TimeUnit.SECONDS)
.pollingEvery(5, TimeUnit.SECONDS)
.ignoring(NoSuchElementException.class);
wait.until(new Function< WebElement, Boolean >() {
@Override
public Boolean apply(WebElement element) {
return element.getText().contains(employeeFirstName);
}
});
What I am doing wrong here?
Solution
Wait<WebDriver> wait = new FluentWait<>(driver)
.withTimeout(60, TimeUnit.SECONDS)
.pollingEvery(5, TimeUnit.SECONDS)
.ignoring(NoSuchElementException.class);
wait.until(new Function<WebDriver, Boolean>() {
@Override
public Boolean apply(WebDriver driver) {
return driver.findElement(By.cssSelector("my-css-selector")).getText().contains("name");
}
});
Answered By - drets
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.