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:pages.CreateAdPage.java

private void waitAndClick(By by) {
    wait.until(ExpectedConditions.elementToBeClickable(by));
    driver.findElement(by).click();
}

From source file:Pages.CustInfoPages.Cust_CustomerInfoPage.java

public void clickConfirmWithCustomer(WebDriver driver) {
    wait.until(ExpectedConditions.elementToBeClickable(confirmWithCustomer)).click();
}

From source file:renascere.Renascere.java

License:Open Source License

/**
 * @Description Method that find an object by a BY.
 *//*from   www.ja  va2 s .co  m*/
public static WebElement findObject(By byObject, WebDriver driver, object osScope) {
    WebElement wElement;
    try {
        WebDriverWait waitForElement = new WebDriverWait(driver, Global.gTimeOut);
        waitForElement.until(ExpectedConditions.presenceOfElementLocated(byObject));
        wElement = driver.findElement(byObject);
        waitForElement.until(ExpectedConditions.visibilityOf(wElement));
        if (osScope.equals(object.CLICKABLE)) {
            waitForElement.until(ExpectedConditions.elementToBeClickable(wElement));
        }
        if (!osScope.equals(object.PRESENT)) {
            logMessage(result.PASS, "Element (" + byObject + ") found.");
        }
        pauseExecution(Global.fTimeQSecond);
        return wElement;
    } catch (Exception e) {
        if (!osScope.equals(object.VISIBLE)) {
            logMessage(result.FAIL, "Element (" + byObject + ") not found!");
        }
        return null;
    }
}

From source file:runThrghTestNG.Statement_process.java

@Test(groups = { "StatementTest" }, priority = 3)
public void Statement_processing_step2_fields_prev_button_functionality() throws InterruptedException {
    new WebDriverWait(driver, 15).until(ExpectedConditions.elementToBeClickable(
            By.id("MasterPageContent_wzdImport_StepNavigationTemplateContainerID_StepPreviousButton")));
    driver.findElement(//from   w  w  w  . j av a  2 s  .c om
            By.id("MasterPageContent_wzdImport_StepNavigationTemplateContainerID_StepPreviousButton")).click();
    //driver.findElement(caller.Elements(CONFIGOBJ.getProperty("st_prev"))).click();
    Thread.sleep(4000);
    Assert.assertEquals("Statement Import Wizard", driver.getTitle());
    driver.findElement(caller.Elements(CONFIGOBJ.getProperty("st_step1_next"))).click();
    Thread.sleep(5000);
}

From source file:se.nackademin.selenide.pages.BookViewPage.java

public void waitForPageToLoad() {
    WebElement element = new WebDriverWait(getWebDriver(), 30)
            .until(ExpectedConditions.elementToBeClickable(nbrOfCopiesAvailableField));
}

From source file:se.nackademin.selenide.pages.MenuPage.java

/**
 * Waits up to 10 seconds for Profile Link to become visible 
 *//* ww w.jav  a  2 s  .  co  m*/
public void waitForProfileLinkToShow() {
    WebDriverWait wait;
    wait = new WebDriverWait(getWebDriver(), 10);
    WebElement element;
    element = wait.until(ExpectedConditions.elementToBeClickable(myProfile));
}

From source file:se.nackademin.selenide.pages.UserFormPage.java

public void clickLibrarianRadioButton() {

    clickButton("librarian role radio button", librarianRadioButton);
    WebElement element = new WebDriverWait(getWebDriver(), 30)
            .until(ExpectedConditions.elementToBeClickable(librarianRadioButton));
    element.sendKeys(Keys.SPACE);//from  ww  w  .  ja  va2  s .  c  o m
}

From source file:selenium_tumblr_test.BasePage.java

License:Open Source License

public void waitForElementToBeClickable(By elementBy, int seconds) {
    WebElement element = (new WebDriverWait(driver, seconds))
            .until(ExpectedConditions.elementToBeClickable(elementBy));
}

From source file:SmokeTests.Pages.ThirdPartyConnectionsPage.java

public void openThirdPartyPage() {
    totalResultMessage += "Open Third Party Connections page\n";
    driver.findElement(setUpButtonLocator).click();
    driver.findElement(thirdPartyButtonLocator).click();
    final Wait<WebDriver> wait = new WebDriverWait(driver, timeoutVariable)
            .withMessage("'Third Party' page was not loaded");
    wait.until(ExpectedConditions.elementToBeClickable(authorizeLoginFieldLocator));
    ProgressBar.addProgressValue(progressVariable);
}

From source file:SmokeTests.Pages.ThirdPartyConnectionsPage.java

public void configureUPSAccount(String userName, String password, String licenseNumber, String shipperNumber) {
    totalResultMessage += "Select Carrier Getaway Tab\n";
    driver.findElement(carrierGetawayTabLocator).click();

    totalResultMessage += "Set UPS credentials:\n";
    totalResultMessage += " - Click UPS checkbox\n";
    ProgressBar.addProgressValue(progressVariable);

    String upsIsChecked = driver.findElement(upsConfigurationCheckboxLocator).getAttribute("checked");

    if (!Objects.equals(upsIsChecked, "true")) {
        driver.findElement(upsConfigurationCheckboxLocator).click();
        totalResultMessage += "UPS checkbox was not selected\n";
    } else {/*  w  ww. j  a va 2s  .com*/
        totalResultMessage += "UPS checkbox was selected\n";
    }
    ProgressBar.addProgressValue(progressVariable);

    final Wait<WebDriver> wait3 = new WebDriverWait(driver, timeoutVariable)
            .withMessage("'UPS User Name' field was not found");
    WebElement element2 = wait3.until(ExpectedConditions.elementToBeClickable(upsUserNameFieldLocator));
    Assert.assertEquals(element2.isDisplayed(), true, "'UPS User Name' field was not loaded");

    totalResultMessage += " - Enter UPS username\n";
    WebElement userNameField = driver.findElement(upsUserNameFieldLocator);
    userNameField.clear();
    userNameField.sendKeys(userName);
    ProgressBar.addProgressValue(progressVariable);

    totalResultMessage += " - Enter UPS password\n";
    WebElement passwordField = driver.findElement(upsPasswordFieldLocator);
    passwordField.clear();
    passwordField.sendKeys(password);
    ProgressBar.addProgressValue(progressVariable);

    totalResultMessage += " - Enter UPS License Number\n";
    WebElement licenseNumberField = driver.findElement(upsLicenseNumberFieldLocator);
    licenseNumberField.clear();
    licenseNumberField.sendKeys(licenseNumber);
    ProgressBar.addProgressValue(progressVariable);

    totalResultMessage += " - Enter UPS Shipper Number\n";
    WebElement shipperNumberField = driver.findElement(upsShipperNumberFieldLocator);
    shipperNumberField.clear();
    shipperNumberField.sendKeys(shipperNumber);
    ProgressBar.addProgressValue(progressVariable);

    //          Test for UPS connection

    //        log("Make Test for UPS");
    //        driver.findElement(upsTestButtonLocator).click();
    //        final Wait<WebDriver> wait = new WebDriverWait(driver, timeoutVariable).withMessage("UPS test result popup was not found");
    //        wait.until(ExpectedConditions.visibilityOfElementLocated(testResultPopupLocator));
    //
    //        String currentPopupMessage = driver.findElement(testResultPopupLocator).getText();
    //        Assert.assertEquals(currentPopupMessage, "The connection test was successful.", "UPS test result unexpected popup message.");
    //
    //        driver.findElement(confirmPopupButtonLocator).click();
}