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

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

Introduction

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

Prototype

public static ExpectedCondition<WebElement> elementToBeClickable(final WebElement element) 

Source Link

Document

An expectation for checking an element is visible and enabled such that you can click it.

Usage

From source file:com.codenvy.ide.pageObjects.NewProxyObjects.java

License:Open Source License

/**
 * Performs the button action/*from  w  w w  . j a v a  2s.  c  om*/
 * @throws Exception
 */
public void finishButtonAction() throws Exception {
    try {
        finishButtonElement.click();
    } catch (TimeoutException toe) {
        WebDriverWait wait = new WebDriverWait(driver, 10);
        wait.until(ExpectedConditions.elementToBeClickable(finishButtonElement));
    } catch (NoSuchElementException e) {
        log.error("Button element is not available", e);
    } /*catch (Exception e) {
       throw (e);
      }*/
}

From source file:com.codenvy.ide.pageObjects.NewProxyObjects.java

License:Open Source License

/**
 * Performs the list box action/*  w w w. j  av  a 2 s  .c om*/
 * @param proxyType Type of the proxy
 * @throws Exception
 */
public void checkListBoxAction(String proxyType) throws Exception {
    try {
        Select droplist = new Select(proxyTypeElement);
        droplist.selectByVisibleText(proxyType);
        proxyTypeElement.click();
    } catch (TimeoutException toe) {
        WebDriverWait wait = new WebDriverWait(driver, 10);
        wait.until(ExpectedConditions.elementToBeClickable(proxyTypeElement));
    } catch (NoSuchElementException e) {
        log.error("List Box element is not available", e);
    } /*catch (Exception e) {
       throw (e);
      }*/
}

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

License:Open Source License

/**
 * Select the WSO2 Developer Studio menu
 *
 * @throws Exception/*from  w  ww.  j  a v  a  2 s .co  m*/
 */
public void selectWSO2DevStudioMenu() throws Exception {

    try {
        wso2DevStudioAction.click();
        wso2AboutAction.click();
        wso2AboutActionClick.click();
        wso2AboutActionClose.click();

    } catch (TimeoutException toe) {
        WebDriverWait wait = new WebDriverWait(driver, GWTIDConstants.WAITING_TIME_CONSTANT);
        wait.until(ExpectedConditions.elementToBeClickable(wso2DevStudioAction));
        wait.until(ExpectedConditions.elementToBeClickable(wso2AboutAction));
        wait.until(ExpectedConditions.elementToBeClickable(wso2AboutActionClick));

    } catch (Exception e) {
        logger.error("An exception was thrown in running the UI test on About dialog", e);
    }

}

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

License:Open Source License

/**
 * tests the WSO2 App Server project creation UI
 *
 * @throws Exception/* w ww. ja va  2 s.  c  om*/
 */
public void createNewWSO2AppServerProject() {

    try {
        for (int projectTypeOrder = 1; projectTypeOrder <= GWTIDConstants.noOfAppServerProjects; projectTypeOrder++) {
            wso2FileMenu.click();
            wso2NewOption.click();
            wso2NewProjectOption.click();
            wso2NewProjectCategoriesList.click();
            String dynamicProjectXpath = GWTIDConstants.WSO2_NEW_PROJECT_TYPE_XPATH + "div[" + projectTypeOrder
                    + "]";
            wso2NewProject = driver.findElement(By.xpath(dynamicProjectXpath));
            wso2NewProject.click();
            String projectType = driver.findElement(By.xpath(dynamicProjectXpath)).getText();
            if (projectType.equals(GWTIDConstants.JAX_RS_PROJECT_TYPE)) { // because the x path for the project type might change
                enterJAXRSProjectDetails();
            } else if (projectType.equals(GWTIDConstants.JAX_WS_PROJECT_TYPE)) {
                enterJAXWSProjectDetails();
            } else if (projectType.equals(GWTIDConstants.WEB_APP_PROJECT_TYPE)) {
                enterWebAppProjectDetails();
            }
        }

    } catch (TimeoutException toe) {
        WebDriverWait wait = new WebDriverWait(driver, GWTIDConstants.WAITING_TIME_CONSTANT);
        wait.until(ExpectedConditions.elementToBeClickable(wso2FileMenu));
        wait.until(ExpectedConditions.elementToBeClickable(wso2NewOption));
        wait.until(ExpectedConditions.elementToBeClickable(wso2NewProjectOption));
        wait.until(ExpectedConditions.elementToBeClickable(wso2NewProjectCategoriesList));
        wait.until(ExpectedConditions.elementToBeClickable(wso2NewProject));
    } catch (Exception e) {
        logger.error("An exception was thrown in running the UI test on App server Project creation", e);
    }
}

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

License:Open Source License

/**
 * tests the JAX RS Project creation wizard
 *///from   w  w w.  j  av  a 2  s.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   ww w .j  ava  2 s . 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  va  2 s  .co  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.coderoad.automation.common.util.old.BasePage.java

License:Open Source License

/**
 * Wait for element presence./*  w ww . ja v a2  s .  c  o m*/
 * 
 * @param element the element
 */
@SuppressWarnings("unused")
protected void waitForElementPresence(String element) {

    LogUtil.log("Start waitForElementPresence : " + this.getTimeStamp(), LogLevel.HIGH);
    for (int i = 0; i < 3; i++) {
        try {
            WebElement myDynamicElement = (new WebDriverWait(driver, TestUtils.timeout))
                    .until(ExpectedConditions.elementToBeClickable(By.id(element)));
        } catch (Exception e) {
            LogUtil.log("Wait waitForElementPresence : + " + this.getTimeStamp(), LogLevel.HIGH);
        }
    }
    LogUtil.log("Done waitForElementPresence : " + this.getTimeStamp(), LogLevel.HIGH);
}

From source file:com.coderoad.automation.common.util.old.BasePage.java

License:Open Source License

/**
 * Wait for element presence.// www  . ja v  a 2  s.c  o  m
 * 
 * @param by the by
 */
@SuppressWarnings("unused")
protected void waitForElementPresence(final By by) {

    LogUtil.log("Start waitForElementPresence : + " + this.getTimeStamp(), LogLevel.HIGH);
    for (int i = 0; i < 3; i++) {
        try {
            WebElement myDynamicElement = (new WebDriverWait(driver, TestUtils.timeout))
                    .until(ExpectedConditions.elementToBeClickable(by));
        } catch (Exception e) {
            LogUtil.log("Wait waitForElementPresence : + " + this.getTimeStamp(), LogLevel.HIGH);
        }
    }
    LogUtil.log("Done waitForElementPresence : + " + this.getTimeStamp(), LogLevel.HIGH);
}

From source file:com.coderoad.automation.common.util.PageUtil.java

License:Open Source License

/**
 * Checks if is element clickable.//from  w ww.j a  v a2 s .co m
 * 
 * @param driver the driver
 * @param element the element
 * @param timeout the timeout
 * @return the web element
 */
public static WebElement isElementClickable(final WebDriver driver, final WebElement element,
        final Timeout timeout) {

    try {
        return new WebDriverWait(driver, timeout.getValue())
                .until(ExpectedConditions.elementToBeClickable(element));
    } catch (Exception te) {
        return null;
    }
}