Example usage for org.openqa.selenium.support.ui ExpectedConditions textToBePresentInElementLocated

List of usage examples for org.openqa.selenium.support.ui ExpectedConditions textToBePresentInElementLocated

Introduction

In this page you can find the example usage for org.openqa.selenium.support.ui ExpectedConditions textToBePresentInElementLocated.

Prototype

public static ExpectedCondition<Boolean> textToBePresentInElementLocated(final By locator, final String text) 

Source Link

Document

An expectation for checking if the given text is present in the element that matches the given locator.

Usage

From source file:org.apache.geode.tools.pulse.tests.ui.PulseTestUtils.java

License:Apache License

public static void verifyTextPresrntByXpath(String xpath, String text) {
    WebDriverWait wait = new WebDriverWait(getDriver(), maxWaitTime, 500);
    wait.until(ExpectedConditions.textToBePresentInElementLocated(By.xpath(xpath), text));
}

From source file:org.eclipse.che.selenium.factory.CheckWelcomePanelOnCodenvyTest.java

License:Open Source License

private void checkWelcomePanel() {
    String expectedTextFragment = "Runbook\n"
            + "This article provides specific performance and security guidance for Codenvy on-premises installations based on our experience running";
    webDriverWait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.id("greetingFrame")));
    webDriverWait.until(//from   w  ww  .  ja  v a 2s  .  c o m
            ExpectedConditions.textToBePresentInElementLocated(By.tagName("body"), expectedTextFragment));
}

From source file:org.eclipse.che.selenium.gwt.CheckSimpleGwtAppTest.java

License:Open Source License

@Test
public void checkLaunchingCodeServer() throws Exception {
    ide.open(testWorkspace);/*  w w w . j a  va  2s .  c o  m*/

    String expectedTextOnCodeServerPage = "GWT Code Server\n"
            + "Drag these two bookmarklets to your browser's bookmark bar:\n" + "Dev Mode On Dev Mode Off\n"
            + "Visit a web page that uses one of these modules:\n" + "GWT\n"
            + "Click \"Dev Mode On\" to start development mode.";

    projectExplorer.waitItem(projectName);
    toastLoader.waitAppeareanceAndClosing();
    projectExplorer.selectItem(projectName);
    projectExplorer.invokeCommandWithContextMenu(COMMON, projectName, BUILD_COMMAND);
    consoles.waitExpectedTextIntoConsole(BUILD_SUCCESS, 600);
    projectExplorer.invokeCommandWithContextMenu(COMMON, projectName, RUN_GWT_COMMAND);
    consoles.waitExpectedTextIntoConsole("The code server is ready", APPLICATION_START_TIMEOUT_SEC);

    String url = workspaceServiceClient.getServerByExposedPort(testWorkspace.getId(), "9876/tcp").getUrl();
    ide.driver().get(url);

    new WebDriverWait(ide.driver(), REDRAW_UI_ELEMENTS_TIMEOUT_SEC).until(ExpectedConditions
            .textToBePresentInElementLocated(By.tagName("body"), expectedTextOnCodeServerPage));
}

From source file:org.eclipse.che.selenium.intelligencecommand.CheckIntelligenceCommandFromToolbarTest.java

License:Open Source License

private void checkTestAppAndReturnToIde(String currentWindow, String expectedTextOnTestAppPage) {
    seleniumWebDriver.switchToNoneCurrentWindow(currentWindow);
    new WebDriverWait(seleniumWebDriver, MULTIPLE).until(
            ExpectedConditions.textToBePresentInElementLocated(By.tagName("body"), expectedTextOnTestAppPage));
    seleniumWebDriver.close();/*from  w  ww . ja  v a2  s.c o  m*/
    seleniumWebDriver.switchTo().window(currentWindow);
}

From source file:org.eclipse.che.selenium.pageobject.dashboard.DashboardWorkspace.java

License:Open Source License

/**
 * enter value RAM of workspace//from   w  ww  .ja  va  2 s  . c o m
 *
 * @param ram is value of RAM
 */
public void enterRamWorkspace(int ram) {
    String ramValue = "//input[@name='memory']";
    new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
            .until(ExpectedConditions.visibilityOf(ramWorkspace)).clear();
    new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
            .until(ExpectedConditions.visibilityOf(ramWorkspace)).sendKeys(String.valueOf(ram));
    new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
            .until(ExpectedConditions.textToBePresentInElementLocated(By.xpath(ramValue), String.valueOf(ram)));
}

From source file:org.eclipse.che.selenium.pageobject.machineperspective.MachineInformationTab.java

License:Open Source License

/**
 * wait expected text into Information tab
 *
 * @param expectedText/* w  w  w.  j a  v a2s  .  c om*/
 */
public void waitTextIntoInfoTab(String expectedText) {
    String locatorXpath = "//div[@id='gwt-debug-editorPanel']//div";
    new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
            .until(ExpectedConditions.textToBePresentInElementLocated(By.xpath(locatorXpath), expectedText));
}

From source file:org.glowroot.agent.webdriver.tests.BasicSmokeIT.java

License:Apache License

@Test
public void shouldCheckTransactionPages() throws Exception {
    // given/*from   www.  jav  a 2  s.  co m*/
    App app = new App(driver, "http://localhost:" + getUiPort());
    GlobalNavbar globalNavbar = new GlobalNavbar(driver);

    app.open();

    // hitting F5 is just to test 304 responses
    Utils.withWait(driver, By.partialLinkText("Response time")).sendKeys(Keys.F5);

    Utils.withWait(driver, By.xpath("//a[@gt-display='All Servlet Transactions'][contains(., '%')]"));
    driver.findElement(By.xpath("//button[@title='By percent of total time']")).click();
    driver.findElement(By.linkText("By average time")).click();
    Utils.withWait(driver, By.xpath("//a[@gt-display='All Servlet Transactions'][contains(., 'ms')]"));
    driver.findElement(By.xpath("//button[@title='By average time']")).click();
    driver.findElement(By.linkText("By throughput (per min)")).click();
    Utils.withWait(driver, By.xpath("//a[@gt-display='All Servlet Transactions'][contains(., '/min')]"));
    driver.findElement(By.xpath("//button[@title='By throughput (per min)']")).click();
    driver.findElement(By.linkText("By percent of total time")).click();
    Utils.withWait(driver, By.xpath("//a[@gt-display='All Servlet Transactions'][contains(., '%')]"));

    Utils.withWait(driver, By.partialLinkText("percentiles")).click();
    Utils.withWait(driver, By.partialLinkText("throughput")).click();
    Utils.withWait(driver, By.partialLinkText("Slow traces")).click();
    Utils.withWait(driver, By.partialLinkText("External queries")).click();
    Utils.withWait(driver, By.partialLinkText("Continuous profiling")).click();
    Utils.withWait(driver, By.xpath("//input[@ng-model='filter']")).sendKeys("JdbcServlet");
    Utils.withWait(driver, By.xpath("//button[@ng-click='refreshButtonClick()']")).click();
    new WebDriverWait(driver, 30).until(
            ExpectedConditions.textToBePresentInElementLocated(By.className("gt-profile"), "JdbcServlet"));

    Utils.withWait(driver, By.linkText("View flame graph (experimental)")).click();
    // give flame graph a chance to render (only for visual when running locally)
    Thread.sleep(500);
    globalNavbar.getTransactionsLink().click();
    Utils.withWait(driver, By.partialLinkText("/jdbcservlet")).click();
    Utils.withWait(driver, By.partialLinkText("percentiles")).click();
    Utils.withWait(driver, By.partialLinkText("Slow traces")).click();
    Utils.withWait(driver, By.partialLinkText("External queries")).click();
    Utils.withWait(driver, By.partialLinkText("Continuous profiling")).click();
    Utils.withWait(driver, By.linkText("View flame graph (experimental)")).click();
}

From source file:org.glowroot.tests.BasicSmokeIT.java

License:Apache License

@Test
public void shouldCheckTransactionPages() throws Exception {
    App app = app();//from www  .j a  v  a  2s.c  o  m
    GlobalNavbar globalNavbar = globalNavbar();

    app.open();

    // hitting F5 is just to test 304 responses
    Utils.withWait(driver, By.partialLinkText("Response time")).sendKeys(Keys.F5);

    Utils.withWait(driver, By.xpath("//a[@gt-display='All Web Transactions'][contains(., '%')]"));
    driver.findElement(By.xpath("//button[@title='By percent of total time']")).click();
    driver.findElement(By.linkText("By average time")).click();
    Utils.withWait(driver, By.xpath("//a[@gt-display='All Web Transactions'][contains(., 'ms')]"));
    driver.findElement(By.xpath("//button[@title='By average time']")).click();
    driver.findElement(By.linkText("By throughput (per min)")).click();
    Utils.withWait(driver, By.xpath("//a[@gt-display='All Web Transactions'][contains(., '/min')]"));
    driver.findElement(By.xpath("//button[@title='By throughput (per min)']")).click();
    driver.findElement(By.linkText("By percent of total time")).click();
    Utils.withWait(driver, By.xpath("//a[@gt-display='All Web Transactions'][contains(., '%')]"));

    Utils.withWait(driver, By.partialLinkText("percentiles")).click();
    Utils.withWait(driver, By.partialLinkText("throughput")).click();
    Utils.withWait(driver, By.partialLinkText("Slow traces")).click();
    Utils.withWait(driver, By.partialLinkText("Queries")).click();
    Utils.withWait(driver, By.partialLinkText("Continuous profiling")).click();
    Utils.withWait(driver, By.xpath("//input[@ng-model='filter']")).sendKeys("JdbcServlet");
    Utils.withWait(driver, By.xpath("//button[@ng-click='refresh()']")).click();
    new WebDriverWait(driver, 30).until(
            ExpectedConditions.textToBePresentInElementLocated(By.className("gt-profile"), "JdbcServlet"));

    Utils.withWait(driver, By.linkText("View flame graph (experimental)")).click();
    // give flame graph a chance to render (only for visual when running locally)
    Thread.sleep(1000);
    globalNavbar.getTransactionsLink().click();
    Utils.withWait(driver, By.partialLinkText("/jdbcservlet")).click();
    Utils.withWait(driver, By.partialLinkText("percentiles")).click();
    Utils.withWait(driver, By.partialLinkText("Slow traces")).click();
    Utils.withWait(driver, By.partialLinkText("Queries")).click();
    Utils.withWait(driver, By.partialLinkText("Continuous profiling")).click();
    Utils.withWait(driver, By.linkText("View flame graph (experimental)")).click();
}

From source file:org.joinfaces.example.view.StarterPage.java

License:Apache License

private void click(WebElement webElement, String technology) {
    By panelHeaderSpanBy = By.xpath("//span[@class='ui-panel-title']");

    webElement.click();/*from ww  w  .ja v  a  2  s.c  om*/

    new WebDriverWait(webDriver, 10000)
            .until(ExpectedConditions.textToBePresentInElementLocated(panelHeaderSpanBy, technology));
}

From source file:org.keycloak.quickstart.ArquillianAngular2Test.java

License:Apache License

@Test
public void testSecuredResource() throws InterruptedException {
    try {//from  w w  w . j av  a 2s  .  co m
        indexPage.clickSecured();
        assertTrue(Graphene.waitGui().withTimeout(60, TimeUnit.SECONDS).until(
                ExpectedConditions.textToBePresentInElementLocated(By.className("error"), UNAUTHORIZED)));
    } catch (Exception e) {
        debugTest(e);
        fail("Should display an error message");
    }
}