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:org.alfresco.po.share.cmm.admin.CreateNewPropertyPopUp.java

License:Open Source License

/**
 * Select close button.//from   w  ww. java2  s  .  co m
 * 
 * @return the manage properties page
 */
public HtmlPage selectCloseButton() {
    try {
        WebElement closebutton = driver.findElement(SHARE_DIALOGUE_CLOSE_ICON);

        if (closebutton.isEnabled() && (closebutton.isDisplayed())) {
            closebutton.click();
            return factoryPage.instantiatePage(driver, ManagePropertiesPage.class);
        }
    } catch (TimeoutException e) {
        LOGGER.trace("Unable to select the close button", e);
    }

    throw new PageOperationException("Unable to select the closebutton");
}

From source file:org.alfresco.po.share.cmm.admin.EditCustomTypePopUp.java

License:Open Source License

/**
 * Select close button./* ww  w . jav a2s  . c o m*/
 * 
 * @return the ManageTypesAndAspectsPage
 */
public HtmlPage selectCloseButton() {
    try {
        WebElement closebutton = driver.findElement(SHARE_DIALOGUE_CLOSE_ICON);

        if (closebutton.isEnabled() && (closebutton.isDisplayed())) {
            closebutton.click();
            return factoryPage.instantiatePage(driver, ManageTypesAndAspectsPage.class);
        }

    } catch (TimeoutException e) {
        LOGGER.trace("Unable to select the close button", e);
    }

    throw new PageOperationException("Unable to select the closebutton");
}

From source file:org.alfresco.po.share.cmm.admin.EditModelPopUp.java

License:Open Source License

/**
 * Verify name disabled//from ww w.  ja va  2s  .co m
 * 
 * @return boolean
 */
public boolean isNameDisabled() {
    try {
        // Get the name
        WebElement name = driver.findElement(NAME_TEXT);

        if (name.isDisplayed() && !name.isEnabled()) {
            return true;
        }

    } catch (Exception e) {
        LOGGER.debug("Timed out while getting the status of Name field: ", e);
    }
    return false;

}

From source file:org.alfresco.po.share.cmm.admin.EditModelPopUp.java

License:Open Source License

/**
 * Select close button in EditModelPopUp
 * /*from ww w. ja va2 s  . c  om*/
 * @return {@link ModelManagerPage Page} page response
 */
public HtmlPage selectCloseButton() {
    try {
        // Get the Close button web element
        WebElement closebutton = driver.findElement(SELECT_CLOSE_BUTTON);

        if (closebutton.isEnabled() && (closebutton.isDisplayed())) {
            closebutton.click();
            // return FactoryShareCMMPage.resolveCMMPage(driver).render();
            return factoryPage.getPage(driver);
        }

    } catch (TimeoutException e) {
        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("Unable to select the close button: ", e);
        }
    }

    throw new PageOperationException("Unable to select the closebutton");
}

From source file:org.alfresco.po.share.cmm.admin.EditPropertyGroupPopUp.java

License:Open Source License

/**
 * Select close button./* www  . j ava  2  s. com*/
 * 
 * @return the ManageTypesAndAspectsPage
 */
public HtmlPage selectCloseButton() {
    try {
        WebElement closebutton = driver.findElement(SHARE_DIALOGUE_CLOSE_ICON);

        if (closebutton.isEnabled() && (closebutton.isDisplayed())) {
            closebutton.click();
            return factoryPage.getPage(driver);
        }

    } catch (TimeoutException e) {
        LOGGER.trace("Unable to select the close button", e);
    }

    throw new PageOperationException("Unable to select the closebutton");
}

From source file:org.alfresco.po.share.cmm.admin.EditPropertyPopUp.java

License:Open Source License

/**
 * Select close button./*from www .  j  a  v a  2 s.  com*/
 * 
 * @return ManagePropertiesPage the manage properties page
 */
public HtmlPage selectCloseButton() {
    try {
        WebElement closebutton = driver.findElement(SHARE_DIALOGUE_CLOSE_ICON);

        if (closebutton.isEnabled() && (closebutton.isDisplayed())) {
            closebutton.click();
            return factoryPage.getPage(driver);
        }

    } catch (TimeoutException e) {
        LOGGER.trace("Unable to select the close button: ", e);
    }

    throw new PageOperationException("Unable to select the closebutton");
}

From source file:org.alfresco.po.share.EditGroupPage.java

License:Open Source License

/**
 * Checks if Save button is present and enabled
 * /*from   www  .  ja v  a2  s  . c o  m*/
 * @return boolean
 */
public boolean isSaveButtonEnabled() {
    try {
        WebElement searchButton = driver.findElement(SAVE_CHANGES_BUTTON);
        return searchButton.isDisplayed() && searchButton.isEnabled();
    } catch (NoSuchElementException e) {
        throw new PageException("Not found Element:" + SAVE_CHANGES_BUTTON, e);
    }
}

From source file:org.alfresco.po.share.NewUserPage.java

License:Open Source License

/**
 * Enter the search text is group finder text box and clicks Search on the new user page.
 *
 * @param user String name//from  w  w w .j av  a 2s. com
 * @return UserSearchPage page response
 */
public HtmlPage searchGroup(final String user) {
    try {
        WebElement input = findAndWait(By.cssSelector(GROUP_FINDER_SEARCH_TEXT));
        input.clear();
        input.sendKeys(user);
        WebElement searchButton = findAndWait(By.cssSelector(GROUP_SEARCH_BUTTON));
        searchButton.click();
        if (searchButton.isEnabled()) {
            searchButton.click();
        }
        return getCurrentPage();
    } catch (TimeoutException e) {
    }
    throw new PageException("Not able to perform Group Search.");
}

From source file:org.alfresco.po.share.PeopleFinderPage.java

License:Open Source License

@SuppressWarnings("unchecked")
@Override//from w  w  w  .  j  a  v  a 2s . co  m
public PeopleFinderPage render(RenderTime timer) {
    while (true) {
        timer.start();
        synchronized (this) {
            try {
                this.wait(100L);
            } catch (InterruptedException e) {
            }
        }
        try {
            // Check button is displayed and is not disabled
            WebElement searchBtn = driver.findElement(SEARCH_BUTTON);
            if (searchBtn.isEnabled()) {
                if (hasNoResultMessage()) {
                    break;
                }
                if (isVisibleResults()) {
                    break;
                }
                // This is the default html content hence it left to last.
                if (isHelpScreenDisplayed()) {
                    if (!isVisibleResults() && !hasNoResultMessage()) {
                        break;
                    }
                }
            }
        } catch (NoSuchElementException nse) {
            // Repeat till we see it
        } finally {
            timer.end();
        }
    }

    return this;
}

From source file:org.alfresco.po.share.search.CopyAndMoveContentFromSearchPage.java

License:Open Source License

/**
 * This method finds then clicks on copy/move/cancel button.
 * /*from  w  w w.  ja v a  2 s. c om*/
 * @param buttonName String
 * @return HtmlPage FacetedSearchResultsPage
 */
private HtmlPage selectButton(String buttonName) {
    if (StringUtils.isEmpty(buttonName)) {
        throw new IllegalArgumentException("button name is required");
    }

    try {
        List<WebElement> buttons = findDisplayedElements(copyMoveOkOrCancelButtonCss);
        for (WebElement button : buttons) {
            if (button.isDisplayed() && button.isEnabled()) {
                if (button.getText() != null) {
                    if (button.getText().equalsIgnoreCase(buttonName)) {
                        button.click();
                        waitUntilElementDisappears(errorPopUp, 10);
                        return getCurrentPage().render();

                    }
                }
            }
        }
        throw new PageOperationException("Unable to find the button: " + buttonName);
    } catch (NoSuchElementException ne) {
        if (logger.isTraceEnabled()) {
            logger.trace("Unable to find the inner text of button" + buttonName, ne);
        }
    } catch (TimeoutException e) {
        if (logger.isTraceEnabled()) {
            logger.trace("Unable to find the button" + buttonName, e);
        }
    }

    throw new PageOperationException("Unable to select button." + buttonName);
}