Drag (FR)
Perfecto Command
mobile:touch:drag
Purpose
Performs the drag gesture. You can define the touch sequence coordinates and time frame of the drag. The location parameter supplies the coordinates of the start and end points of the drag. There is a touchdown at the beginning of the drag and a touch-up at the end of the drag. A touchdown is performed with the first pair of coordinates. This is followed by a drag through all the coordinates until the last one, where a touch-up is performed.
Parameters
Name | Type | Possible Values | Description |
---|---|---|---|
location (Mandatory) | String |
The touch event coordinates. Format - either "x1,y1,x2,y2" or "x1%,y1%,x2%,y2%" Coordinate value can be in pixels or in percentage of screen size (0-100). For percentage use the % sign. Example - "20%, 25%" It is recommended to use the percentage value as it translates to the screen resolution. |
|
duration | Int | 1-30 | The duration, in seconds, for performing the drag operation. |
auxiliary | String | tap | notap | down | up | Tap - Touch down at the beginning and touch up at the end No Tap - No auxiliary operation Down - Touch down at the beginning Up - Touch up at the end |
Return Value
None
Exceptions
None
Examples
Map<String, Object> params = new HashMap<>();
params.put("location", "20%,27%,20%,65%");
params.put("duration", "5");
Object res = driver.executeScript("mobile:touch:drag", params);
C# sample
Dictionary<String, Object> pars = new Dictionary<String, Object>();
pars.Add("location", "20%,27%,20%,65%");
pars.Add("duration", "5");
Object res = driver.ExecuteScript("mobile:touch:drag", pars);