org.openqa.selenium.interactions.touch
Class TouchActions

java.lang.Object
  extended by org.openqa.selenium.interactions.Actions
      extended by org.openqa.selenium.interactions.touch.TouchActions

public class TouchActions
extends Actions

Implements actions for touch enabled devices, reusing the available composite and builder design patterns from Actions.


Field Summary
protected  TouchScreen touchScreen
           
 
Fields inherited from class org.openqa.selenium.interactions.Actions
action, keyboard, mouse
 
Constructor Summary
TouchActions(Keyboard keyboard, TouchScreen touchScreen)
           
TouchActions(WebDriver driver)
           
 
Method Summary
 TouchActions doubleTap(WebElement onElement)
          Allows the execution of double tapon the screen, analogous to double click using a Mouse.
 TouchActions down(int x, int y)
          Allows the execution of the gesture 'down' on the screen.
 TouchActions flick(int xSpeed, int ySpeed)
          Sends a flick gesture to the current view.
 TouchActions flick(WebElement onElement, int xOffset, int yOffset, int speed)
          Allows the execution of flick gestures starting in a location's element.
 TouchActions longPress(WebElement onElement)
          Allows the execution of long press gestures.
 TouchActions move(int x, int y)
          Allows the execution of the gesture 'move' on the screen.
 TouchActions scroll(int xOffset, int yOffset)
          Allows the view to be scrolled by an x and y offset.
 TouchActions scroll(WebElement onElement, int xOffset, int yOffset)
          Creates a scroll gesture that starts on a particular screen location.
 TouchActions singleTap(WebElement onElement)
          Allows the execution of single tap on the screen, analogous to click using a Mouse.
 TouchActions up(int x, int y)
          Allows the execution of the gesture 'up' on the screen.
 
Methods inherited from class org.openqa.selenium.interactions.Actions
build, click, click, clickAndHold, clickAndHold, contextClick, contextClick, doubleClick, doubleClick, dragAndDrop, dragAndDropBy, keyDown, keyDown, keyUp, keyUp, moveByOffset, moveToElement, moveToElement, perform, release, release, sendKeys, sendKeys
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

touchScreen

protected TouchScreen touchScreen
Constructor Detail

TouchActions

public TouchActions(WebDriver driver)

TouchActions

public TouchActions(Keyboard keyboard,
                    TouchScreen touchScreen)
Method Detail

singleTap

public TouchActions singleTap(WebElement onElement)
Allows the execution of single tap on the screen, analogous to click using a Mouse.

Parameters:
onElement - the WebElement on the screen.

down

public TouchActions down(int x,
                         int y)
Allows the execution of the gesture 'down' on the screen. It is typically the first of a sequence of touch gestures.

Parameters:
x - The x coordinate relative to the viewport
y - The y coordinate relative to the viewport

up

public TouchActions up(int x,
                       int y)
Allows the execution of the gesture 'up' on the screen. It is typically the last of a sequence of touch gestures.

Parameters:
x - The x coordinate relative to the viewport
y - The y coordinate relative to the viewport

move

public TouchActions move(int x,
                         int y)
Allows the execution of the gesture 'move' on the screen.

Parameters:
x - The x coordinate relative to the viewport
y - The y coordinate relative to the viewport

scroll

public TouchActions scroll(WebElement onElement,
                           int xOffset,
                           int yOffset)
Creates a scroll gesture that starts on a particular screen location.

Parameters:
onElement - the WebElement where the scroll starts.
xOffset - The x offset to scroll
yOffset - The y offset to scroll

doubleTap

public TouchActions doubleTap(WebElement onElement)
Allows the execution of double tapon the screen, analogous to double click using a Mouse.

Parameters:
onElement - The WebElement to double tap

longPress

public TouchActions longPress(WebElement onElement)
Allows the execution of long press gestures.

Parameters:
onElement - The WebElement to long press

scroll

public TouchActions scroll(int xOffset,
                           int yOffset)
Allows the view to be scrolled by an x and y offset.

Parameters:
xOffset - The horizontal offset relative to the viewport
yOffset - The vertical offset relative to the viewport

flick

public TouchActions flick(int xSpeed,
                          int ySpeed)
Sends a flick gesture to the current view.

Parameters:
xSpeed - The horizontal speed in pixels/second
ySpeed - The vertical speed in pixels/second

flick

public TouchActions flick(WebElement onElement,
                          int xOffset,
                          int yOffset,
                          int speed)
Allows the execution of flick gestures starting in a location's element.

Parameters:
onElement - The WebElement to flick on
xOffset - The x offset relative to the viewport
yOffset - The y offset relative to the viewport


Copyright © 2013. All rights reserved.