Create custom swipe gestures
When using scrolling in conjunction with visual analysis, the Next parameter indicates the direction of the scroll action. The default value in Android devices is SWIPE_UP, and in iOS devices is SWIPE_LEFT. Use the default values whenever possible, but in rare cases customization will be necessary.
To select a customized swipe gesture, use the Next parameter in the command (e.g. button.click) and select the required gesture.
Swipe macros defined by the system include the following gestures:
- SWIPE_DOWN,
- SWIPE_UP,
- SWIPE_RIGHT,
- SWIPE_LEFT.
A customized swipe gesture can be used together with the scroll parameter to define a custom scroll action.
Possible phrases in the Next parameter
The sequence syntax for the Next parameter is as follows:
- Phrases must be separated by a semicolon (';').
- A phrase can start with a 'number*' (such as
3*OK
) to indicate repetition. - To indicate duration, a phrase can end with ':number ' (such as
TAP=(10,20):500
) that indicates the duration, in milliseconds.
Duration indication is not supported:- On WAIT requests
- By the Swipe macros (SWIPE_DOWN, SWIPE_UP, SWIPE_RIGHT, SWIPE_LEFT)
- Parentheses are optional. They are ignored in parsing and there is no correctness check.
Examples
- Keys (see
Press key
function):OK;DOWN;OK
- Wait (see
Wait
function):WAIT=500
- Touch (see
Touch
function):TAP=(10,20);DOUBLE_TAP=(10%,20%);TOUCH_DOWN=(10,20);TOUCH_UP=(30,40)
- Drag (see
Drag
function):DRAG=(70,70),(80,80),(90,90)
- Trackball Roll (see
Trackball
function):ROLL=(0,10)
- Swipe Gestures:
SWIPE_DOWN;SWIPE_UP;SWIPE_RIGHT;SWIPE_LEFT;SWIPE=(50%,10%),(50%,80%);SWIPE=(50%,70%),(50%,50%);WAIT=2000
- Long (2 sec) tap:
TAP=(40,75:2000)
Additional information on screen dimensions
The Resolution Width and Resolution Height values can be retrieved by using the Device info function, where:
- (0%,0%) is the top left corner.
- (100%,0%) is the top right corner.
- (0%,100%) is the bottom left corner
- (100%,100%) is the bottom right corner