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

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

Introduction

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

Prototype

public TouchActions singleTap(WebElement onElement) 

Source Link

Document

Allows the execution of single tap on the screen, analogous to click using a Mouse.

Usage

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();/*from www  . j  a v a2  s  .  c o m*/

    TouchActions touch2 = new TouchActions(getDriver());

    Thread.sleep(1000);

    // 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();
}