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.autocognite.selenium.lib.SeleniumWebUiDriver.java

License:Apache License

public void hoverAndClick(WebElement element) throws Exception {
    try {//from   w  ww .  j a v a2 s. c  om
        Actions builder = getActionChain();
        builder.moveToElement(element).perform();
        getWaiter().until(ExpectedConditions.elementToBeClickable(element));
        element.click();
    } catch (Exception e) {
        moveToElementAndClick(element);
    }
}

From source file:com.autocognite.selenium.lib.SeleniumWebUiDriver.java

License:Apache License

public void hoverAndClick(By finder1, By finder2) throws Exception {
    Actions builder = null;/*w  w  w .  j  a  va  2  s.c om*/
    try {
        builder = getActionChain();
        builder.moveToElement(findElement(finder1)).perform();
        getWaiter().until(ExpectedConditions.elementToBeClickable(finder2));
        findElement(finder2).click();
    } catch (Exception e) {
        builder = getActionChain();
        builder.moveToElement(findElement(finder1)).click(findElement(finder2)).perform();
    }
}

From source file:com.chtr.tmoauto.webui.CommonFunctions.java

License:Open Source License

@Override
public WebElement elementToBeClickable(final String locator) {
    WebDriverWait wait = new WebDriverWait(webDriver, FIVE);
    return wait.until(ExpectedConditions.elementToBeClickable(getSelector(locator)));
}

From source file:com.chtr.tmoauto.webui.CommonFunctions.java

License:Open Source License

@Override
public WebElement findClickableElement(final String locator, int timeout) {
    log.debug("debug: Looking for element: {}", locator);
    WebElement e = (new WebDriverWait(webDriver, timeout))
            .until(ExpectedConditions.elementToBeClickable(getSelector(locator)));
    return e;/*  ww w.  ja v  a 2 s  . c  o  m*/
}

From source file:com.chtr.tmoauto.webui.CommonFunctions.java

License:Open Source License

@Override
public void waitForElementClickable(String guiElementDescription, int timeoutInSeconds)
        throws ElementNotVisibleException {
    WebElement e = null;/*from   w w w .j  a va  2s.c  om*/
    log.debug("Wait for Element Visible should time out in " + timeoutInSeconds);
    e = (new WebDriverWait(webDriver, timeoutInSeconds))
            .until(ExpectedConditions.elementToBeClickable(getSelector(guiElementDescription)));
    log.debug("end wait for Element Visible");
    if (e != null) {
        return;
    } else {
        throw new ElementNotVisibleException(guiElementDescription + " did not become visible.");
    }
}

From source file:com.cisco.dbds.utils.selenium.SeleniumUtilities.java

License:Open Source License

/**
 * Nvigate to URL.// w w  w. j a va2s  . c  om
 * 
 * @param url
 *            the url
 */
public static void navigateToUrl(String url) {
    driver.get(url);
    String browser = Validate.readsystemvariable("browser");
    if (browser.equals("IE")) {
        WebDriverWait wait = new WebDriverWait(driver, 10);
        WebElement ele = wait.until(ExpectedConditions.elementToBeClickable(
                driver.findElement(By.linkText("Continue to this website (not recommended)."))));
        ele.click();
    }
    // driver.get(driver.getCurrentUrl());
}

From source file:com.citrix.g2w.webdriver.pages.BasePage.java

License:Open Source License

/**
 * Method to find clickable element.// w w w .  j a  v a  2 s  .  co m
 *
 * @param by
 *            (by element)
 * @return (clickable element)
 */
public WebElement findClickableElement(final By by) {
    WebElement clickableElement;
    try {
        clickableElement = (new WebDriverWait(this.driver, this.DEFAULT_TIMEOUT))
                .until(ExpectedConditions.elementToBeClickable(by));
    } catch (Throwable cause) {
        String errorMessage = "Could not find clickable element: " + by.toString();
        this.logger.logWithScreenShot("findClickableElement failed.", this.driver);
        throw new RuntimeException(errorMessage);
    }
    return clickableElement;
}

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

License:Open Source License

/**
 * Selects the import proxy option/*from   ww w .  java2 s .  c o m*/
 * @throws Exception
 */
public void selectImportProxyOption() throws Exception {

    try {
        importProxyOption.click();

    } catch (TimeoutException toe) {
        WebDriverWait wait = new WebDriverWait(driver, 10);
        wait.until(ExpectedConditions.elementToBeClickable(importProxyOption));

    } catch (Exception e) {
        throw (e);
    }

}

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

License:Open Source License

/**
 * Performs the button action// w ww  . j ava  2  s .  c  om
 * @throws Exception
 */
public void fishButtonAction() 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

/**
 * Select the new proxy option//from w  w w. ja v  a 2 s . c om
 * @throws Exception
 */
public void selectNewProxyOption() throws Exception {

    try {
        newProxyOption.click();
    } catch (TimeoutException toe) {
        WebDriverWait wait = new WebDriverWait(driver, 10);
        wait.until(ExpectedConditions.elementToBeClickable(newProxyOption));
    } /*catch (Exception e) {
       log.error("",e);
       //throw (e);
      }*/

}