Class TouchActions
- java.lang.Object
-
- org.openqa.selenium.interactions.Actions
-
- 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
Fields Modifier and Type Field Description protected TouchScreen
touchScreen
-
Constructor Summary
Constructors Constructor Description TouchActions(WebDriver driver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TouchActions
doubleTap(WebElement onElement)
Allows the execution of double tap on 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, getActiveKeyboard, getActivePointer, keyDown, keyDown, keyUp, keyUp, moveByOffset, moveToElement, moveToElement, pause, pause, perform, release, release, sendKeys, sendKeys, setActiveKeyboard, setActivePointer, tick, tick
-
-
-
-
Field Detail
-
touchScreen
protected TouchScreen touchScreen
-
-
Constructor Detail
-
TouchActions
public TouchActions(WebDriver driver)
-
-
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
- theWebElement
on the screen.- Returns:
- self
-
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 viewporty
- The y coordinate relative to the viewport- Returns:
- self
-
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 viewporty
- The y coordinate relative to the viewport- Returns:
- self
-
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 viewporty
- The y coordinate relative to the viewport- Returns:
- self
-
scroll
public TouchActions scroll(WebElement onElement, int xOffset, int yOffset)
Creates a scroll gesture that starts on a particular screen location.- Parameters:
onElement
- theWebElement
where the scroll starts.xOffset
- The x offset to scrollyOffset
- The y offset to scroll- Returns:
- self
-
doubleTap
public TouchActions doubleTap(WebElement onElement)
Allows the execution of double tap on the screen, analogous to double click using a Mouse.- Parameters:
onElement
- TheWebElement
to double tap- Returns:
- self
-
longPress
public TouchActions longPress(WebElement onElement)
Allows the execution of long press gestures.- Parameters:
onElement
- TheWebElement
to long press- Returns:
- self
-
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 viewportyOffset
- The vertical offset relative to the viewport- Returns:
- self
-
flick
public TouchActions flick(int xSpeed, int ySpeed)
Sends a flick gesture to the current view.- Parameters:
xSpeed
- The horizontal speed in pixels/secondySpeed
- The vertical speed in pixels/second- Returns:
- self
-
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
- TheWebElement
to flick onxOffset
- The x offset relative to the viewportyOffset
- The y offset relative to the viewportspeed
- speed to flick, 0 = normal, 1 = fast, 2 = slow- Returns:
- self
-
-