Example usage for org.openqa.selenium Point toString

List of usage examples for org.openqa.selenium Point toString

Introduction

In this page you can find the example usage for org.openqa.selenium Point toString.

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:com.playphone.alex.ListViewXpathDemo.java

License:Apache License

public void runDemo() throws MalformedURLException {
    setupAppium();/*from   ww w.j av  a2  s .c  o m*/
    WebDriverWait localWait = new WebDriverWait(driver, 5);
    AndroidElement myListView = (AndroidElement) localWait
            .until(ExpectedConditions.visibilityOfElementLocated(MobileBy.AccessibilityId("list view")));

    List<MobileElement> listChildren = myListView.findElementsByClassName("android.widget.TextView");
    AndroidElement firstChild = (AndroidElement) listChildren.get(0);
    System.out.println("Scrolling first element off screen");
    Point upperLeft = firstChild.getLocation();
    Dimension childSize = firstChild.getSize();
    System.out.println(
            "First child dimensions: Point(" + upperLeft.toString() + "), Dim(" + childSize.toString() + ")");
    System.out.println("First child text: " + firstChild.getText());
    int x = childSize.getWidth() / 2;

    Dimension screenSize = driver.manage().window().getSize();

    driver.swipe(x, screenSize.getHeight() - 1, x, upperLeft.getY(), 3000);

    System.out.println("Now printing the values of the first child again to see what the values are:");
    upperLeft = firstChild.getLocation();
    childSize = firstChild.getSize();
    System.out.println(
            "First child dimensions: Point(" + upperLeft.toString() + "), Dim(" + childSize.toString() + ")");
    System.out.println("First child text: " + firstChild.getText());

    cleanupAppium();
}