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

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

Introduction

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

Prototype

public static ExpectedCondition<Boolean> elementToBeSelected(final By locator) 

Source Link

Usage

From source file:com.codenvy.ide.test.NewWSO2AppServerProjectCreation.java

License:Open Source License

/**
 * tests the JAX RS Project creation wizard
 */// w  ww.ja v  a  2s . c o  m
public void enterJAXRSProjectDetails() {
    try {
        wso2NewProjectName.sendKeys(GWTIDConstants.TEST_JAXRS_PROJECT_NAME);
        wso2NewProjectDescrption.sendKeys(GWTIDConstants.TEST_PROJECT_DESCRIPTION);
        wso2NewProjectNextButton.click();
        wso2NewProjectArtifactId.sendKeys(GWTIDConstants.TEST_PROJECT_ARTIFACT_ID);
        wso2NewProjectGroupId.sendKeys(GWTIDConstants.TEST_PROJECT_GROUP_ID);
        wso2NewProjectVersionId.sendKeys(GWTIDConstants.TEST_PROJECT_VERSION_ID);
        wso2NewProjectCreateButton.click();
    } catch (TimeoutException toe) {
        WebDriverWait wait = new WebDriverWait(driver, GWTIDConstants.WAITING_TIME_CONSTANT);
        wait.until(ExpectedConditions.elementToBeClickable(wso2NewProjectName));
        wait.until(ExpectedConditions.elementToBeSelected(wso2NewProjectDescrption));
        wait.until(ExpectedConditions.elementToBeClickable(wso2NewProjectNextButton));
        wait.until(ExpectedConditions.elementToBeClickable(wso2NewProjectArtifactId));
        wait.until(ExpectedConditions.elementToBeClickable(wso2NewProjectGroupId));
        wait.until(ExpectedConditions.elementToBeClickable(wso2NewProjectVersionId));
        wait.until(ExpectedConditions.elementToBeClickable(wso2NewProjectCreateButton));
    } catch (Exception e) {
        logger.error("An exception was thrown in running the UI test on JAX RS Project creation", e);
    }
}

From source file:com.codenvy.ide.test.NewWSO2AppServerProjectCreation.java

License:Open Source License

/**
 * tests the JAX WS Project creation wizard
 *///from   w w w  . jav a  2s .co m
public void enterJAXWSProjectDetails() {
    try {
        wso2NewProjectName.sendKeys(GWTIDConstants.TEST_JAXWS_PROJECT_NAME);
        wso2NewProjectDescrption.sendKeys(GWTIDConstants.TEST_PROJECT_DESCRIPTION);
        wso2NewProjectNextButton.click();
        wso2NewProjectArtifactId.sendKeys(GWTIDConstants.TEST_PROJECT_ARTIFACT_ID);
        wso2NewProjectGroupId.sendKeys(GWTIDConstants.TEST_PROJECT_GROUP_ID);
        wso2NewProjectVersionId.sendKeys(GWTIDConstants.TEST_PROJECT_VERSION_ID);
        wso2NewProjectCreateButton.click();
    } catch (TimeoutException toe) {
        WebDriverWait wait = new WebDriverWait(driver, GWTIDConstants.WAITING_TIME_CONSTANT);
        wait.until(ExpectedConditions.elementToBeClickable(wso2NewProjectName));
        wait.until(ExpectedConditions.elementToBeSelected(wso2NewProjectDescrption));
        wait.until(ExpectedConditions.elementToBeClickable(wso2NewProjectNextButton));
        wait.until(ExpectedConditions.elementToBeClickable(wso2NewProjectArtifactId));
        wait.until(ExpectedConditions.elementToBeClickable(wso2NewProjectGroupId));
        wait.until(ExpectedConditions.elementToBeClickable(wso2NewProjectVersionId));
        wait.until(ExpectedConditions.elementToBeClickable(wso2NewProjectCreateButton));
    } catch (Exception e) {
        logger.error("An exception was thrown in running the UI test on JAX WS Project creation", e);
    }
}

From source file:com.codenvy.ide.test.NewWSO2AppServerProjectCreation.java

License:Open Source License

/**
 * tests the Web App Project creation wizard
 *//*from w  ww .  ja v a 2  s.c  o  m*/
public void enterWebAppProjectDetails() {
    try {
        wso2NewProjectName.sendKeys(GWTIDConstants.TEST_WEBAPP_PROJECT_NAME);
        wso2NewProjectDescrption.sendKeys(GWTIDConstants.TEST_PROJECT_DESCRIPTION);
        wso2NewProjectNextButton.click();
        wso2NewProjectArtifactId.sendKeys(GWTIDConstants.TEST_PROJECT_ARTIFACT_ID);
        wso2NewProjectGroupId.sendKeys(GWTIDConstants.TEST_PROJECT_GROUP_ID);
        wso2NewProjectVersionId.sendKeys(GWTIDConstants.TEST_PROJECT_VERSION_ID);
        wso2NewProjectCreateButton.click();
    } catch (TimeoutException toe) {
        WebDriverWait wait = new WebDriverWait(driver, GWTIDConstants.WAITING_TIME_CONSTANT);
        wait.until(ExpectedConditions.elementToBeClickable(wso2NewProjectName));
        wait.until(ExpectedConditions.elementToBeSelected(wso2NewProjectDescrption));
        wait.until(ExpectedConditions.elementToBeClickable(wso2NewProjectNextButton));
        wait.until(ExpectedConditions.elementToBeClickable(wso2NewProjectArtifactId));
        wait.until(ExpectedConditions.elementToBeClickable(wso2NewProjectGroupId));
        wait.until(ExpectedConditions.elementToBeClickable(wso2NewProjectVersionId));
        wait.until(ExpectedConditions.elementToBeClickable(wso2NewProjectCreateButton));
    } catch (Exception e) {
        logger.error("An exception was thrown in running the UI test on Web Application Project creation", e);
    }
}

From source file:com.elastica.webelements.BasePage.java

License:Apache License

public void waitForElementChecked(final HtmlElement element) {
    Assert.assertNotNull(element, "Element can't be null");
    TestLogging.logWebStep(null, "wait for " + element.toString() + " to be checked.", false);

    WebDriverWait wait = new WebDriverWait(driver, explictWaitTimeout);
    wait.until(ExpectedConditions.elementToBeSelected(element.getBy()));
}

From source file:org.eclipse.che.selenium.pageobject.git.GitCommit.java

License:Open Source License

/**
 * Wait for item check-box in the 'Git changed files tree panel' to be selected..
 *
 * @param itemName name of the item//from  w  ww . java 2s  .c o m
 */
public void waitItemCheckBoxToBeSelected(String itemName) {
    new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
            .until(ExpectedConditions.elementToBeSelected(
                    (By.xpath(String.format(Locators.TREE_ITEM_CHECK_BOX + "//input", itemName)))));
}

From source file:org.eclipse.che.selenium.pageobject.git.GitPush.java

License:Open Source License

/** Set checked 'force push' check-box. */
public void selectForcePushCheckBox() {
    forcePush.click();/*  w w  w  . jav  a  2s. com*/
    new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
            .until(ExpectedConditions.elementToBeSelected(By.id(Locators.FORCE_PUSH_CHECKBOX + "-input")));
}

From source file:org.eclipse.che.selenium.pageobject.intelligent.CommandsExplorer.java

License:Open Source License

public void chooseCommandTypeInContextMenu(String type) {
    new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
            .until(ExpectedConditions.visibilityOfElementLocated(
                    By.xpath("//div[@class='popupContent']/select[contains(@class,'gwt-ListBox')]")));
    WebElement commandTypeElement = new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
            .until(ExpectedConditions.elementToBeClickable(getCommandTypeElementInContextMenu(type)));
    commandTypeElement.click();/*w w w. jav  a  2 s .  co  m*/
    new WebDriverWait(seleniumWebDriver, REDRAW_UI_ELEMENTS_TIMEOUT_SEC)
            .until(ExpectedConditions.elementToBeSelected(commandTypeElement));
    // add timeout to be sure webelement ready to dbClick in some test got exception here
    WaitUtils.sleepQuietly(200, TimeUnit.MILLISECONDS);
    new Actions(seleniumWebDriver).doubleClick(commandTypeElement).perform();
}

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  w  w  .  j a va 2  s.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:test.nov21.configuration.AbstractPage.java

License:Open Source License

public WebElement waitForElementToBeClickable(final WebElement element, int timeout) {
    Wait<WebDriver> wait = new WebDriverWait(getDriver(), timeout, 100);
    wait.until(ExpectedConditions.elementToBeSelected(element));
    return element;
}