List of usage examples for org.openqa.selenium Point getY
public int getY()
From source file:MobileElement.java
License:Apache License
public Point getCenter() { Point upperLeft = this.getLocation(); Dimension dimensions = this.getSize(); return new Point(upperLeft.getX() + dimensions.getWidth() / 2, upperLeft.getY() + dimensions.getHeight() / 2); }
From source file:cc.kune.selenium.SeleniumUtils.java
License:GNU Affero Public License
/** * Show cursor.// ww w . j a va2s . co m * * @param webdriver * the webdriver * @param element * the element */ public static void showCursor(final WebDriver webdriver, final WebElement element) { final Point location = element.getLocation(); showCursor(webdriver, location.getX(), location.getY()); }
From source file:cc.kune.selenium.SeleniumUtils.java
License:GNU Affero Public License
/** * Show cursor./*from w w w. j ava 2s . co m*/ * * @param webdriver * the webdriver * @param element * the element * @param xOffset * the x offset * @param yOffset * the y offset */ public static void showCursor(final WebDriver webdriver, final WebElement element, final int xOffset, final int yOffset) { final Point location = element.getLocation(); SeleniumUtils.showCursor(webdriver, location.getX() + xOffset, location.getY() + yOffset); }
From source file:cc.kune.selenium.spaces.GroupSpacePageObject.java
License:GNU Affero Public License
/** * Show tutorial./* w w w. j a v a 2s.c o m*/ * * @param slidesSegs * the slides segs */ public void showTutorial(final int... slidesSegs) { showTutorialBtn.click(); final Point showLocation = showTutorialBtn.getLocation(); SeleniumUtils.showCursor(getWebDriver(), showLocation.getX() - 50, showLocation.getY() + 50); for (int segs : slidesSegs) { if (segs < 0) { SeleniumUtils.doScreenshot(getWebDriver(), "tutorials"); segs = segs * -1; } sleep(segs * 1000); SeleniumUtils.jsExec(getWebDriver()) .executeScript("document.getElementById('" + SeleniumConstants.GWTDEV + TutorialViewer.IFRAME_ID + "').contentWindow.sozi.player.moveToNext();"); } getWebDriver().switchTo().defaultContent(); sleep(500); tutorialCloseBtn.click(); }
From source file:com.assertthat.selenium_shutterbug.utils.web.Coordinates.java
License:Open Source License
public Coordinates(WebElement element) { Point point = element.getLocation(); Dimension size = element.getSize(); this.width = size.getWidth(); this.height = size.getHeight(); this.x = point.getX(); this.y = point.getY(); }
From source file:com.assertthat.selenium_shutterbug.utils.web.Coordinates.java
License:Open Source License
public Coordinates(Point point, Dimension size) { this.width = size.getWidth(); this.height = size.getHeight(); this.x = point.getX(); this.y = point.getY(); }
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);// w w w.j a va2 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(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 ww .j a va2 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(burnDownNamePlf + ".png"); FileUtils.copyFile(screen, file); addText(file, burnDownNamePlf); }
From source file:com.coderoad.automation.common.util.PageUtil.java
License:Open Source License
/** * Do tap.//from w w w .jav a 2 s.c o m * * @param element the element * @param driver the driver */ public static void doTap(final WebElement element, final WebDriver driver) { Point point = element.getLocation(); double x = point.getX(); double y = point.getY(); Dimension dimesions = element.getSize(); int width = dimesions.width; int height = dimesions.height; final JavascriptExecutor js = (JavascriptExecutor) driver; final HashMap<String, Double> tapObject = new HashMap<String, Double>(); tapObject.put("tapCount", 1.0); tapObject.put("touchCount", 1.0); // tapObject.put("duration", 0.7); tapObject.put("x", x + width - 2); tapObject.put("y", y + height - 2); js.executeScript("mobile: tap", tapObject); }
From source file:com.coderoad.automation.common.util.PageUtil.java
License:Open Source License
/** * Do left tap./* w ww .ja v a 2s. c o m*/ * * @param element the element * @param driver the driver */ public static void doLeftTap(final WebElement element, final WebDriver driver) { LogUtil.log("Do Left Tap", LogLevel.HIGH); Point point = element.getLocation(); double x = point.getX(); double y = point.getY(); Dimension dimesions = element.getSize(); int height = dimesions.height; final JavascriptExecutor js = (JavascriptExecutor) driver; final HashMap<String, Double> tapObject = new HashMap<String, Double>(); tapObject.put("tapCount", 1.0); tapObject.put("touchCount", 1.0); x = x + 2; y = y + height + 2; tapObject.put("x", x); tapObject.put("y", y); LogUtil.log("X :" + x, LogLevel.HIGH); LogUtil.log("Y :" + y, LogLevel.HIGH); js.executeScript("mobile: tap", tapObject); }