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.dashlet.MySitesDashlet.java

License:Open Source License

/**
 * Render logic to determine if loaded and ready for use.
 * /*  w  w w . j ava 2  s  . co m*/
 * @param timer - {@link RenderTime}
 * @param waitForLoading boolean to whether check for waiting for Loading text to disappear.
 * @return {@link MySitesDashlet}
 */
public MySitesDashlet render(RenderTime timer, boolean waitForLoading) {
    try {
        setResizeHandle(By.xpath(".//div[contains (@class, 'yui-resize-handle')]"));
        while (true) {
            try {
                timer.start();
                WebElement dashlet = driver.findElement(By.cssSelector(DASHLET_CONTENT_DIV_ID_PLACEHOLDER));
                if (dashlet.isDisplayed()) {
                    this.dashlet = driver.findElement(By.cssSelector(DASHLET_CONTAINER_PLACEHOLDER));
                    if (waitForLoading) {
                        if (!isLoading(dashlet)) {
                            break;
                        }
                    } else {
                        break;
                    }
                }

            } catch (NoSuchElementException e) {
                logger.info("Unable to find the dashlet container " + e);
            } finally {
                timer.end();
            }
        }
    } catch (PageRenderTimeException te) {
        throw new PageException(this.getClass().getName() + " failed to render in time", te);
    }
    return this;
}

From source file:org.alfresco.po.share.dashlet.SiteCalendarDashlet.java

License:Open Source License

/**
 * Return true if link with eventName Displayed.
 * //from w  ww .  ja va 2  s  .c o  m
 * @param eventName String
 * @return boolean
 */
public boolean isEventsDisplayed(String eventName) {
    checkNotNull(eventName);
    List<WebElement> eventLinks = getEventLinksElem();
    for (WebElement eventLink : eventLinks) {
        String linkText = eventLink.getText();
        if (linkText.contains(eventName)) {
            return eventLink.isDisplayed();
        }
    }
    return false;
}

From source file:org.alfresco.po.share.dashlet.SiteCalendarDashlet.java

License:Open Source License

/**
 * @param eventDetail String//from w ww  .j  a v  a 2s. c om
 * @return boolean
 */
public boolean isEventsWithDetailDisplayed(String eventDetail) {
    checkNotNull(eventDetail);
    List<WebElement> eventLinks = dashlet.findElements(EVENTS_DETAILS);
    for (WebElement eventLink : eventLinks) {
        String linkText = eventLink.getText();
        if (linkText.contains(eventDetail)) {
            return eventLink.isDisplayed();
        }
    }
    return false;
}

From source file:org.alfresco.po.share.dashlet.SiteCalendarDashlet.java

License:Open Source License

/**
 * //  w w  w  .  jav  a2 s  .c o  m
 * @param eventHeader String
 * @return boolean
 */
public boolean isEventsWithHeaderDisplayed(String eventHeader) {
    checkNotNull(eventHeader);
    List<WebElement> eventLinks = dashlet.findElements(EVENTS_HEADER);
    for (WebElement eventLink : eventLinks) {
        String linkText = eventLink.getText();
        if (linkText.contains(eventHeader)) {
            return eventLink.isDisplayed();
        }
    }
    return false;
}

From source file:org.alfresco.po.share.dashlet.SiteCalendarDashlet.java

License:Open Source License

/**
 * @param eventName String//from   w  ww .  ja v a 2  s . c  om
 * @param startTime String
 * @param endTime String
 * @return boolean
 */
public boolean isEventsWithDetailDisplayed(String eventName, String startTime, String endTime) {
    PageUtils.checkMandatoryParam("Event Name", eventName);
    PageUtils.checkMandatoryParam("Start Time", startTime);
    ;
    PageUtils.checkMandatoryParam("End Time", endTime);
    ;
    List<WebElement> eventLinks = dashlet.findElements(EVENTS_DETAILS);
    for (WebElement eventLink : eventLinks) {
        String linkText = eventLink.getText();
        if (linkText.contains(eventName) && linkText.contains(startTime) && linkText.contains(endTime)) {
            return eventLink.isDisplayed();
        }
    }
    return false;
}

From source file:org.alfresco.po.share.dashlet.SiteContentDashlet.java

License:Open Source License

/**
 * Get the List of Simple View Information. Select Simple View Button on
 * Site Content Dashlet. Read Content information and return the list.
 * /*w  w w  .  j a  v a  2s  . c  om*/
 * @return {@link List} of {@link SimpleViewInformation}.
 */
public List<SimpleViewInformation> getSimpleViewInformation() {
    List<SimpleViewInformation> informations = null;
    try {
        findAndWait(By.cssSelector(DASHLET_SIMPLE_VIEW_BUTTON)).click();
        List<WebElement> links = findAndWaitForElements(By.xpath(NUMBER_OF_DOCS_TABLE));
        informations = new ArrayList<SimpleViewInformation>(links.size());
        for (WebElement tr : links) {
            WebElement thumbnailLink = tr.findElement(SIMPLE_THUMBNAIL_VIEW);
            ShareLink thumbnail = new ShareLink(thumbnailLink, driver, factoryPage);

            WebElement contentLink = tr.findElement(SIMPLE_FILENAME);
            ShareLink content = new ShareLink(contentLink, driver, factoryPage);

            WebElement userLink = tr.findElement(By.cssSelector(".item-simple" + ">a"));
            ShareLink user = new ShareLink(userLink, driver, factoryPage);

            String contentStatus = tr.findElement(SIMPLE_ITEM).getText();

            mouseOver(thumbnailLink);
            WebElement docPreview = findAndWait(SIMPLE_PREVIEW_IMAGE);

            informations.add(new SimpleViewInformation(driver, thumbnail, content, user, contentStatus,
                    docPreview.isDisplayed(), factoryPage));
        }
    } catch (NoSuchElementException nse) {
        logger.error(nse);
        throw new PageException("Unable to display simple view informationin site content dashlet data");
    }

    return informations;

}

From source file:org.alfresco.po.share.dashlet.SiteLinksDashlet.java

License:Open Source License

/**
 * Return true if link 'linkName' displayed in dashlet
 *
 * @param linkName String/*from  www . j  ava 2s . c  o  m*/
 * @return boolean
 */
public boolean isLinkDisplayed(String linkName) {
    checkNotNull(linkName);
    List<WebElement> eventLinks = getLinkElements();
    for (WebElement eventLink : eventLinks) {
        String linkText = eventLink.getText();
        if (linkName.equals(linkText)) {
            return eventLink.isDisplayed();
        }
    }
    return false;
}

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

License:Open Source License

/**
 * Checks if Save button is present and enabled
 * //from   www  .  j av a  2  s .  com
 * @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.EditGroupPage.java

License:Open Source License

/**
 * Checks if Display name filed is present
 * /*from   ww w .j a v  a  2  s.c o m*/
 * @return boolean
 */
public boolean isDisplayNameInputPresent() {
    try {
        WebElement searchButton = driver.findElement(UPDATE_DISPLAYNAME_INPUT);
        return searchButton.isDisplayed();
    } catch (NoSuchElementException e) {
        throw new PageException("Not found Element:" + UPDATE_DISPLAYNAME_INPUT, e);
    }
}

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

License:Open Source License

/**
 * Checks if the group search button is displayed.
 * /*from  ww  w  .j  a  v  a  2s. c o  m*/
 * @return true if button is displayed
 */
protected boolean isPageLoaded() {
    boolean groupsFrameLoaded = false;
    try {
        WebElement element = driver.findElement(By.cssSelector(GROUP_SEARCH_BUTTON));
        groupsFrameLoaded = element.isDisplayed();
    } catch (NoSuchElementException te) {
    }
    return groupsFrameLoaded;
}