selenium.webdriver.common.touch_actions

The Touch Actions implementation

class selenium.webdriver.common.touch_actions.TouchActions(driver)[source]

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

Creates a new TouchActions object.

Args :
  • driver: The WebDriver instance which performs user actions. It should be with touchscreen enabled.
double_tap(on_element)[source]

Double taps on a given element.

Args :
  • on_element: The element to tap.
flick(xspeed, yspeed)[source]

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)[source]

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.
long_press(on_element)[source]

Long press on an element.

Args :
  • on_element: The element to long press.
move(xcoord, ycoord)[source]

Move held tap to specified location.

Args :
  • xcoord: X Coordinate to move.
  • ycoord: Y Coordinate to move.
perform()[source]

Performs all stored actions.

release(xcoord, ycoord)[source]

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

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

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)[source]

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.
tap(on_element)[source]

Taps on a given element.

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

Touch down at given coordinates.

Args :
  • xcoord: X Coordinate to touch down.
  • ycoord: Y Coordinate to touch down.

This Page