Example usage for org.openqa.selenium WebElement isDisplayed

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

Introduction

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

Prototype

boolean isDisplayed();

Source Link

Document

Is this element displayed or not?

Usage

From source file:org.alfresco.po.share.site.calendar.CalendarPage.java

License:Open Source License

/**
 * Check that link 'Show all items' present
 * //  w  w  w . j  a  v  a 2 s . co m
 * @return true if this link presented
 */
public boolean isShowAllItemsPresent() {
    try {
        logger.info("Check is link 'Show all items' present");
        WebElement link = driver.findElement(SHOW_ALL_ITEMS_LINK);
        return link.isDisplayed();
    } catch (NoSuchElementException te) {
        logger.debug("Unable to locate link 'Show all items'");
        return false;
    }
}

From source file:org.alfresco.po.share.site.calendar.CalendarPage.java

License:Open Source License

/**
 * Check that tag link present//from  w  w w .  ja  v  a  2s  .c om
 * 
 * @return true if tag link presented
 */
public boolean isTagPresent(String tagName) {
    try {
        logger.info("Check is tag '" + tagName + "' present");
        String tagXpath = String.format(TAG_LINK, tagName);
        WebElement element = driver.findElement(By.xpath(tagXpath));
        return element.isDisplayed();
    } catch (NoSuchElementException te) {
        logger.debug("Unable to locate expected taf link " + tagName);
        return false;
    } catch (StaleElementReferenceException se) {
        return isTagPresent(tagName);
    }
}

From source file:org.alfresco.po.share.site.contentrule.createrules.CreateRulePage.java

License:Open Source License

public boolean isBalloonMessageDisplayed(String text) {
    WebElement balloonAlert = findAndWait(BALLOON_TEXT_MESSAGE);
    if (balloonAlert.isDisplayed() && text.equals(balloonAlert.getText().trim())) {
        return true;
    }/*from   w w  w .  j a v a  2  s .  c  o  m*/
    return false;
}

From source file:org.alfresco.po.share.site.contentrule.FolderRulesPage.java

License:Open Source License

private boolean isLinkCreateRuleAvailable() {
    WebElement linkCreateRule = findAndWait(LINK_CREATE_RULE_PAGE_SELECTOR);
    return (linkCreateRule.isDisplayed() && linkCreateRule.isEnabled());
}

From source file:org.alfresco.po.share.site.contentrule.FolderRulesPage.java

License:Open Source License

private boolean isLinkToRuleSetAvailable() {
    WebElement linkToRuleSet = findAndWait(LINK_TO_RULE_SET_SELECTOR);
    return (linkToRuleSet.isDisplayed() && linkToRuleSet.isEnabled());
}

From source file:org.alfresco.po.share.site.contentrule.FolderRulesPage.java

License:Open Source License

/**
 * Returns true if the button for switching inherit rules on and off is present
 * Should be always called before clicking the button
 * /*  w ww . j  a  v  a2 s  .com*/
 * @return boolean
 */
public boolean isInheritRuleToggleAvailable() {
    WebElement inheritRulesToggle = findAndWait(INHERIT_RULES_TOGGLE);
    return inheritRulesToggle.isDisplayed();
}

From source file:org.alfresco.po.share.site.contentrule.FolderRulesPage.java

License:Open Source License

/**
 * Returns true if "This folder inherits Rules from its parent folder(s)." is displayed, otherwise false
 * /*from   www  .j  a  v  a  2  s. co  m*/
 * @return boolean
 */
public boolean isInheritRulesMessageDisplayed() {
    try {
        WebElement inheritRulesToggle = driver.findElement(THIS_FOLDER_INHERIT_RULES_MESSAGE);
        return inheritRulesToggle.isDisplayed();
    } catch (NoSuchElementException te) {
    }
    return false;

}

From source file:org.alfresco.po.share.site.discussions.DiscussionsPage.java

License:Open Source License

/**
 * Method to verify is discussion presented
 * //w  w  w  .j av  a 2 s . c o m
 * @param title String
 * @return Return true if discussion displayed, and return false if discussion is absent
 */
public boolean isTopicPresented(String title) {
    boolean isDisplayed;

    if (title == null || title.isEmpty()) {
        throw new IllegalArgumentException("Title is required");
    }

    try {
        WebElement theItem = driver.findElement(By.xpath(String.format(DISCUSSION_TOPIC_TITLE, title)));
        isDisplayed = theItem.isDisplayed();
    } catch (NoSuchElementException nse) {
        isDisplayed = false;
    } catch (TimeoutException e) {
        throw new PageException(String.format("File directory info with title %s was not found", title), e);
    }
    return isDisplayed;
}

From source file:org.alfresco.po.share.site.discussions.DiscussionsPage.java

License:Open Source License

/**
 * Method to check tags for topic page// w  w  w.j a v a  2 s . co m
 * if param tag is null will be return true if 'Tags: (None)'
 * 
 * @param title String
 * @param tag String
 * @return return true if expected tag information presented
 */
public boolean checkTags(String title, String tag) {
    boolean isDisplayed;
    WebElement element;
    String tagXpath;

    if (title == null || title.isEmpty()) {
        throw new IllegalArgumentException("Title is required");
    }
    if (tag == null) {

        tagXpath = String.format(TAG_NONE, title);
        try {
            element = findAndWait(By.xpath(tagXpath));
            isDisplayed = element.getText().contains("None");
        } catch (NoSuchElementException ex) {
            if (logger.isDebugEnabled()) {
                logger.debug("Unable to locate topic or 'Tags: (None)'", ex);
            }
            throw new PageOperationException("Unable to locate topic or 'Tags: (None)'");
        }

    } else {

        tagXpath = String.format(TAG_NAME, title, tag);
        try {
            element = findAndWait(By.xpath(tagXpath));
            isDisplayed = element.isDisplayed();
        } catch (NoSuchElementException te) {
            if (logger.isDebugEnabled()) {
                logger.debug("Unable to locate expected tag or topic", te);
            }
            throw new PageOperationException("Unable to locate expected tag or topic");
        }
    }
    return isDisplayed;
}

From source file:org.alfresco.po.share.site.discussions.DiscussionsPage.java

License:Open Source License

/**
 * Method check that no topic displayed/*from   ww  w .java  2  s.co  m*/
 * 
 * @return true if no topic displayed
 */
public boolean isNoTopicsDisplayed() {
    boolean isDisplayed;

    try {
        WebElement theItem = findAndWait(NO_TOPICS);
        isDisplayed = theItem.isDisplayed();
    } catch (TimeoutException te) {
        if (logger.isDebugEnabled()) {
            logger.debug("Unable to locate expected element.", te);
        }
        throw new PageOperationException("Unable to locate expected element.");
    }
    return isDisplayed;
}