Example usage for org.openqa.selenium.interactions.touch TouchActions flick

List of usage examples for org.openqa.selenium.interactions.touch TouchActions flick

Introduction

In this page you can find the example usage for org.openqa.selenium.interactions.touch TouchActions flick.

Prototype


public TouchActions flick(WebElement onElement, int xOffset, int yOffset, int speed) 

Source Link

Document

Allows the execution of flick gestures starting in a location's element.

Usage

From source file:io.appium.java_client.android.AndroidTouchActionsTest.java

License:Apache License

@Test
public void horizontalFlickTest() throws Exception {
    driver.startActivity("io.appium.android.apis", ".view.Gallery1");

    AndroidElement gallery = driver.findElementById("io.appium.android.apis:id/gallery");
    List<MobileElement> images = gallery.findElementsByClassName("android.widget.ImageView");
    int originalImageCount = images.size();
    Point location = gallery.getLocation();
    Point center = gallery.getCenter();

    TouchActions actions = new TouchActions(driver);
    actions.flick(gallery, -10, center.y - location.y, 1000).perform();

    assertNotEquals(originalImageCount, gallery.findElementsByClassName("android.widget.ImageView").size());
}

From source file:jp.co.nssol.h5.test.selenium.testcase.TouchTest.java

License:Apache License

public void flickTest() throws InterruptedException {
    TouchActions touch = new TouchActions(getDriver());

    for (int i = 0; i < 3; i++) {
        touch.flick(getElementsByLinkText("hifive").get(0), 0, -50, 50);
        touch.build().perform();/*from  www . j av a  2 s .c  o  m*/
        Thread.sleep(200);
    }
}