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.SharePopup.java

License:Open Source License

/**
 * Helper method to return true if Share Error popup is displayed
 * //from  w  w w . jav a 2s .c om
 * @return boolean <tt>true</tt> is Share Error popup is displayed
 */
public boolean isShareMessageDisplayed() {
    try {
        WebElement message = getErrorPromptElement();
        if (message != null && message.isDisplayed()) {
            return true;
        }
    } catch (NoSuchElementException nse) {
    }
    return false;
}

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

License:Open Source License

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

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

License:Open Source License

private boolean isSmThEnabledFor(String userName, String smthXpath) {
    By smthElement = By.xpath(String.format(smthXpath, userName));
    try {//from w ww  .j ava2 s  .co  m
        WebElement addButton = findAndWait(smthElement, 2000);
        return addButton.isDisplayed() && addButton.isEnabled();
    } catch (TimeoutException e) {
        throw new PageException("Not found Element:" + smthElement, e);
    }
}

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

License:Open Source License

/**
 * Check that day tab opened/*from w w w .j av a  2  s .co m*/
 * 
 * @return true if day tab opened
 */
public boolean isDayTabOpened() {
    try {
        logger.info("Check is day tab opened");
        WebElement dayTab = driver.findElement(DAY_TAB_TABLE);
        return dayTab.isDisplayed();
    } catch (NoSuchElementException te) {
        logger.debug("Unable to locate day tab table");
        return false;
    }
}

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

License:Open Source License

/**
 * Check that week tab opened//from   ww w .j a v  a  2 s.  co  m
 * 
 * @return true if week tab opened
 */
public boolean isWeekTabOpened() {
    try {
        logger.info("Check is week tab opened");
        WebElement weekTab = driver.findElement(WEEK_TAB_TABLE);
        return weekTab.isDisplayed();
    } catch (NoSuchElementException te) {
        logger.debug("Unable to locate week tab table");
        return false;
    }
}

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

License:Open Source License

/**
 * Check that month tab opened/*  w  w w.  j ava2  s  .com*/
 * 
 * @return true if month tab opened
 */
public boolean isMonthTabOpened() {
    try {
        logger.info("Check is month tab opened");
        WebElement monthTab = driver.findElement(MONTH_TAB_TABLE);
        return monthTab.isDisplayed();
    } catch (NoSuchElementException te) {
        logger.debug("Unable to locate month tab table");
        return false;
    }
}

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

License:Open Source License

/**
 * Check that agenda tab opened/*  w w w .ja v a2s  .c  o m*/
 * 
 * @return true if agenda tab opened
 */
public boolean isAgendaTabOpened() {
    try {
        logger.info("Check is agenda tab opened");
        WebElement linkPreviousEvent = driver.findElement(AGENDA_LINK_PREVIOUS);
        return linkPreviousEvent.isDisplayed();
    } catch (NoSuchElementException te) {
        logger.debug("Unable to locate link for agenda tab");
        return false;
    }
}

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

License:Open Source License

/**
 * Check that event present/*from  ww w. j a  v a2  s.c  om*/
 * 
 * @return true if event present
 */
public boolean isEventPresent(EventType eventType, String eventName) {
    try {
        logger.info("Check that link with name " + eventName + " presented at the current tab");
        if (!eventName.isEmpty()) {
            waitUntilAlert();
            String linkEventXpath = String.format(eventType.getXpathLocator(), eventName);
            WebElement element = driver.findElement(By.xpath(linkEventXpath));
            return element.isDisplayed();
        } else {
            return false;
        }
    } catch (NoSuchElementException te) {
        logger.debug("Unable to locate expected link on tab table");
        return false;
    } catch (StaleElementReferenceException se) {
        return isEventPresent(eventType, eventName);
    }
}

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

License:Open Source License

/**
 * Check that button show All Hours displayed
 * /*from  w w w  .  ja  va  2s  .c  o  m*/
 * @return true if button displayed
 */
public boolean showAllHoursButtonDisplayed() {
    try {
        logger.info("Check 'show all hours' button displayed");
        WebElement button = driver.findElement(SHOW_ALL_HOURS_BUTTON);
        return button.isDisplayed();
    } catch (NoSuchElementException te) {
        logger.debug("Unable to locate 'show all hours' button");
        return false;
    }
}

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

License:Open Source License

/**
 * Check that button show Working Hours displayed
 * /* w  w  w .j a v  a2s  .c o  m*/
 * @return true if button displayed
 */
public boolean showWorkingHoursButtonDisplayed() {
    try {
        logger.info("Check 'show working hours' button displayed");
        WebElement button = driver.findElement(SHOW_WORKING_HOURS_BUTTON);
        return button.isDisplayed();
    } catch (NoSuchElementException te) {
        logger.debug("Unable to locate 'show working hours' button");
        return false;
    }
}