/** * Waits for text contained in the element to appear in the page, or timeout. */ public void waitForTextContainedInElementPresence(By by, String text) { waitFor(ExpectedConditions.textToBePresentInElementLocated(by, text)); }
/** * Waits for text contained in the element to disappear from the page, or timeout. */ public void waitForTextContainedInElementAbsence(By by, String text) { waitFor(ExpectedConditions.not(ExpectedConditions.textToBePresentInElementLocated(by, text))); }
/** * Waiting for text to change or appear in the item * * @param by locator to search for an item * @param text text that must be in the element * @param message message in case there is no text in the element after waiting * @param timeout condition timeout in seconds */ public static void textContains(By by, String text, String message, int timeout) { wait(ExpectedConditions.textToBePresentInElementLocated(by, text), message, timeout); }
public void assertPageContains(By locator, String expText) throws Exception { logger.info("Try to assert page contains: " + expText); for (int i = 0; i < 10; i++) { try { driverFluentWait(1).until(ExpectedConditions.textToBePresentInElementLocated(locator, expText)); break; } catch (Exception e) { if (i >= 9) { logger.error("----- assertPageContains Exception: " + e); } TimeUnit.MILLISECONDS.sleep(50); } } assertTrue(driver.findElement(locator).getText().contains(expText)); }
public void assertPageContains(By locator, String expText) throws Exception { logger.info("Try to assert page contains: " + expText); for (int i = 0; i < 10; i++) { try { driverFluentWait(1).until(ExpectedConditions.textToBePresentInElementLocated(locator, expText)); break; } catch (Exception e) { if (i >= 9) { logger.error("----- assertPageContains Exception: " + e); } TimeUnit.MILLISECONDS.sleep(50); } } assertTrue(driver.findElement(locator).getText().contains(expText)); }
/** * Waiting for missing expected text in the item * * @param by locator to search for an item * @param text text that should be missing from the element * @param message message in case text is present in the element after waiting * @param timeout condition timeout in seconds */ public static void textNotContains(By by, String text, String message, int timeout) { wait(ExpectedConditions.not(ExpectedConditions.textToBePresentInElementLocated(by, text)), message, timeout); }
/** * Waiting for text to change or appear in the item * * @param xpath element xpath * @param text text that must be in the element * @param message message in case there is no text in the element after waiting * @param timeout condition timeout in seconds */ public static void textContains(String xpath, String text, String message, int timeout) { wait(ExpectedConditions.textToBePresentInElementLocated(By.xpath(xpath), text), message, timeout); }
public Boolean isPageSourceContaining(String text) { try { return fluentWait.until(textToBePresentInElementLocated(By.xpath("//*"), text)); } catch (Exception e) { return FALSE; } }
/** * Waiting for missing expected text in the item * * @param xpath element xpath * @param text text that should be missing from the element * @param message message in case text is present in the element after waiting * @param timeout condition timeout in seconds */ public static void textNotContains(String xpath, String text, String message, int timeout) { wait(ExpectedConditions.not(ExpectedConditions.textToBePresentInElementLocated(By.xpath(xpath), text)), message, timeout); }
public static void waitForTextPresent( final HtmlElement element, final String text ) { Assert.assertNotNull(text, "Text can't be null"); TestLogging.logWebStep( "wait for text \"" + text + "\" to be present.", false ); final WebDriverWait wait = new WebDriverWait(WebUIDriver.getWebDriver(), EXPLICT_WAIT_TIMEOUT); wait.until( ExpectedConditions.textToBePresentInElementLocated( element.getBy(), text ) ); }
} catch (NoSuchElementException e) { textCondition = ExpectedConditions.textToBePresentInElementLocated(getBy(), decryptedText); textCondition = ExpectedConditions.textToBePresentInElementLocated(getBy(), decryptedText);
public static void assertServerMessage(String expectedMessage) { waitUntil(ExpectedConditions.textToBePresentInElementLocated(WicketBy.wicketPath("contentContainer_timesheetFrame_timesheetFrame__body_timesheetForm_commentsFrame_commentsFrame__body_serverMessage"), expectedMessage)); } }
@Test public void should_show_zero_bookings() throws Exception { preloadDatabase("report_scenario.dbunit.xml"); updatePassword("report", "a"); loginReportUser(); loadReportSection(); setStartDate("1/1/2013"); setEndDate("1/1/2014"); createReport(); clickZeroBookings(); waitUntil(ExpectedConditions.textToBePresentInElementLocated(WicketBy.wicketPath("reportContainer_panel_reportTable_greyFrame_greyFrame__body_reportContent_reportFrame_reportFrame__body_reportFrameContainer_reportTable_3_cell_7"), "0")); logout(); } }