FluentWait-condition not evaluating to true

I wrote this code based on your example  but the condition never evaluate to true so it keeps on printing “Buzz  Buzz”.

public class FluentWaitCommands {

private static WebDriver driver = null;

public static void main(String[] args) {

driver = new FirefoxDriver();

WebElement element = driver.findElement(By.id(“clock”));

FluentWait<WebElement> wait = new FluentWait<WebElement>(element);

wait.withTimeout(600, TimeUnit.SECONDS);
wait.pollingEvery(500, TimeUnit.MILLISECONDS);

Function <WebElement, Boolean> f = new Function <WebElement, Boolean> () {
public Boolean apply (WebElement element) {

if (!element.getText().equals(“Buzz Buzz”))
String value = element.getText();
System.out.println(“Value of the element is: ” + value);
return false;

System.out.println(“Hurray found Buzz Buzz :D”);
return true;




Add Comment
4 Answer(s)

Its working absolutely fine. Try it properly

Virender Singh Professor Answered on May 11, 2015.
Add Comment

This what it shows in the console
RE: FluentWait-condition not evaluating to true

StridePurple Default Answered on May 11, 2015.
Add Comment

Well, I am not sure what code you are running here. I copy pasted your code and it works absolutely fine.


Virender Singh Professor Answered on May 12, 2015.
Add Comment

Is it possible to solve just by .until and ExpectedConditions class instead of until()’s overloaded method with Function and Predicate? I mean something like this:

public void testTextDisplayed(WebDriver driver){


WebElement element = driver.findElement(By.className("timer"));
WebDriverWait wait = new WebDriverWait(driver, 45);

wait.pollingEvery(100, TimeUnit.MILLISECONDS);

boolean isBuzzBuzz = wait.until(ExpectedConditions.textToBePresentInElementValue(element, "Buzz Buzz"));

System.out.println("Buzz Buzz is present!");



System.out.println("Buzz Buzz us not present yet.");


mojo719 Default Answered on May 17, 2016.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.