Example usage for org.openqa.selenium Dimension getHeight

List of usage examples for org.openqa.selenium Dimension getHeight

Introduction

In this page you can find the example usage for org.openqa.selenium Dimension getHeight.

Prototype

public int getHeight() 

Source Link

Usage

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:app.fynd.Pages.MajorFlowSanityPage.java

License:Open Source License

public void scroll(int times) throws InterruptedException {

    Dimension dimensions = driver.manage().window().getSize();
    double screenHeightStart = (int) (dimensions.getHeight() * 0.3);
    int scrollStart = (int) screenHeightStart;
    double screenHeightEnd = (dimensions.getHeight() * 0.1);
    int scrollEnd = (int) screenHeightEnd;
    for (int i = 1; i <= times; i++) {
        Thread.sleep(1000L);// w ww  . j a v a  2  s .  c o  m
        driver.swipe(0, scrollStart, 0, scrollEnd, 2000);

        System.out.println("scrolled : " + i);

    }
}

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.cognifide.aet.job.common.collectors.screen.ScreenCollector.java

License:Apache License

private byte[] getImagePart(byte[] fullPage, WebElement webElement) throws IOException, ProcessingException {
    InputStream in = new ByteArrayInputStream(fullPage);
    try {/*w w  w.  ja  v a  2s  .  c  o  m*/
        BufferedImage fullImg = ImageIO.read(in);
        Point point = webElement.getLocation();
        Dimension size = webElement.getSize();
        BufferedImage screenshotSection = fullImg.getSubimage(point.getX(), point.getY(), size.getWidth(),
                size.getHeight());
        return bufferedImageToByteArray(screenshotSection);
    } catch (IOException e) {
        throw new ProcessingException("Unable to create image from taken screenshot", e);
    } finally {
        IOUtils.closeQuietly(in);
    }
}

From source file:com.cognifide.qa.bb.dragdrop.DraggableWebElement.java

License:Apache License

private Point getCurrentLocation() {
    Point inViewPort = null;/*  w  ww. java  2 s .  c o m*/
    switcher.switchTo(getFramePath());
    try {
        Dimension size = webElement.getSize();
        inViewPort = ((Locatable) webElement).getCoordinates().inViewPort().moveBy(size.getWidth() / 2,
                size.getHeight() / 2);
    } finally {
        switcher.switchBack();
    }
    return inViewPort;
}

From source file:com.cognifide.qa.bb.dragdrop.DroppableWebElement.java

License:Apache License

/**
 * @return Point in the middle of the drop area.
 *//*  w w w  . j  a v  a  2s .c o m*/
@Override
public Point getCurrentLocation() {
    Point inViewPort = null;
    switcher.switchTo(getFramePath());
    try {
        Dimension size = dropArea.getSize();
        inViewPort = ((Locatable) dropArea).getCoordinates().inViewPort().moveBy(size.getWidth() / 2,
                size.getHeight() / 2);
    } finally {
        switcher.switchBack();
    }
    return inViewPort;
}

From source file:com.dhenton9000.selenium.generic.GenericAutomationRepository.java

/**
 * Determines visibility of an element in a window.
 * @param w/*from   w  ww .  jav a  2s.  c o  m*/
 * @return true if the element is in the window, false if not
 */
public boolean isElementScrolledIntoView(WebElement w) {

    if (w == null) {
        return false;
    }
    Point p = w.getLocation();
    Dimension d = getDriver().manage().window().getSize();
    java.awt.Rectangle r = new java.awt.Rectangle(d.getWidth(), d.getHeight());
    java.awt.Point awtPoint = new java.awt.Point(p.x, p.y);
    return r.contains(awtPoint);
}

From source file:com.epam.gepard.selenium.browsers.BrowserHandlerBase.java

License:Open Source License

/**
 * Sets the browser width and height according to the argument dimension.
 *
 * @param dimension the dimension to set
 *///w w w  .  j a v a  2  s.com
public void setBrowserSize(Dimension dimension) {
    if (dimension == null) {
        wdu.getSelenium().windowMaximize();
    } else {
        wdu.getSelenium().getEval("window.resizeTo(" + dimension.getWidth() + "," + dimension.getHeight()
                + "); window.moveTo(0,0);");
    }
}

From source file:com.galenframework.ide.services.devices.DeviceServiceImpl.java

License:Apache License

private String convertSizeToString(Dimension size) {
    return size.getWidth() + "x" + size.getHeight();
}