Gesture (FR)

Perfecto Command

mobile:touch:gesture

Purpose

Performs a multi-touch operation called pinch and zoom.

For this gesture, the start and end coordinates must be defined. It is also possible to define the duration of the gesture. The start and end coordinates specify the touch sequence path for a single finger. The other finger is symmetrical.

For example:

  • Zoom: If the start coordinate is (50%,50%) and the end coordinate is (60%,40%), then one finger will move from (50%,50%) to (60%,40%) and the other from (50%,50%) to (40%,60%).

  • Pinch: If the start coordinate is (60%,40%) and the end coordinate is (50%,50%), then one finger will move from (60%,40%) to (50%,50%) and the other from (40%,60%) to (50%,50%).

Parameters

Name Type Possible Values Description
start (Mandatory) String

The start, touch down, event coordinates.

Format - "x,y" or "x%,y%"

Coordinate value can be in pixels or in percentage of screen size (0-100).

For percentage use the % sign.

Example - 50%, 50%

It is recommended to use the percentage value as it does not rely on the screen resolution.

end String

The end, touch up, event coordinates.

Format - "x,y" or "x%,y%"

Coordinate value can be in pixels or in percentage of screen size (0-100).

For percentage use the % sign.

Example - 50%, 50%

It is recommended to use the percentage value as it does not rely on the screen resolution.

operation String zoom | pinch The gesture operation type.
Zoom - performs pinch open operation from the start coordinates to the end coordinates.
Pinch - performs pinch close operation from the start coordinates to the end coordinates.
duration Int 1-10 The duration, in seconds, for performing the operation.

Return Value

None

Exceptions

None

Examples

Copy

Java sample

Map<String, Object> params = new HashMap<>();
params.put("start", "20%,40%");
params.put("end", "15%,60%");
params.put("operation", "zoom");
params.put("duration", "3");
Object res = driver.executeScript("mobile:touch:gesture", params);
Copy

C# sample

Dictionary<String, Object> pars = new Dictionary<String, Object>();
pars.Add("start", "20%,40%");
pars.Add("end", "15%,60%");
pars.Add("operation", "zoom");
pars.Add("duration", "3");
Object res = driver.ExecuteScript("mobile:touch:gesture", pars);