Class TouchActions


  • public class TouchActions
    extends Actions
    Implements actions for touch enabled devices, reusing the available composite and builder design patterns from Actions.
    • 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 - the WebElement 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 viewport
        y - 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 viewport
        y - 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 viewport
        y - 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 - the WebElement where the scroll starts.
        xOffset - The x offset to scroll
        yOffset - 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 - The WebElement to double tap
        Returns:
        self
      • longPress

        public TouchActions longPress​(WebElement onElement)
        Allows the execution of long press gestures.
        Parameters:
        onElement - The WebElement 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 viewport
        yOffset - 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/second
        ySpeed - 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 - The WebElement to flick on
        xOffset - The x offset relative to the viewport
        yOffset - The y offset relative to the viewport
        speed - speed to flick, 0 = normal, 1 = fast, 2 = slow
        Returns:
        self