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:xbdd.stepdefs.AccessStepdefs.java

License:Apache License

private void login(final String username, final String password) {
    // navigate to landing page if the login form is not visible
    if (this.webDriver.findElements(By.id("j_username")).size() == 0) {
        the_user_can_access_xbdd();/*from   w w  w .j  a  v a  2 s  . co m*/
    }
    new WebDriverWait(this.webDriver, 10)
            .until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#j_username")))
            .sendKeys(username);
    new WebDriverWait(this.webDriver, 10)
            .until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#j_password")))
            .sendKeys(password);
    new WebDriverWait(this.webDriver, 10)
            .until(ExpectedConditions.elementToBeClickable(By.cssSelector(".btn-login"))).click();
}

From source file:xbdd.stepdefs.AdminStepdefs.java

License:Apache License

@When("^a rename request is sent$")
public void a_rename_request_is_sent() {
    this.webDriver.navigate().to(this.xbddInstance.getBaseURL());
    new WebDriverWait(this.webDriver, 10)
            .until(ExpectedConditions.elementToBeClickable(By.cssSelector(".product-action-menu button")));
    this.originalProductName = this.webDriver.findElement(By.cssSelector(".product-link"))
            .getAttribute("innerHTML");
    this.renameResp = this.client
            .target(this.xbddInstance.getBaseURL() + "rest/admin/" + this.originalProductName)
            .request(MediaType.APPLICATION_JSON_TYPE)
            .put(Entity.json("{\"name\": \"" + this.newProductName + "\"}"));
}

From source file:xbdd.stepdefs.AdminStepdefs.java

License:Apache License

@When("^the new name is set to an already existing name$")
public void the_new_name_is_set_to_an_already_existing_name() {
    this.webDriver.navigate().to(this.xbddInstance.getBaseURL());
    new WebDriverWait(this.webDriver, 10)
            .until(ExpectedConditions.elementToBeClickable(By.cssSelector(".product-action-menu button")));
    this.newProductName = this.webDriver.findElement(By.cssSelector(".product-link")).getAttribute("innerHTML");
}

From source file:xbdd.stepdefs.AdminStepdefs.java

License:Apache License

@When("^the user deletes the test report$")
public void the_user_deletes_the_test_report() {
    this.webDriver.navigate().to(this.xbddInstance.getBaseURL());
    new WebDriverWait(this.webDriver, 10)
            .until(ExpectedConditions.elementToBeClickable(By.cssSelector(".product-action-menu button")));
    this.ProductQuant = this.webDriver.findElements(By.cssSelector(".delete-product")).size();
    final String ProductName = this.webDriver.findElement(By.cssSelector(".product-link"))
            .getAttribute("innerHTML");
    final WebTarget webTarget = this.client
            .target(this.xbddInstance.getBaseURL() + "rest/admin/delete/" + ProductName);
    webTarget.request().delete();//from   ww w  . ja v  a  2 s  .  com
}