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