Silk Mobile

Table of Contents (Homepage)

Drag

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

images/images/os-icons/os_ios_150x150.png

images/images/os-icons/os_android_150x150.png

images/images/os-icons/os_windows_150x150.png

images/images/os-icons/os_blackberry_150x150.png

images/images/os-icons/os_symbian02_150x150.png

images/images/os-icons/os_windows_mobile_150x150.png

Description

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

Parameters

  • 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)

Usage

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

images/download/attachments/2689460/7.jpg

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:

Parameters:

  • 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 200 (200 pixels drag to the right)

  • YOffset - Y drag offset - will be set to -300 (300 pixels drag in the up direction)

    images/download/attachments/2689460/8.jpg

This will be the result of the sequence:

images/download/attachments/2689460/9.jpg

Code Examples

Java Example
 
C# Example
 
VBScript Example
 
Python Example
 
Perl Example