List of usage examples for org.openqa.selenium WebElement isDisplayed
boolean isDisplayed();
From source file:org.alfresco.po.PageElement.java
License:Open Source License
/** * This function will return list of visible elements found with the specified selector * /*from w w w.j a v a2s .c om*/ * @param selector {@link By} identifier * @return {@link List} of {@link WebElement} */ public List<WebElement> findDisplayedElements(By selector) { PageUtils.checkMandatoryParam("Locator", selector); List<WebElement> elementList = driver.findElements(selector); List<WebElement> displayedElementList = new ArrayList<WebElement>(); for (WebElement elementSelected : elementList) { if (elementSelected.isDisplayed()) { displayedElementList.add(elementSelected); } } return displayedElementList; }
From source file:org.alfresco.po.rm.console.usersandgroups.AddAuthorityDialog.java
License:Open Source License
/** * Helper method to return custom expected condition that returns true when * the search is complete.//from w w w . j a v a2 s.c om */ protected ExpectedCondition<Boolean> searchFinished() { return new ExpectedCondition<Boolean>() { public Boolean apply(WebDriver arg0) { WebElement message = getResultsWebElement().findElement(MESSAGE_SELECTOR); if (message.isDisplayed() && message.getText().contains("Searching")) { return false; } else { return true; } } }; }
From source file:org.alfresco.po.share.AddUserGroupPage.java
License:Open Source License
/** * Checks if search button is present and enabled * //from w w w.j ava 2 s .c om * @return boolean */ public boolean isSearchButtonEnabled() { try { WebElement searchButton = driver.findElement(By.cssSelector(SEARCH_BUTTON)); return searchButton.isDisplayed() && searchButton.isEnabled(); } catch (NoSuchElementException e) { throw new PageException("Not found Element:" + SEARCH_BUTTON, e); } }
From source file:org.alfresco.po.share.admin.AdminConsolePage.java
License:Open Source License
/** * Upload new logo picture/*from w ww. j a v a 2 s . c o m*/ * admin user is logged in, Application option is selected * * @param filePath String * @return {@link AdminConsolePage} */ public HtmlPage uploadPicture(String filePath) { try { UploadFilePage uploadFilePage = getCurrentPage().render(); WebElement button = findAndWait(FILE_UPLOAD_BUTTON); button.click(); WebElement element = findAndWait( By.cssSelector("#template_x002e_dnd-upload_x002e_console_x0023_default-title-span")); if (element.isDisplayed()) { uploadFilePage.upload(filePath).render(); clickApplyButton(); } } catch (NoSuchElementException te) { if (logger.isTraceEnabled()) { logger.trace("Unable to find the Upload button css " + te); } } return getCurrentPage(); }
From source file:org.alfresco.po.share.browse.BrowseList.java
License:Open Source License
/** * @see org.alfresco.po.common.renderable.Renderable#render() *//*from w w w . j a va 2 s . c o m*/ @Override public <T extends Renderable> T render() { T result = null; int retry = 0; while (retry < RETRY_COUNT) { try { result = super.render(); // figure out how many items are on the page String text = current.getText(); String[] values = text.split(" "); int count = Integer.parseInt(values[2]); List<WebElement> rows = webDriver.findElements(rowsSelector); if (rows.size() == count) { // clear the current item map itemMap = new HashMap<String, ListItem>(rows.size()); // build the new item map for (WebElement row : rows) { // check for staleness of row if (row.isDisplayed()) { ListItem item = listItemFactory.getItem(row); itemMap.put(item.getName(), item); } else { throw new RuntimeException("browse list row is not visible"); } } } else { throw new RuntimeException("Expected " + count + " rows and found " + rows.size()); } break; } catch (Exception exception) { // retry if exception found retry++; if (retry == RETRY_COUNT) { throw new RuntimeException("Retries failed whilst rendering BrowseList", exception); } } } return result; }
From source file:org.alfresco.po.share.cmm.admin.CreateNewCustomTypePopUp.java
License:Open Source License
/** * Select close button.//from w w w . j a va2 s . com * * @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.CreateNewModelPopUp.java
License:Open Source License
/** * Verify Create/Cancel button enabled in CreateNewModelPopUp * /* w w w . jav a2 s . co m*/ * @return boolean */ public boolean isCancelButtonEnabled(String buttonName) { PageUtils.checkMandatoryParam("buttonName", buttonName); try { // Get the list of buttons List<WebElement> buttonNames = findAndWaitForElements(BUTTON_CANCEL_CREATE_MODEL); // Iterate list of buttons for (WebElement button : buttonNames) { if (button.isDisplayed() && button.getText().equalsIgnoreCase(buttonName)) { return true; } } } catch (TimeoutException e) { LOGGER.info("Cancel button is not enabled: ", e); } return false; }
From source file:org.alfresco.po.share.cmm.admin.CreateNewModelPopUp.java
License:Open Source License
/** * Verify Create button enabled in CreateNewModelPopUp * //ww w .j av a 2 s.c om * @return boolean */ public boolean isCreateButtonEnabled() { try { // Get the button WebElement buttonname = findAndWait(BUTTON_CREATE_MODEL); if (buttonname.isDisplayed()) { return "false".equalsIgnoreCase(buttonname.getAttribute("aria-disabled")); } } catch (TimeoutException e) { LOGGER.info("Create Button not enabled: ", e); } return false; }
From source file:org.alfresco.po.share.cmm.admin.CreateNewModelPopUp.java
License:Open Source License
/** * Select cancel button in Create New Model Pop up Page * /*from w w w . ja v a2 s. co m*/ * @param buttonName * @return {@link ModelManagerPage Page} page response */ public ModelManagerPage selectCancelModelButton(String buttonName) { PageUtils.checkMandatoryParam("buttonName", buttonName); try { // Get the list of buttons List<WebElement> buttonNames = findAndWaitForElements(BUTTON_CANCEL_CREATE_MODEL); // Iterate list of buttons for (WebElement button : buttonNames) { if (button.getText().equalsIgnoreCase(buttonName) && (button.isDisplayed())) { button.click(); return factoryPage.instantiatePage(driver, ModelManagerPage.class); } } } 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.CreateNewModelPopUp.java
License:Open Source License
/** * Select close button in CreateNewModelPopupPage * /*from w w w. j av a 2 s . com*/ * @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.instantiatePage(driver, ModelManagerPage.class); } } catch (TimeoutException e) { if (LOGGER.isTraceEnabled()) { LOGGER.trace("Unable to select the close button ", e); } } throw new PageOperationException("Unable to select the closebutton"); }