List of usage examples for org.openqa.selenium.support.ui ExpectedConditions visibilityOf
public static ExpectedCondition<WebElement> visibilityOf(final WebElement element)
From source file:com.codenvy.corp.MainPage.java
License:Open Source License
public void gotoManageViewAndGoToIdeBornDown() throws IOException, InterruptedException { driver.get(String.format(mangeViewUrlIDE, agileIdIDE)); new WebDriverWait(driver, 10).until(ExpectedConditions.visibilityOf(burnDownMAinContainer)); burnDownNameIDE = new WebDriverWait(driver, 10) .until(ExpectedConditions.visibilityOfElementLocated(By.id("ghx-items-trigger"))).getText(); Thread.sleep(10000);/*ww w . j a v a2 s. co m*/ File screen = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); Point p = burnDownMAinContainer.getLocation(); int width = burnDownMAinContainer.getSize().getWidth(); int height = burnDownMAinContainer.getSize().getHeight(); BufferedImage img = ImageIO.read(screen); BufferedImage dest = img.getSubimage(p.getX(), p.getY() - 50, width, height); ImageIO.write(dest, "png", screen); File file = new File(burnDownNameIDE + ".png"); FileUtils.copyFile(screen, file); addText(file, burnDownNameIDE); }
From source file:com.codenvy.corp.MainPage.java
License:Open Source License
public void gotoManageViewAndGrabCLDIDEBornDown() throws IOException, InterruptedException { driver.get(String.format(mangeViewUrlCLDIDE, agileIdPLF)); new WebDriverWait(driver, 10).until(ExpectedConditions.visibilityOf(burnDownMAinContainer)); burnDownNamePlf = new WebDriverWait(driver, 10) .until(ExpectedConditions.visibilityOfElementLocated(By.id("ghx-items-trigger"))).getText(); Thread.sleep(10000);//w w w. j a v a2 s .c o m File screen = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); Point p = burnDownMAinContainer.getLocation(); int width = burnDownMAinContainer.getSize().getWidth(); int height = burnDownMAinContainer.getSize().getHeight(); BufferedImage img = ImageIO.read(screen); BufferedImage dest = img.getSubimage(p.getX(), p.getY() - 50, width, height); ImageIO.write(dest, "png", screen); File file = new File(burnDownNamePlf + ".png"); FileUtils.copyFile(screen, file); addText(file, burnDownNamePlf); }
From source file:com.coderoad.automation.common.util.old.BasePage.java
License:Open Source License
/** * Wait for visibility.//w ww . j a v a2 s. com * * @param element the element */ @SuppressWarnings("unused") protected void waitForVisibility(WebElement element) { LogUtil.log("Start waitForVisibility : " + this.getTimeStamp(), LogLevel.HIGH); for (int i = 0; i < 3; i++) { try { WebElement myDynamicElement = (new WebDriverWait(driver, TestUtils.timeout)) .until(ExpectedConditions.visibilityOf(element)); } catch (Exception e) { TestLogger.logMsg("Wait waitForVisibility : + " + this.getTimeStamp()); } } LogUtil.log("Done waitForVisibility : " + this.getTimeStamp(), LogLevel.HIGH); }
From source file:com.coderoad.automation.common.util.PageUtil.java
License:Open Source License
/** * Checks if is visible.//from w w w . ja va2 s .c o m * * @param driver the driver * @param locator the locator * @param timeout the timeout * @return true, if is visible */ public static boolean isVisible(final WebDriver driver, final By locator, final Timeout timeout) { LogUtil.log("Check the Element is Visible(By Locator) ", LogLevel.HIGH); try { return new WebDriverWait(driver, timeout.getValue()) .until(ExpectedConditions.visibilityOf(driver.findElement(locator))).isDisplayed(); } catch (Exception ex) { return false; } }
From source file:com.coderoad.automation.common.util.PageUtil.java
License:Open Source License
/** * Checks if is visible.// ww w. j a v a2 s . c om * * @param driver the driver * @param element the element * @param timeout the timeout * @return true, if is visible */ public static boolean isVisible(final WebDriver driver, final WebElement element, final Timeout timeout) { LogUtil.log("Check the Element is Visible(WebElement) ", LogLevel.HIGH); try { return new WebDriverWait(driver, timeout.getValue()).until(ExpectedConditions.visibilityOf(element)) .isDisplayed(); } catch (Exception ex) { return false; } }
From source file:com.coderoad.automation.rocketTruedx.RocketTruedxNaBasePage.java
License:Open Source License
protected void waitForVisibility(WebElement element) { TestLogger.logMsg("Start waitForVisibility : + " + this.getTimeStamp()); for (int i = 0; i < 2; i++) { try {// w w w . ja va 2 s. com WebElement myDynamicElement = (new WebDriverWait(driver, TestUtils.timeout)) .until(ExpectedConditions.visibilityOf(element)); } catch (Exception e) { TestLogger.logMsg("Wait waitForVisibility : + " + this.getTimeStamp()); } } TestLogger.logMsg("Done waitForVisibility : + " + this.getTimeStamp()); }
From source file:com.cognifide.bdd.demo.po.feedback.TitleComponent.java
License:Apache License
/** * Search for the web element of title as it could be replaced by JavaScript in the meantime. * * @return tag name for the title, most likely something like: H1, H2,.. *//*from w ww. j a v a 2 s . co m*/ public String findTitleFormattingTag() { bobcatWait.withTimeout(Timeouts.MEDIUM).until(ExpectedConditions.visibilityOf(currentScope)); WebElement titleTagFound = currentScope.findElement(TITLE_TAG_BY); return titleTagFound.getTagName(); }
From source file:com.cognifide.qa.bb.aem.core.component.toolbar.ComponentToolbarImpl.java
License:Apache License
@Override public void verifyIsDisplayed() { bobcatWait.until(ExpectedConditions.visibilityOf(toolbar)); }
From source file:com.cognifide.qa.bb.aem.dialog.classic.field.image.AemImage.java
License:Apache License
/** * Clicks the info button in the image dialog, reads its contents to find referenced URL. * * @return Image URL address.//from www. ja v a 2s .c o m */ public String getImageInfo() { bobcatWait.withTimeout(Timeouts.MEDIUM).until(ExpectedConditions.visibilityOf(infoButton)); infoButton.click(); return tip.findElement(By.xpath(".//a")).getAttribute(HtmlTags.Attributes.HREF); }
From source file:com.cognifide.qa.bb.aem.ui.AemContentFinder.java
License:Apache License
/** * Collapses contentFinder if it is not already collapsed. * * @return This AemContentFinder instance. *//*w w w.j av a 2 s . co m*/ public AemContentFinder collapse() { if (isExpanded()) { bobcatWait.withTimeout(Timeouts.MEDIUM).until(ContentFinderActions.collapse()); bobcatWait.withTimeout(Timeouts.MEDIUM).until(ExpectedConditions.visibilityOf(expandButton)); } return this; }