List of usage examples for org.openqa.selenium WebElement isDisplayed
boolean isDisplayed();
From source file:org.alfresco.po.share.search.LiveSearchDropdown.java
License:Open Source License
/** * Checks if scope Site is displayed/*from www.j ava2 s . co m*/ * * @return boolean */ public boolean isScopeSiteVisible() { try { WebElement scopeSite = driver.findElement(By.cssSelector(SCOPE_SITE)); return scopeSite.isDisplayed(); } catch (NoSuchElementException nse) { logger.error("No live search scope site option ", nse); return false; } }
From source file:org.alfresco.po.share.search.SearchResultItem.java
License:Open Source License
/** * Method to Click on Download link of result item present on search results. * Note : This thumbnail css used in this method works only on chrome browser. */// w ww . ja va2 s.c o m public void clickOnDownloadIcon() { WebElement download; RenderTime timer = new RenderTime(10000); try { WebElement thumbnail = webElement.findElement(By.cssSelector(THUMBNAIL_LINK)); mouseOver(thumbnail); while (true) { download = webElement.findElement(By.cssSelector(DOWNLOAD_LINK)); try { timer.start(); if (download.isDisplayed()) { download.click(); break; } } catch (ElementNotVisibleException e) { } finally { timer.end(); } } } catch (ElementNotVisibleException e) { throw new PageException("Download link is not visible on Search Results Item", e); } }
From source file:org.alfresco.po.share.search.SearchResultItem.java
License:Open Source License
/** * Method to Click on viewInBrowser link of result item present on search results. * Note : This thumbnail css used in this method works only on chrome browser. * /*from w w w. jav a 2 s. com*/ * @return String, url of the current window. */ public String clickOnViewInBrowserIcon() { WebElement viewInBrowser; String mainWindow; Set<String> windows; String newTab; String url; RenderTime timer = new RenderTime(10000); try { WebElement thumbnail = webElement.findElement(By.cssSelector(THUMBNAIL_LINK)); mouseOver(thumbnail); while (true) { viewInBrowser = webElement.findElement(By.cssSelector(VIEW_IN_BROWSER_LINK)); try { timer.start(); if (viewInBrowser.isDisplayed()) { mainWindow = driver.getWindowHandle(); viewInBrowser.click(); windows = driver.getWindowHandles(); windows.remove(mainWindow); newTab = windows.iterator().next(); driver.switchTo().window(newTab); url = driver.getCurrentUrl(); driver.close(); driver.switchTo().window(mainWindow); return url; } } catch (NoSuchWindowException ne) { } catch (ElementNotVisibleException e) { } finally { timer.end(); } } } catch (ElementNotVisibleException e) { throw new ElementNotVisibleException("View in browser link is not visible in Search Results Item", e); } }
From source file:org.alfresco.po.share.search.SearchResultsPage.java
License:Open Source License
/** * Verify pagination is displayed.//from ww w .ja v a 2 s.c o m * * @return true if results returned */ public boolean paginationDisplayed() { boolean exists = false; try { WebElement element = driver.findElement(By.cssSelector("[id$='_default-paginator-top']")); exists = element.isDisplayed(); } catch (NoSuchElementException nse) { exists = false; } return exists; }
From source file:org.alfresco.po.share.ShareDialogue.java
License:Open Source License
/** * Helper method to return true if Share Dialogue is displayed * //from w ww . jav a 2 s .c o m * @return boolean <tt>true</tt> is Share Dialogue is displayed */ public boolean isShareDialogueDisplayed() { try { WebElement dialogue = getDialogue(); if (dialogue != null && dialogue.isDisplayed()) { return true; } } catch (NoSuchElementException nse) { } return false; }
From source file:org.alfresco.po.share.ShareDialogue.java
License:Open Source License
/** * Helper method to return right PageName for Share Dialogue displayed * /*w w w. j a va2s . c om*/ * @return String */ public String getShareDialoguePageName() { String pageName = ""; try { WebElement dialogue = getDialogueHeader(); if (dialogue != null && dialogue.isDisplayed()) { String dialogueID = dialogue.getAttribute("id"); if (dialogueID.contains("createSite")) { pageName = "Create Site Page"; } else if (dialogueID.contains("createFolder")) { pageName = "Create Folder Page"; } else if (dialogueID.contains("upload")) { pageName = "Upload File Page"; } else if (dialogueID.contains("editDetails")) { pageName = "Edit Properties Page"; } else if (dialogueID.contains("taggable-cntrl-picker")) { pageName = "Tags Page"; } else if (dialogueID.contains("copyMoveTo")) { pageName = "CopyOrMoveContent Page"; } else if (cloudSignInDialogueHeader.equals(dialogue.getText())) { pageName = "CloudSignin Page"; } } } catch (NoSuchElementException nse) { } logger.info(pageName); return pageName; }
From source file:org.alfresco.po.share.ShareDialogueAikau.java
License:Open Source License
/** * Helper method to return true if Share Dialogue is displayed * /* w ww. j a va 2 s . com*/ * @return boolean <tt>true</tt> is Share Dialogue is displayed */ @Override public boolean isShareDialogueDisplayed() { try { WebElement dialogue = getDialogue(); if (dialogue != null && dialogue.isDisplayed()) { return true; } } catch (NoSuchElementException nse) { LOGGER.info("Share Dialogue Aikau Style is not displayed", nse); } return false; }
From source file:org.alfresco.po.share.ShareDialogueAikau.java
License:Open Source License
/** * Method returns true if the field identified by the selector is displayed * /*from w w w . j av a 2 s. c o m*/ * @param selector * @return true if the field is displayed */ public boolean isFieldBeingDisplayed(By selector) { try { // Get the Field WebElement field = driver.findElement(selector); if (field.isDisplayed()) { return true; } } catch (NoSuchElementException e) { LOGGER.info("Message not displayed: ", e); } return false; }
From source file:org.alfresco.po.share.SharePage.java
License:Open Source License
/** * Waits for site pop up message to disappear to allow the driver to resume * operations on the page.//w ww. jav a 2 s.c o m * * @param waitTime timer in milliseconds * @return true if message has gone */ protected boolean canResume(final long waitTime) { RenderTime timer = new RenderTime(waitTime); boolean messagePresent = true; while (messagePresent) { try { timer.start(); WebElement deletedMessage = findAndWait(By.cssSelector("div.bd")); messagePresent = deletedMessage.isDisplayed(); timer.end(); } catch (TimeoutException te) { messagePresent = false; } catch (StaleElementReferenceException se) { canResume(waitTime); } catch (NoSuchElementException nse) { messagePresent = false; } catch (PageRenderTimeException pe) { messagePresent = false; // if exception was thrown and caught, then the popup message // was not on // the page. } } return true; }
From source file:org.alfresco.po.share.SharePage.java
License:Open Source License
/** * Find the all the elements for given locator and returns the first visible {@link WebElement}. * It could be used to elemanate the hidden element with same locators. * /* w w w . j a v a2s .com*/ * @param locator By * @return {@link WebElement} */ protected WebElement getVisibleElement(By locator) { List<WebElement> searchElements = driver.findElements(locator); for (WebElement webElement : searchElements) { if (webElement.isDisplayed()) { return webElement; } } throw new PageOperationException( "Not able find the visible element for given locator : " + locator.toString()); }