I observed fluent wait not identifying an element even though page is loaded completely and element is visible on the screen.

For an example, I have an application with say page A and page B. On clicking continue button on page A, user navigates to page B where I am trying to identify a button Webelement by waiting 60 secs.

Even though page is loaded completely and button is present on page B, I see webdriver keep on polling to identify webelement and fails at the end with NoSuchElementException. If I add a sleep for 5 secs and perform same action, script is working fine.

Has anybody faced the same problem and found a solution to deal with such problem. Any help in this matter would be greatly appreciated.

  • 1
    Are you sure your locator is correct?
    – FDM
    Feb 16 '16 at 8:08
  • Are you sure that driver is on page B? Both are opened? Feb 16 '16 at 14:36
  • Where is the code, relevant html and error? May 8 '18 at 9:11

Try using Explicit wait, explicit wait will resolve your issue.

    WebDriverWait wait = new WebDriverWait(driver, 20); 
    wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.xpath("<your xpath>"))));

and then perform action on the element, this code will keep polling until element is found for 20 secs.


Don't forget to set the Timeout and PollingInterval for WebDriverWait. It is likely doing exactly what it is set to do by default. Also, check to be sure that the element is enabled at the same time it is visible. If the visibility triggers before the enabled, then it might result in a interaction before it is able.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.