title: selenium web driver - how to use waitFor for AJAX
body: <p>I am trying to add explicit wait before each and every web element in the test script</p>
  
  <p>My code has</p>
  
  <pre><code>import org.openqa.selenium.support.ui.Wait;
  import org.openqa.selenium.support.ui.WebDriverWait;
                       .
                       .
  WebDriverWait wait = new WebDriverWait(driver, 60);
  wait.until(presenceOfElementLocated(By.id("name")));
  
  driver.findElement(By.id("name")).clear();
  driver.findElement(By.id("name")).sendKeys("Create_title_01");
  </code></pre>
  
  <p>The error I see is:</p>
  
  <pre><code>    java.lang.NullPointerException
  at org.openqa.selenium.support.ui.FluentWait$1.apply(FluentWait.java:176)
  at org.openqa.selenium.support.ui.FluentWait$1.apply(FluentWait.java:1)
  at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:201)
  at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:174)
  </code></pre>
  
  <p>Thanks</p>