With "HTML" Selenium tests (created with Selenium IDE or manually), you can use some very handy commands like
WebElement dialog = driver.findElement(By.id("reportDialog"));
assertTrue(dialog.isDisplayed()); // often fails as it isn't visible *yet*
An implicit wait is to tell WebDriver to poll the DOM for a certain amount of time when trying to find an element or elements if they are not immediately available. The default setting is 0. Once set, the implicit wait is set for the life of the WebDriver object instance.
Explicit Wait + Expected Conditions
An explicit waits is code you define to wait for a certain condition to occur before proceeding further in the code. The worst case of this is Thread.sleep(), which sets the condition to an exact time period to wait. There are some convenience methods provided that help you write code that will wait only as long as required. WebDriverWait in combination with ExpectedCondition is one way this can be accomplished.
WebDriverWait wait = new WebDriverWait(driver, 10); WebElement element = wait.until( ExpectedConditions.visibilityOfElementLocated(By.id("someid")));