Page tree
Skip to end of metadata
Go to start of metadata

Drag(Zone, Element, Index, XOffset, YOffset)

Supported in iOS Supported in Android


Drag an element or text into a specified zone (you can drag the second, third, etc appearance of the element by setting Index to 1, 2, etc)


  • Zone - Select Zone
  • Element - Select Element from drop-down list OR (for OCR text identification) insert text into the empty box in the drop down list
  • Index - Element Order (the number of times the  element appears more than once)
  • XOffset - Horizontal Offset from the Element in screen pixels (negative values are possible, can use P2cx to convert screen percentage to pixels)
  • YOffset - Vertical Offset from the Element in screen pixels (negative values are possible, can use P2cy to convert screen percentage to pixels)


Scenario: In the following example, we will use the drag command together with the SeeTestAutomation - SetDragStartDelay command in order to move the Play Storeicon across the device's springboard.

Command usage: We will first use the SetDragStartDelay command in order to press the element for 1000 milliseconds before starting the drag. We will then use the Drag command with the following configurations:


  • Zone - will be set to NATIVE
  • Element - will be set to xpath=//*[@text='Play Store'] in order to identify the Play Store icon element
  • Index - will be set to 0
  • XOffset - X drag offset - will be set to 0 .
  • YOffset - Y drag offset - will be set to -300.

Drag X Y Offsets

To drag up/down we set the YOffset +( num of pixels ) for DOWN, and -( num of pixels ) for UP.

To drag right/left we set the XOffset +( num of pixels ) for RIGHT , and -( num of pixels ) for LEFT.

  • setting XOffset to 0 means no drag in the horizontal direction, the YOffset scenario in analogus.

This will be the result of the sequence:


Code Examples

Java Example
client.drag("NATIVE", "xpath=//*[@text='Play Store']", 0, 0, -300);
C# Example
client.Drag("NATIVE", "xpath=//*[@text='Play Store']", 0, 0, -300);
VBScript Example
client.Drag("NATIVE", "xpath=//*[@text='Play Store']", 0, 0, -300)
Python Example
self.client.drag("NATIVE", "xpath=//*[@text='Play Store']", 0, 0, -300)
Perl Example
$client->drag("NATIVE", "xpath=//*[\@text='Play Store']", 0, 0, -300);
  • No labels