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

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

Introduction

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

Prototype

public Action build() 

Source Link

Document

Generates a composite action containing all actions so far, ready to be performed (and resets the internal builder state, so subsequent calls to #build() will contain fresh sequences).

Usage

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();
        Thread.sleep(200);//from   w  w w .j  a v  a 2 s.  c  o  m
    }
}

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

License:Apache License

public void touchActionsDoubleTap() throws InterruptedException, MalformedURLException {
    TouchActions touch = new TouchActions(getDriver());
    touch.singleTap(getElementsByClassName("backgroundPiece").get(0));
    touch.singleTap(getElementById("load"));
    touch.singleTap(getElementById("drawModeSwitch"));
    touch.build().perform();

    TouchActions touch2 = new TouchActions(getDriver());

    Thread.sleep(1000);//from   www . j a v  a  2  s  .  co m

    // O
    touch2.down(300, 450);
    touch2.move(280, 470);
    touch2.move(280, 550);
    touch2.move(300, 570);
    touch2.move(340, 570);
    touch2.move(360, 550);
    touch2.move(360, 470);
    touch2.move(340, 450);
    touch2.move(300, 450);
    touch2.up(300, 450);

    // K
    touch2.down(450, 450);
    touch2.move(450, 570);
    touch2.up(450, 570);
    touch2.down(450, 510);
    touch2.move(520, 450);
    touch2.up(520, 450);
    touch2.down(450, 510);
    touch2.move(520, 570);
    touch2.up(520, 570);
    touch2.build().perform();

    takeScreenShot();
}