title: What is the difference between explicit wait and fluent wait in webdriver?
body: <p>Below is my code</p>
  
  <pre><code>public boolean waitForElementToBeClickable(String xpathValue){
  
          Boolean flag = false;
          WebElement myDynamicElement = (new WebDriverWait(Base.base.getDriver(), 30))
                    .until(ExpectedConditions.elementToBeClickable(By.xpath(xpathValue)));
          flag = true;
          return flag;
  
      }
  </code></pre>
  
  <p>This wait for element to appear for 30 sec and if element is ready before 30 sec it perform the next command.</p>
  
  <p>but when I use below code for fluent wait</p>
  
  <pre><code>public Boolean waitForElementToAppear(final WebElement e){
  
           Wait&lt;WebElement&gt; wait = new FluentWait&lt;WebElement&gt;(e)
                   .withTimeout(30, TimeUnit.SECONDS)              
                   .pollingEvery(2, TimeUnit.SECONDS)
                   ;
  
           Boolean foo = wait.until(new Function&lt;WebElement, Boolean&gt;() {
               public Boolean apply( WebElement element) {
  
                 return element.isDisplayed();
               }
             });
          return foo;
           }
  </code></pre>
  
  <p>It says No-such Element exception, it doesn't even wait for 30 sec, it throw exception instantly.</p>
  
  <p>Can someone tell what is the issue with it ?</p>