title: Equivalent of waitForVisible/waitForElementPresent in Selenium WebDriver tests using Java?
body: <p>With "HTML" Selenium tests (created with Selenium IDE or manually), you can use some <a href="http://release.seleniumhq.org/selenium-core/1.0.1/reference.html">very handy commands</a> like <strong><code>WaitForElementPresent</code></strong> or <strong><code>WaitForVisible</code></strong>.</p>
  
  <pre><code>&lt;tr&gt;
      &lt;td&gt;waitForElementPresent&lt;/td&gt;
      &lt;td&gt;id=saveButton&lt;/td&gt;
      &lt;td&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>When coding Selenium tests in Java (Webdriver / Selenium RC—I'm not sure of the terminology here), <strong>is there something similar built-in</strong>? </p>
  
  <p>For example, for checking that a dialog (that takes a while to open) is visible...</p>
  
  <pre><code>WebElement dialog = driver.findElement(By.id("reportDialog"));
  assertTrue(dialog.isDisplayed());  // often fails as it isn't visible *yet*
  </code></pre>
  
  <p>What's the cleanest <em>robust</em> way to code such check?</p>
  
  <p>Adding <code>Thread.sleep()</code> calls all over the place would be ugly and fragile, and rolling your own while loops seems pretty clumsy too...</p>