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

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

Introduction

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

Prototype

public static ExpectedCondition<Boolean> textToBe(final By locator, final String value) 

Source Link

Document

An expectation for checking WebElement with given locator has specific text

Usage

From source file:ca.nrc.cadc.UserStorageBrowserPage.java

License:Open Source License

public UserStorageBrowserPage(final WebDriver driver) throws Exception {
    super(driver);
    this.driver = driver;

    // The beacon-progress bar displays "Transferring Data" while it's loading
    // the page. Firefox doesn't display whole list until the bar is green, and
    // that text is gone. Could be this test isn't sufficient but it works
    // to have intTestFirefox not fail.
    WebDriverWait wait = new WebDriverWait(driver, 10);
    wait.until(ExpectedConditions.textToBe(By.className("beacon-progress"), ""));

    PageFactory.initElements(driver, this);
}

From source file:io.ddavison.conductor.Locomotive.java

License:Open Source License

public Locomotive setText(By by, String text) {
    waitForCondition(ExpectedConditions.not(ExpectedConditions.invisibilityOfElementLocated(by)))
            .waitForCondition(ExpectedConditions.elementToBeClickable(by));
    WebElement element = waitForElement(by);
    element.clear();//from ww  w.  j  a  va  2 s  . c o  m
    element.sendKeys(text);
    waitForCondition(ExpectedConditions.or(ExpectedConditions.textToBe(by, text),
            ExpectedConditions.attributeToBe(by, "value", text)));
    return this;
}

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

License:Open Source License

public void waitOrganizationTitle(String name) {
    new WebDriverWait(seleniumWebDriver, LOADER_TIMEOUT_SEC)
            .until(ExpectedConditions.textToBe(By.id(Locators.ORGANIZATION_TITLE_ID), name));
}

From source file:org.eclipse.che.selenium.pageobject.Wizard.java

License:Open Source License

/** wait expected type of packaging on the 'Create New Project' widget */
public void waitExpectedPackaging(PackagingMavenType mavenType) {
    new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC).until(
            ExpectedConditions.textToBe(By.xpath(Locators.SELECT_PACKAGING_DROPDOWN), mavenType.toString()));
}

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

License:Apache License

public void submit(String message) {
    inputByName.sendKeys(message);// w w w .  j  av a2s  . c om

    buttonByName.click();

    By outputTextBy = getOutputTextBy();
    String expectedValue = "You entered: " + message;

    new WebDriverWait(webDriver, 5000).until(ExpectedConditions.textToBe(outputTextBy, expectedValue));
}

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

License:Apache License

public void submit(String message) {
    welcomeInput.sendKeys(message);/*ww w.  ja  v  a2  s .  c o  m*/

    welcomeButton.submit();

    By outputTextBy = getOutputTextBy();
    String expectedValue = message + " welcome!";

    new WebDriverWait(webDriver, 5000).until(ExpectedConditions.textToBe(outputTextBy, expectedValue));
}

From source file:org.structr.web.frontend.selenium.LoginChromeTest.java

License:Open Source License

@Test
public void testFailedLogin() {

    createAdminUser();//from  w ww.  j av  a2 s .  co  m

    driver.get("http://localhost:8875/structr/#dashboard");

    assertEquals("Username field not found", 1, driver.findElements(By.id("usernameField")).size());
    assertEquals("Password field not found", 1, driver.findElements(By.id("passwordField")).size());
    assertEquals("Login button not found", 1, driver.findElements(By.id("loginButton")).size());

    final WebDriverWait wait = new WebDriverWait(driver, 2);

    final WebElement usernameField = wait
            .until(ExpectedConditions.visibilityOfElementLocated(By.id("usernameField")));
    usernameField.sendKeys("admin");

    final WebElement passwordField = wait
            .until(ExpectedConditions.visibilityOfElementLocated(By.id("passwordField")));
    passwordField.sendKeys("wrongpassword");

    final WebElement loginButton = wait
            .until(ExpectedConditions.visibilityOfElementLocated(By.id("loginButton")));
    loginButton.click();

    wait.until(ExpectedConditions.textToBe(By.id("errorText"), "Wrong username or password!"));
}