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.cmm.admin.CreateNewPropertyGroupPopUp.java

License:Open Source License

/**
 * Select close button.//from  w  w  w. j  a  v a 2 s . co  m
 * 
 * @return the model manager page
 */
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.CreateNewPropertyPopUp.java

License:Open Source License

/**
 * Select close button./*from ww  w.  j  av  a2 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.//from   w w w.ja  v  a  2s  .  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//  w  w  w . ja  v a2 s  .  c  o  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

/**
 * Verify Cancel button enabled in EditModelPopUp
 * /*from   w  ww.j  ava  2  s .c o m*/
 * @return boolean
 */

public boolean isCancelButtonEnabled(String buttonName) {
    PageUtils.checkMandatoryParam("buttonName", buttonName);
    try {
        // Get the list of buttons
        List<WebElement> buttonNames = findAndWaitForElements(BUTTON_CANCEL_EDIT_MODEL);
        // Iterate list of buttons
        for (WebElement button : buttonNames) {
            if (button.isDisplayed() && button.getText().equalsIgnoreCase(buttonName)) {
                return true;
            }
        }
    } catch (TimeoutException e) {
        LOGGER.debug("Timed out while getting the status of Cancel Button: ", e);
    }
    return false;
}

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

License:Open Source License

/**
 * Select cancel button in EditModelPopUp
 * // w w  w .  j av  a2 s .c  om
 * @param buttonName
 * @return {@link ModelManagerPage Page} page response
 */
public HtmlPage selectCancelModelButton(String buttonName) {
    PageUtils.checkMandatoryParam("buttonName", buttonName);
    try {
        // Get the list of buttons
        List<WebElement> buttonNames = findAndWaitForElements(BUTTON_CANCEL_EDIT_MODEL);
        // Iterate list of buttons
        for (WebElement button : buttonNames) {
            if (button.getText().equalsIgnoreCase(buttonName) && (button.isDisplayed())) {
                button.click();
                return factoryPage.getPage(driver);
            }
        }

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

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

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

License:Open Source License

/**
 * Select close button in EditModelPopUp
 * /*www.  j  a  v  a  2 s.c  o m*/
 * @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./*from   w  w w .  j  ava  2 s . c om*/
 * 
 * @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.  ja  va 2 s.  c  om
 * 
 * @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.cmm.FactoryShareCMMPage.java

License:Open Source License

public HtmlPage getPage(final WebDriver driver) throws PageException {
    HtmlPage page = resolvePage(driver);

    // check for Share Error Popup
    if (page instanceof UnknownSharePage) {
        try {/* www  .j  a  va  2  s . c o m*/
            List<WebElement> shareDialogues = driver.findElements(By.cssSelector("div.dijitDialogTitleBar"));
            for (WebElement shareDialogue : shareDialogues) {
                if (shareDialogue.isDisplayed()) {
                    if (logger.isDebugEnabled()) {
                        logger.debug(shareDialogue.getText());
                    }
                    return resolveShareCMMDialoguePage(driver, page);
                }
            }
        } catch (Exception e) {
        }
        // check for SharePage
        if (driver.getCurrentUrl().contains(TPG_HASH)) {
            return instantiatePage(driver, pages.get("ManageTypesAndAspects"));
        } else if (driver.getCurrentUrl().contains(PROPERTIES_HASH)) {
            return instantiatePage(driver, pages.get("ManageProperties"));
        } else if (driver.getCurrentUrl().contains(FORM_EDITOR_HASH)) {
            return instantiatePage(driver, pages.get("FormEditor"));
        } else if (driver.getCurrentUrl().contains(CMM_URL)) {
            return instantiatePage(driver, pages.get("ModelManager"));
        } else if (page instanceof AdminConsolePage) {
            return instantiatePage(driver, AdminConsolePage.class);
        }
    }

    // check for SharePage
    if (driver.getCurrentUrl().contains(TPG_HASH)) {
        return instantiatePage(driver, pages.get("ManageTypesAndAspects"));
    } else if (driver.getCurrentUrl().contains(PROPERTIES_HASH)) {
        return instantiatePage(driver, pages.get("ManageProperties"));
    } else if (driver.getCurrentUrl().contains(FORM_EDITOR_HASH)) {
        return instantiatePage(driver, pages.get("FormEditor"));
    } else if (driver.getCurrentUrl().endsWith(CMM_URL) || driver.getCurrentUrl().endsWith(VIEW_MODELS_HASH)) {
        return instantiatePage(driver, pages.get("ModelManager"));
    } else if (page instanceof AdminConsolePage) {
        return instantiatePage(driver, AdminConsolePage.class);
    } else {
        return page;
    }
}