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.site.create.CreateSiteDialog.java

License:Open Source License

/**
 * Check if Private Visibility is enabled
 *///from  w w w. ja  va2s .  co  m
public boolean isPrivateVisibilityEnabled() {
    WebElement privateRadioButton = siteVisibility.getButtons().get(PRIVATE_RADIO_BUTTON_INDEX);
    return privateRadioButton.isEnabled();
}

From source file:org.alfresco.po.share.site.document.DetailsPage.java

License:Open Source License

/**
 * Check is Remove and Edit Buttons display and Enable.
 *
 * @param comment String/*from   www .  jav a 2 s .  c  o  m*/
 * @return boolean
 */

private boolean isCommentButtonsEnableAndDisplay(String comment) {
    WebElement commentElement = getCommentWebElement(comment);
    mouseOver(commentElement);
    WebElement edit = commentElement.findElement(By.name(".onEditCommentClick"));
    WebElement delete = commentElement.findElement(By.name(".onConfirmDeleteCommentClick"));
    return edit.isEnabled() && delete.isEnabled() && edit.isDisplayed() && delete.isDisplayed();
}

From source file:org.alfresco.po.share.site.document.DetailsPage.java

License:Open Source License

private boolean isCommentatorNameDisplayAndEnable(String comment) {
    WebElement commentElement = getCommentWebElement(comment);
    WebElement commentatorName = commentElement.findElement(By.xpath(".//img[@alt='Avatar']"));
    return commentatorName.isDisplayed() && commentatorName.isEnabled();
}

From source file:org.alfresco.po.share.site.document.DetailsPage.java

License:Open Source License

private boolean isDeleteDialogButtonsEnableAndDisplay() {
    boolean result = false;
    List<WebElement> buttons = findAndWaitForElements(By.cssSelector("#prompt button"));
    for (WebElement button : buttons) {
        result = button.isDisplayed() && button.isEnabled();
    }/*from   www. j  av  a  2 s.  c om*/
    return result;
}

From source file:org.alfresco.po.share.site.document.DocumentLibraryNavigation.java

License:Open Source License

/**
 * Introduced in Enterprise 4.2 dropdown with actions
 * to create different content such as folders and files.
 * /*from   w  w  w .  jav a2 s.  c o m*/
 * @return Current Page of {@link HtmlPage}
 */
public HtmlPage selectCreateContentDropdown() {
    try {
        WebElement createContentElement = driver.findElement(CREATE_CONTENT_BUTTON);
        if (createContentElement.isEnabled()) {
            createContentElement.click();
            return getCurrentPage();
        }
    } catch (TimeoutException e) {
        logger.error("Create Content not available : " + CREATE_CONTENT_BUTTON.toString(), e);
    }
    throw new PageException("Not able to click the Create Content Button.");
}

From source file:org.alfresco.po.share.site.document.DocumentLibraryNavigation.java

License:Open Source License

/**
 * Mimics the action of Selected Items.//from w ww  .ja v a  2s .  c  o m
 * 
 * @return {@link DocumentLibraryPage}
 */
public HtmlPage clickSelectedItems() {
    try {
        WebElement selectedItemsElement = driver.findElement(SELECTED_ITEMS);

        if (selectedItemsElement.isEnabled()) {
            selectedItemsElement.click();
            return getCurrentPage();
        }
        throw new PageException(
                "Selected Items Button found, but is not enabled please select one or more item");
    } catch (TimeoutException e) {
        logger.error("Selected Item not available : " + SELECTED_ITEMS.toString());
        throw new PageException("Not able to find the Selected Items Button.", e);
    }
}

From source file:org.alfresco.po.share.site.document.DocumentLibraryNavigation.java

License:Open Source License

/**
 * Mimcis the action of click the folder up button in Navigation bar.
 * /*from   w  w w . j a va  2 s  . co m*/
 * @return {@link HtmlPage}
 */
public HtmlPage clickFolderUp() {
    WebElement folderUpElement = null;
    if (isNavigationBarVisible()) {
        try {
            folderUpElement = driver.findElement(By.cssSelector("button[id$='folderUp-button-button']"));
        } catch (TimeoutException ex) {
            logger.error("Exceeded time to find folderUpElement", ex);
            throw new PageOperationException("FolderUp element didn't found on page.");
        }
        if (folderUpElement.isEnabled()) {
            folderUpElement.click();
            return getCurrentPage();
        } else {
            throw new PageOperationException(
                    "You may be in the root folder, please check path and use folder up whenever required.");
        }
    } else {
        throw new PageOperationException(
                "Navigation might be hidden, please click show breadcrumb from option menu.");
    }
}

From source file:org.alfresco.po.share.site.document.FilmstripActions.java

License:Open Source License

private HtmlPage clickFilmStripViewElement(By locator, String elementName) {
    String exceptionMessage = "";
    if (isFilmStripViewDisplayed()) {
        try {/*from   w w w  .  ja v  a  2 s  . co m*/
            WebElement element = driver.findElement(FILMSTRIP_MAIN_DIV).findElement(locator);
            if (element.isEnabled()) {
                element.click();
                return getCurrentPage();
            } else {
                exceptionMessage = elementName + " not enable to click.";
            }
        } catch (NoSuchElementException nse) {
            if (logger.isTraceEnabled()) {
                logger.trace("selectNextFilmstripItem - Filmstrip view not loaded", nse);
            }
        }
        exceptionMessage = "Foreground " + elementName + " not visible.";
    } else {
        exceptionMessage = "Current view is not Film view, Please change view";
    }
    throw new PageOperationException(exceptionMessage);
}

From source file:org.alfresco.po.share.site.InviteMembersPage.java

License:Open Source License

/**
 * @return boolean/*from  w  w  w  . jav a  2  s  .c o m*/
 */
public boolean isInviteButtonEnabled() {
    try {
        WebElement inviteButton = driver.findElement(By.cssSelector(INVITE_BUTTON));
        return inviteButton.isDisplayed() && inviteButton.isEnabled();
    } catch (NoSuchElementException e) {
        throw new PageException("Not found Element:" + INVITE_BUTTON, e);
    }
}

From source file:org.alfresco.po.share.site.InviteMembersPage.java

License:Open Source License

private boolean isSmThEnabledFor(String userName, String smthXpath) {
    By smthElement = By.xpath(String.format(smthXpath, userName));
    try {//  ww  w .j  ava 2 s  . c  o m
        WebElement addButton = driver.findElement(smthElement);
        return addButton.isDisplayed() && addButton.isEnabled();
    } catch (NoSuchElementException e) {
        throw new PageException("Not found Element:" + smthElement, e);
    }
}