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

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

Introduction

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

Prototype

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

Source Link

Document

An expectation for checking if the given text is present in the specified elements value attribute.

Usage

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

License:Open Source License

/**
 * wait appearance text into factory field text
 *
 * @param expectedText/*from  w ww  .j  ava  2s  .  co m*/
 */
public void waitTextIntoFactoryField(String expectedText) {
    new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
            .until(ExpectedConditions.textToBePresentInElementValue(factoryField, expectedText));
}

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

License:Open Source License

/**
 * Enter param value on 'Add action' window
 *
 * @param paramValue value of param/*from  w w  w . j  a  va  2  s  .c om*/
 */
public void enterParamValue(String paramValue) {
    new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
            .until(ExpectedConditions.presenceOfElementLocated(By.xpath(AddActionWindow.PARAM_XPATH))).clear();
    loader.waitOnClosed();
    new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
            .until(ExpectedConditions.presenceOfElementLocated(By.xpath(AddActionWindow.PARAM_XPATH)))
            .sendKeys(paramValue);
    loader.waitOnClosed();
    new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC).until(ExpectedConditions
            .textToBePresentInElementValue(By.xpath(AddActionWindow.PARAM_XPATH), paramValue));
}

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

License:Open Source License

/**
 * Enter Git URL for project in the 'New Project' tab
 *
 * @param url URL for project on git repository
 *///from ww w.  j  ava 2s  . c  om
public void enterGitURL(String url) {
    WebElement input = new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
            .until(ExpectedConditions.visibilityOf(gitUrlInput));
    input.clear();
    input.sendKeys(url);
    new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
            .until(ExpectedConditions.textToBePresentInElementValue(gitUrlInput, url));
}

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

License:Open Source License

/**
 * Enter ZIP URL for project in the 'New Project' tab
 *
 * @param url URL for zip archive//from ww w.j  ava2  s  .c om
 */
public void enterZipURL(String url) {
    WebElement input = new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
            .until(ExpectedConditions.visibilityOf(zipUrlInput));
    input.clear();
    input.sendKeys(url);
    new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
            .until(ExpectedConditions.textToBePresentInElementValue(zipUrlInput, url));
}

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

License:Open Source License

public void enterNameWorkspace(String nameWorkspace) {
    new WebDriverWait(seleniumWebDriver, EXPECTED_MESS_IN_CONSOLE_SEC)
            .until(ExpectedConditions.visibilityOf(nameWorkspaceInput)).clear();
    new WebDriverWait(seleniumWebDriver, EXPECTED_MESS_IN_CONSOLE_SEC)
            .until(ExpectedConditions.visibilityOf(nameWorkspaceInput)).sendKeys(nameWorkspace);
    new WebDriverWait(seleniumWebDriver, EXPECTED_MESS_IN_CONSOLE_SEC)
            .until(ExpectedConditions.textToBePresentInElementValue(nameWorkspaceInput, nameWorkspace));
}

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

License:Open Source License

/** type text into 'Find Action' form */
public void typeTextIntoFindActionForm(String text) {
    waitEnterActionFormIsOpen();/*from  w  w w  .  j av  a  2 s .c o m*/
    clearTextBoxActionForm();
    for (char symbol : text.toCharArray()) {
        waitWithRedrawTimeout.until(ExpectedConditions.visibilityOf(textBoxActionForm))
                .sendKeys(Character.toString(symbol));
    }
    waitWithRedrawTimeout.until(ExpectedConditions.textToBePresentInElementValue(textBoxActionForm, text));
}

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

License:Open Source License

/**
 * enter value into field/* www. java  2 s  .  c o  m*/
 *
 * @param value text for field
 * @param field name Of field
 */
public void enterValueInField(String value, Field field) {
    new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC)
            .until(ExpectedConditions.presenceOfElementLocated(By.id(field.getFieldId()))).clear();
    new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC)
            .until(ExpectedConditions.presenceOfElementLocated(By.id(field.getFieldId()))).sendKeys(value);
    new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC)
            .until(ExpectedConditions.textToBePresentInElementValue(By.id(field.getFieldId()), value));
}

From source file:org.labkey.test.tests.idri.FormulationsTest.java

License:Apache License

@LogMethod
protected void qualityControlHPLCData() {
    String standardName = "LGCTest";
    String[] standards = { "LGC20371", "LGC40060", "LGC60342", "LGC80021", "LGC10030" };
    String[] concs = { "20", "40", "60", "80", "100" };
    String left = "12";
    String right = "15";
    String base = "40";

    String[] samples = { "QD123-11", "QD123-24", "QD123-31" };
    String sleft = "14.5";
    String sright = "16";
    String sbase = "45";

    ////from ww  w  . ja  v  a2s . c o m
    // Start QC Process
    //
    goToProjectHome();

    click(Locator.linkWithText(PROVISIONAL_HPLC_ASSAY));
    waitForElement(Locator.linkWithText(PROVISIONAL_HPLC_RUN));

    DataRegionTable runs = new DataRegionTable("Runs", this);
    runs.checkCheckbox(0);
    clickButton("QC Selected Run");

    log("Start the Qualitative Analysis");
    waitForElement(Locator.tagWithClass("div", "x4-grid-cell-inner").withText(samples[0]));
    clickButton("Define Standards", 0);
    sleep(1000);
    waitForElement(Locator.tagWithClass("div", "x4-grid-cell-inner").withText(standards[0]));

    for (String std : standards) {
        // check in concentration order
        _ext4Helper.checkGridRowCheckbox(std);
    }

    for (int i = 0; i < standards.length; i++) {
        Locator.XPathLocator runRow = Locator.tagWithAttribute("tr", "modelname", standards[i]);
        setFormElement(runRow.append(Locator.input("concentration")), concs[i]);
        if (i == 0) {
            setFormElement(runRow.append(Locator.input("xleft")), left);
            setFormElement(runRow.append(Locator.input("xright")), right);
            setFormElement(runRow.append(Locator.input("base")), base);
        }
    }

    click(Locator.button("C").index(0));
    waitForText("to all other selections?");
    clickButton("Yes", 0);

    // ensure the copy gets all the way to the last row
    waitForElement(Locator.tagWithAttribute("tr", "modelname", standards[standards.length - 1])
            .append(Locator.input("base").withAttribute("value", base)));

    setFormElement(Locator.input("standardname"), standardName);
    clickButton("Calibration Curve", 0);
    waitForElement(Locator.id("standardrsquared-inputEl").containing("0.99"));

    clickButton("Save", 0);
    waitForElement(Locator.tagWithClass("div", "x4-grid-cell-inner").withText(standardName));

    log("Quality Control Samples");
    clickButton("Return to Samples", 0);
    waitForElement(Locator.tagWithClass("div", "x4-grid-cell-inner").withText(samples[0]));

    for (String samp : samples) {
        _ext4Helper.checkGridRowCheckbox(samp);
    }

    clickButton("Start QC", 0);
    waitForElementToDisappear(Locator.id("sampleinputs").notHidden());

    new ComboBox.ComboBoxFinder(getDriver()).withIdPrefix("compoundlist").find(getDriver())
            .selectComboBoxItem("Squawk");
    new ComboBox.ComboBoxFinder(getDriver()).withIdPrefix("standardslist").find(getDriver())
            .selectComboBoxItem(standardName);
    new ComboBox.ComboBoxFinder(getDriver()).withIdPrefix("formulationlist").find(getDriver())
            .selectComboBoxItem(FORMULATION);
    new ComboBox.ComboBoxFinder(getDriver()).withIdPrefix("temperaturelist").find(getDriver())
            .selectComboBoxItem("5");
    new ComboBox.ComboBoxFinder(getDriver()).withIdPrefix("timelist").find(getDriver())
            .selectComboBoxItem("T=0");

    Locator.XPathLocator firstSampleRow = Locator.tagWithAttribute("tr", "modelname", samples[0]);
    setFormElement(firstSampleRow.append(Locator.input("xleft")), sleft);
    setFormElement(firstSampleRow.append(Locator.input("xright")), sright);
    setFormElement(firstSampleRow.append(Locator.input("base")), sbase);
    click(Locator.button("C").index(0));
    waitForText("to all other selections?");
    clickButton("Yes", 0);

    // ensure the copy gets all the way to the last row
    waitForElement(Locator.tagWithAttribute("tr", "modelname", samples[samples.length - 1])
            .append(Locator.input("base").withAttribute("value", sbase)));

    clickButton("Calculate", 0);
    shortWait().until(ExpectedConditions.textToBePresentInElementValue(By.name("avgconc"), "-24.")); // -24.76
    shortWait().until(ExpectedConditions.textToBePresentInElementValue(By.name("stddev"), "10.")); // 10.69

    waitForSampleFormValidation();
    waitAndClick(Ext4Helper.Locators.ext4Button("Submit Analysis").enabled());
    waitForText("successfully");
    waitForElementToDisappear(Ext4Helper.Locators.ext4Button("Submit Analysis").enabled());
}

From source file:org.xframium.page.element.SeleniumElement.java

License:Open Source License

@Override
protected boolean _waitFor(long timeOut, TimeUnit timeUnit, WAIT_FOR waitType, String value) {
    long startTime = System.currentTimeMillis();
    if ("V_TEXT".equals(getBy().name().toUpperCase())) {
        boolean returnValue = Boolean.parseBoolean(PerfectoMobile.instance().imaging()
                .textExists(getExecutionId(), getDeviceName(), getKey(), (short) timeOut, 50).getStatus());

        PageManager.instance().addExecutionLog(getExecutionId(), getDeviceName(), getPageName(),
                getElementName(), "waitFor", System.currentTimeMillis(), System.currentTimeMillis() - startTime,
                returnValue ? StepStatus.SUCCESS : StepStatus.FAILURE, getKey(), null, 0, "", false,
                new String[] { waitType.name().toLowerCase() });

        return returnValue;
    } else {//from   w ww  .  j  ava2s.  c o m

        try {

            String currentContext = null;
            if (webDriver instanceof ContextAware)
                currentContext = ((ContextAware) webDriver).getContext();

            WebDriverWait wait = new WebDriverWait(webDriver, timeOut, 250);
            WebElement webElement = null;

            switch (waitType) {
            case CLICKABLE:
                webElement = wait.until(ExpectedConditions.elementToBeClickable(useBy()));
                break;

            case INVISIBLE:
                return wait.until(ExpectedConditions.invisibilityOfElementLocated(useBy()));

            case PRESENT:

                webElement = wait.until(ExpectedConditions.presenceOfElementLocated(useBy()));
                break;

            case SELECTABLE:
                return wait.until(ExpectedConditions.elementToBeSelected(useBy()));

            case TEXT_VALUE_PRESENT:
                return wait.until(ExpectedConditions.textToBePresentInElementValue(useBy(), value));

            case VISIBLE:
                webElement = wait.until(ExpectedConditions.visibilityOfElementLocated(useBy()));
                break;

            default:
                throw new IllegalArgumentException("Unknown Wait Condition [" + waitType + "]");
            }

            if (currentContext != null && webDriver instanceof ContextAware)
                ((ContextAware) webDriver).context(currentContext);

            PageManager.instance().addExecutionLog(getExecutionId(), getDeviceName(), getPageName(),
                    getElementName(), "waitFor", System.currentTimeMillis(),
                    System.currentTimeMillis() - startTime,
                    webElement != null ? StepStatus.SUCCESS : StepStatus.FAILURE, getKey(), null, 0, "",
                    webElement instanceof CachedElement, new String[] { waitType.name().toLowerCase() });
            return webElement != null;
        } catch (Exception e) {
            log.error(Thread.currentThread().getName() + ": Could not locate " + useBy(), e);
            throw new ObjectIdentificationException(getBy(), useBy());
        }
    }
}

From source file:org.zanata.page.administration.ServerConfigurationPage.java

License:Open Source License

public boolean expectFieldValue(final By by, final String expectedValue) {
    log.info("Wait for field {} value {}", by.toString(), expectedValue);
    return waitForAMoment().withMessage("text present: " + by.toString())
            .until(ExpectedConditions.textToBePresentInElementValue(existingElement(by), expectedValue));
}