title: When to use explicit wait vs implicit wait in Selenium Webdriver?
body: <p>I am using:</p>
  
  <pre><code>driver.manage().timeouts().implicitlyWait(180, TimeUnit.SECONDS);
  </code></pre>
  
  <p>But it still fails continuously for the below element </p>
  
  <pre><code>    driver.findElement(By.id("name")).clear();
      driver.findElement(By.id("name")).sendKeys("Create_title_01");
  </code></pre>
  
  <p>I have added wait code:</p>
  
  <pre><code>for (int second = 0;; second++) {
          if (second &gt;= 120) fail("timeout");
          try { if (isElementPresent(By.id("name"))) break; } catch (Exception e) {}
          Thread.sleep(1000);
      }
  </code></pre>
  
  <p>Shouldn't implicit wait take care of waiting till an element is found?
  Also would it be better if I use Explicit wait instead of the code I have added that has <code>Thread.sleep()</code>?</p>