Example usage for org.openqa.selenium WebElement isEnabled

List of usage examples for org.openqa.selenium WebElement isEnabled

Introduction

In this page you can find the example usage for org.openqa.selenium WebElement isEnabled.

Prototype

boolean isEnabled();

Source Link

Document

Is the element currently enabled or not?

Usage

From source file:com.mgmtp.jfunk.web.util.WebElementFinder.java

License:Apache License

private boolean checkElementForList(final WebElement element) {
    if (enabled != null) {
        if (enabled != element.isEnabled()) {
            return false;
        }/*from www  .ja  v a 2s  .c  om*/
    }
    if (displayed != null) {
        if (displayed != element.isDisplayed()) {
            return false;
        }
    }
    if (selected != null) {
        if (selected != element.isSelected()) {
            return false;
        }
    }
    return true;
}

From source file:com.mgmtp.jfunk.web.util.WebElementFinder.java

License:Apache License

private void checkElement(final WebElement element) {
    if (enabled != null) {
        if (enabled) {
            checkElementState(element, element.isEnabled(),
                    "Element '%s' was expected to be enabled but is not.");
        } else {/*from  ww w.  ja v a  2 s .co  m*/
            checkElementState(element, !element.isEnabled(),
                    "Element '%s' was expected to not be enabled but is.");
        }
    }
    if (displayed != null) {
        if (displayed) {
            checkElementState(element, element.isDisplayed(),
                    "Element '%s' was expected to be displayed but is not.");
        } else {
            checkElementState(element, !element.isDisplayed(),
                    "Element '%s' was expected to not be displayed but is.");
        }
    }
    if (selected != null) {
        if (selected) {
            checkElementState(element, element.isSelected(),
                    "Element '%s' was expected to be selected but is not.");
        } else {
            checkElementState(element, !element.isSelected(),
                    "Element '%s' was expected to not be selected but is.");
        }
    }
}

From source file:com.NFHS.PageObjects.UserAccountPage.java

public void oneEnabledTwoDisabled() throws Exception {

    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
    if (webElementProperty("1breadcrumb").isEnabled() || !webElementProperty("2breadcrumb").isEnabled()) {
        driver.manage().timeouts().implicitlyWait(2, TimeUnit.MINUTES);
        WebElement nextbtn = webElementProperty("nextbutton");
        if (nextbtn.isEnabled()) {
            nextbtn.click();/* w  w w .j av a2s  .  com*/
        }
    }
}

From source file:com.NFHS.PageObjects.UserAccountPage.java

public void twoEnabledThreeDisabled() throws Exception {
    driver.manage().timeouts().implicitlyWait(2, TimeUnit.MINUTES);
    if (webElementProperty("2breadcrumb").isEnabled() || !webElementProperty("3breadcrumb").isEnabled()) {
        driver.manage().timeouts().implicitlyWait(2, TimeUnit.MINUTES);
        WebElement nextbtn = webElementProperty("nextbutton");
        if (nextbtn.isEnabled()) {
            nextbtn.click();/* ww w  .j  av  a2s  .  c o  m*/
        }
    }
}

From source file:com.NFHS.PageObjects.UserAccountPage.java

public void threeEnabledFourDisabled() throws Exception {
    driver.manage().timeouts().implicitlyWait(2, TimeUnit.MINUTES);
    if (webElementProperty("3breadcrumb").isEnabled() || !webElementProperty("4breadcrumb").isEnabled()) {
        driver.manage().timeouts().implicitlyWait(2, TimeUnit.MINUTES);
        WebElement nextbtn = webElementProperty("nextbutton");
        if (nextbtn.isEnabled()) {
            nextbtn.click();/*from ww w. j  a  v  a  2  s .co m*/
        }
    }
}

From source file:com.NFHS.PageObjects.UserAccountPage.java

public void fourEnabledFiveDisabled() throws Exception {
    driver.manage().timeouts().implicitlyWait(2, TimeUnit.MINUTES);
    if (webElementProperty("4breadcrumb").isEnabled() || !webElementProperty("5breadcrumb").isEnabled()) {
        driver.manage().timeouts().implicitlyWait(2, TimeUnit.MINUTES);
        WebElement nextbtn = webElementProperty("nextbutton");
        if (nextbtn.isEnabled()) {
            nextbtn.click();/*from w w  w .j a v a  2 s  .c  o m*/
        }
    }
}

From source file:com.NFHS.PageObjects.UserAccountPage.java

public void isOneEnabled() throws Exception {
    driver.manage().timeouts().implicitlyWait(2, TimeUnit.MINUTES);
    if (webElementProperty("1breadcrumb").isEnabled()) {
        driver.manage().timeouts().implicitlyWait(2, TimeUnit.MINUTES);
        WebElement nextbtn = webElementProperty("nextbutton");
        if (nextbtn.isEnabled()) {
            nextbtn.click();/*from   w  w  w . j  a  v a  2s . c om*/
        }
    }
}

From source file:com.NFHS.PageObjects.UserAccountPage.java

public void isTwoEnabled() throws Exception {
    driver.manage().timeouts().implicitlyWait(2, TimeUnit.MINUTES);
    if (webElementProperty("2breadcrumb").isEnabled()) {
        driver.manage().timeouts().implicitlyWait(2, TimeUnit.MINUTES);
        WebElement nextbtn = webElementProperty("nextbutton");
        if (nextbtn.isEnabled()) {
            nextbtn.click();//from   w  ww. j a  va 2s  .c  om
        }
    }

}

From source file:com.NFHS.PageObjects.UserAccountPage.java

public void isThreeEnabled() throws Exception {
    driver.manage().timeouts().implicitlyWait(2, TimeUnit.MINUTES);
    if (webElementProperty("3breadcrumb").isEnabled()) {
        driver.manage().timeouts().implicitlyWait(2, TimeUnit.MINUTES);
        WebElement nextbtn = webElementProperty("nextbutton");
        if (nextbtn.isEnabled()) {
            nextbtn.click();/*from  w  w w.  ja v a  2s .c om*/
        }
    }

}

From source file:com.NFHS.PageObjects.UserAccountPage.java

public void isFourEnabled() throws Exception {
    driver.manage().timeouts().implicitlyWait(2, TimeUnit.MINUTES);
    if (webElementProperty("4breadcrumb").isEnabled()) {
        driver.manage().timeouts().implicitlyWait(2, TimeUnit.MINUTES);
        WebElement nextbtn = webElementProperty("nextbutton");
        if (nextbtn.isEnabled()) {
            nextbtn.click();/*from  w  w w. j a  v a  2s  . co m*/
        }
    }

}