List of usage examples for org.openqa.selenium WebElement isDisplayed
boolean isDisplayed();
From source file:org.alfresco.po.share.PeopleFinderResultPage.java
License:Open Source License
/** * Checks if no result message is displayed. * //from w w w . j ava 2 s . c om * @return true if the no result message is found */ private boolean hasNoResult() { boolean noResults = true; try { // Search for no data message WebElement message = driver.findElement(By.cssSelector("tbody.yui-dt-message")); noResults = message.isDisplayed(); } catch (NoSuchElementException te) { noResults = false; } return noResults; }
From source file:org.alfresco.po.share.preview.PdfJsPlugin.java
License:Open Source License
/** * Checks if sidebar is displayed/*from w ww. j a v a 2s . com*/ * * @return boolean */ public boolean isSidebarVisible() { try { WebElement sidebar = driver.findElement(By.cssSelector(SIDEBAR_DIV)); return sidebar.isDisplayed(); } catch (NoSuchElementException nse) { logger.error("No sidebar container " + nse); throw new PageException("Unable to find sidebar container.", nse); } }
From source file:org.alfresco.po.share.search.AdvanceSearchPage.java
License:Open Source License
/** * This function will help to find element in the content and folder search form. * * @return - WebElement//from w ww .j a v a 2s.c om */ protected WebElement findElementDisplayed(By elementId) { List<WebElement> elementList = driver.findElements(elementId); for (WebElement elementSelected : elementList) { if (elementSelected.isDisplayed()) { return elementSelected; } } throw new NoSuchElementException("Element Not found"); }
From source file:org.alfresco.po.share.search.CopyAndMoveContentFromSearchPage.java
License:Open Source License
/** * This method finds then clicks on copy/move/cancel button. * /*w w w . ja v a 2 s . c o m*/ * @param buttonName String * @return HtmlPage FacetedSearchResultsPage */ private HtmlPage selectButton(String buttonName) { if (StringUtils.isEmpty(buttonName)) { throw new IllegalArgumentException("button name is required"); } try { List<WebElement> buttons = findDisplayedElements(copyMoveOkOrCancelButtonCss); for (WebElement button : buttons) { if (button.isDisplayed() && button.isEnabled()) { if (button.getText() != null) { if (button.getText().equalsIgnoreCase(buttonName)) { button.click(); waitUntilElementDisappears(errorPopUp, 10); return getCurrentPage().render(); } } } } throw new PageOperationException("Unable to find the button: " + buttonName); } catch (NoSuchElementException ne) { if (logger.isTraceEnabled()) { logger.trace("Unable to find the inner text of button" + buttonName, ne); } } catch (TimeoutException e) { if (logger.isTraceEnabled()) { logger.trace("Unable to find the button" + buttonName, e); } } throw new PageOperationException("Unable to select button." + buttonName); }
From source file:org.alfresco.po.share.search.CopyAndMoveContentFromSearchPage.java
License:Open Source License
/** * This method finds and selects any folder from repository in CopyAndMoveContentFromSearchPage * This method is used when Repository is selected as destination * /*w ww . j av a2s .c om*/ * @param repoFolder String * @return CopyOrMoveContentPage */ public CopyAndMoveContentFromSearchPage selectFolderInRepo(String repoFolder) { PageUtils.checkMandatoryParam("repoFolder", repoFolder); try { By finalFolderElement = By.xpath(String.format(PathFolderCss, repoFolder)); WebElement element = findAndWait(finalFolderElement); if (!element.isDisplayed()) { element.click(); } element.click(); return this; } catch (NoSuchElementException ne) { if (logger.isTraceEnabled()) { logger.trace("Unable to find the inner text of destionation", ne); } } catch (TimeoutException e) { if (logger.isTraceEnabled()) { logger.trace("Unable to get the list of destionations", e); } } throw new PageOperationException("Unable to select sites : "); }
From source file:org.alfresco.po.share.search.CopyAndMoveContentFromSearchPage.java
License:Open Source License
/** * Checks if Create Link Button is displayed * * @return boolean/*from ww w . ja v a 2s .co m*/ */ public boolean isCreateLinkButtonDisplayed() { try { WebElement createLikeButton = driver.findElement(CREATE_LINK_BUTTON); return createLikeButton.isDisplayed(); } catch (NoSuchElementException nse) { logger.error("Create Link button is not found ", nse); } return false; }
From source file:org.alfresco.po.share.search.CopyOrMoveFailureNotificationPopUp.java
License:Open Source License
/** * Select "ok"./*from w w w. ja va 2s.c o m*/ * * @param action * @return - HtmlPage */ public HtmlPage selectOk() { try { WebElement selectok = driver.findElement(OK_BUTTON); if (selectok.isEnabled() && selectok.isDisplayed()) { selectok.click(); return factoryPage.getPage(driver); } throw new PageException("Ok Button found, but is not enabled"); } catch (TimeoutException e) { logger.error(" : " + "Not able to find Ok Button"); throw new PageException("Not able to find Ok Button", e); } }
From source file:org.alfresco.po.share.search.CreateNewFilterPopUpPage.java
License:Open Source License
/** * Select save button in Create New Filter Page * /*from w w w .j ava 2s . c om*/ * @return {@link FacetedSearchConfigPage Page} page response */ public HtmlPage selectSaveOrCancel(String buttonName) { PageUtils.checkMandatoryParam("buttonName", buttonName); try { // Get the list of buttons List<WebElement> buttonNames = findAndWaitForElements(NEW_FILTER_SAVE_OR_CANCEL_BUTTON); // Iterate list of buttons for (WebElement button : buttonNames) { if (button.getText().equalsIgnoreCase(buttonName) && (button.isDisplayed())) { button.click(); waitUntilVisible(By.cssSelector("div.bd"), "Operation Completed Successfully", 10); waitUntilNotVisibleWithParitalText(By.cssSelector("div.bd"), "Operation Completed Successfully", 10); return getCurrentPage(); } } } catch (TimeoutException e) { if (logger.isTraceEnabled()) { logger.trace("Unable to select the" + buttonName + "button" + e.getMessage()); } } throw new PageOperationException("Unable to select the" + buttonName + "button"); }
From source file:org.alfresco.po.share.search.CreateNewFilterPopUpPage.java
License:Open Source License
/** * Click Add New Entry button./*ww w .j a v a 2 s .c o m*/ * * @return {@link CreateNewFilterPopUpPage Page} page response */ public CreateNewFilterPopUpPage clickAddNewEntry() { try { // Get the list of buttons WebElement addNewEntryButton = findAndWait(ADD_NEW_ENTRY); // Iterate list of buttons if (addNewEntryButton.isDisplayed()) { addNewEntryButton.click(); return this; } } catch (TimeoutException e) { if (logger.isTraceEnabled()) { logger.trace("Unable to select the new entry button" + e.getMessage()); } } throw new PageOperationException("Unable to select the new entry button"); }
From source file:org.alfresco.po.share.search.CreateNewFilterPopUpPage.java
License:Open Source License
/** * Select Site name from drop down.//from w ww .jav a 2 s .com * * @param siteName String * @return CreateNewFilterPopUpPage */ public CreateNewFilterPopUpPage selectSiteNameAndSave(String siteName) { PageUtils.checkMandatoryParam("siteName", siteName); try { // Find the select control WebElement selectControl = findAndWait(SITE_DD_CTRL); // WebElement selectCancel = findAndWait(CANCEL_SITE); selectControl.click(); // Find the pop up menu WebElement popupMenu = findAndWait(SITE_POP_UP); // Get the pop up menu items List<WebElement> menuItems = popupMenu.findElements(POP_UP_SITES_DD); // Iterate pop up menu items for (WebElement menuItem : menuItems) { if (menuItem.getText().equalsIgnoreCase(siteName)) { menuItem.click(); WebElement selectSave = findAndWait(SAVE_SITE); if (selectSave.isDisplayed() && selectSave.isEnabled()) { selectSave.click(); } return this; } } } catch (NoSuchElementException ne) { if (logger.isTraceEnabled()) { logger.trace("Unable to select the site from drop down" + ne); } } catch (TimeoutException e) { if (logger.isTraceEnabled()) { logger.trace("Unable to select the site from drop down" + e.getMessage()); } } throw new PageOperationException("Unable to select the sitefrom drop down"); }