webdriver.common.touch_actions

The Touch Actions implementation

Module Contents

Classes

TouchActions(self,driver) Generate touch actions. Works like ActionChains; actions are stored in the
class TouchActions(driver)

Generate touch actions. Works like ActionChains; actions are stored in the TouchActions object and are fired with perform().

__init__(driver)

Creates a new TouchActions object.

Args:
  • driver: The WebDriver instance which performs user actions. It should be with touchscreen enabled.
perform()

Performs all stored actions.

tap(on_element)

Taps on a given element.

Args:
  • on_element: The element to tap.
double_tap(on_element)

Double taps on a given element.

Args:
  • on_element: The element to tap.
tap_and_hold(xcoord, ycoord)

Touch down at given coordinates.

Args:
  • xcoord: X Coordinate to touch down.
  • ycoord: Y Coordinate to touch down.
move(xcoord, ycoord)

Move held tap to specified location.

Args:
  • xcoord: X Coordinate to move.
  • ycoord: Y Coordinate to move.
release(xcoord, ycoord)

Release previously issued tap ‘and hold’ command at specified location.

Args:
  • xcoord: X Coordinate to release.
  • ycoord: Y Coordinate to release.
scroll(xoffset, yoffset)

Touch and scroll, moving by xoffset and yoffset.

Args:
  • xoffset: X offset to scroll to.
  • yoffset: Y offset to scroll to.
scroll_from_element(on_element, xoffset, yoffset)

Touch and scroll starting at on_element, moving by xoffset and yoffset.

Args:
  • on_element: The element where scroll starts.
  • xoffset: X offset to scroll to.
  • yoffset: Y offset to scroll to.
long_press(on_element)

Long press on an element.

Args:
  • on_element: The element to long press.
flick(xspeed, yspeed)

Flicks, starting anywhere on the screen.

Args:
  • xspeed: The X speed in pixels per second.
  • yspeed: The Y speed in pixels per second.
flick_element(on_element, xoffset, yoffset, speed)

Flick starting at on_element, and moving by the xoffset and yoffset with specified speed.

Args:
  • on_element: Flick will start at center of element.
  • xoffset: X offset to flick to.
  • yoffset: Y offset to flick to.
  • speed: Pixels per second to flick.
__enter__()
__exit__(_type, _value, _traceback)