SynchronisationService extends BaseServiceHub { public void waitAndAssertForExpectedCondition(ExpectedCondition<?> condition, int timeout) { if (!waitForExpectedCondition(condition, timeout)) { fail(String.format("Element does not meet condition %1$s", condition.toString())); } }  boolean waitForExpectedCondition(ExpectedCondition<?> condition, int timeout); boolean waitForExpectedCondition(ExpectedCondition<?> condition); void waitAndAssertForExpectedCondition(ExpectedCondition<?> condition, int timeout); void waitAndAssertForExpectedCondition(ExpectedCondition<?> condition); boolean checkForExpectedCondition(ExpectedCondition<?> condition); void checkAndAssertForExpectedCondition(ExpectedCondition<?> condition); void waitAndSwitchToNewBrowserWindow(int timeout); void waitAndSwitchToNewBrowserWindow(); void switchToMainWindow(); void switchToLatestPopupWindow();  }
@Test public void testWaitAndAssertForExpectedCondition() throws Exception { seleniumNavigationService.navigate_to_url(TEST_PAGE_URL); seleniumSynchronisationService.waitAndAssertForExpectedCondition(ExpectedConditions.invisibilityOfElementLocated(By.cssSelector("div[id='text']")), seleniumManager.getTimeout()); seleniumElementService.findExpectedElement(By.cssSelector("button[id='delayedDisplayButton']")).click(); seleniumSynchronisationService.waitAndAssertForExpectedCondition(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("div[id='text']")), seleniumManager.getTimeout()); }