kvm¶
Keyword definitions for specialised functionality for Keyboard, Mouse and Video-based manipulation.
These keywords rely on VideoInput and Hid libraries to be initialized using the Init keyword. The initialization is platform-specific.
Type: RESOURCE
Scope: GLOBAL
Keywords¶
Displace ${point} By (${x}, ${y})¶
Shift a point by the specified displacements along the x and y axes.
Embedded arguments:
- ${point}: Point to be displaced, as a tuple (x, y).
- ${x}: Displacement along the x-axis.
- ${y}: Displacement along the y-axis.
Displaced point, as a tuple (x, y) of integers.
Example¶
${shifted}= Displace ${3,3} By (5, 5)
Drag And Drop On ${destination}¶
Drag and drop the current target (where the pointer is) on a destination.
Embedded arguments:
- ${destination}: Can be a string, or the path of an image template file representing
the target location to drop on, or a coordinate tuple (x, y) of integers representing the absolute position to drop on. For details please see Walk Pointer To ${destination}.
Positional and named arguments¶
Name |
Type |
Default Value |
Kind |
Required |
Documentation |
|---|---|---|---|---|---|
step_distance |
16 |
POSITIONAL_OR_NAMED |
No |
||
delay |
0.01 |
POSITIONAL_OR_NAMED |
No |
Example¶
Move Pointer To ${CURDIR}/file_icon.png
Drag And Drop On ${CURDIR}/folder_icon.png
Ensure ${destination} Does Not Match¶
Ensure a given template or string doesn't match within a given timeout and number of attempts. This function is intended to be used like: "This given template or image should, by the end of this time, not be found on the screen."
Embedded arguments:
- ${destination}: The template or string to match.
This function ensures that the given destination is not found.
Positional and named arguments¶
Name |
Type |
Default Value |
Kind |
Required |
Documentation |
|---|---|---|---|---|---|
timeout |
2 |
POSITIONAL_OR_NAMED |
No |
Example¶
Ensure ${CURDIR}/error.png Does Not Match timeout=5
Get Center Of ${region}¶
Get the center point of a region.
Embedded arguments:
- ${region}: Rectangular region represented by a dictionary
of integer values for "left", "right", "top", and "bottom" keys.
Center of the region, as a tuple (x, y) of integers.
Example¶
${regions}= Match ${CURDIR}/button.png
${center}= Get Center Of ${regions}[0]
Get Position Of ${target}¶
Get a position from an absolute coordinate, image template, or string.
Embedded arguments:
- ${target}: If ${target} is a tuple (x, y) of integers,
the position will be the absolute position given by the tuple. Otherwise, if ${target} is the path of an image template file, the position will be the center of the first matching template region. ${target} can also be a string, and the position will be the center of the found text.
Absolute position as a tuple (x, y) of integers.
Example¶
${position}= Get Position Of ${CURDIR}/button.png
${position}= Get Position Of Continue
Move Pointer To ${destination}¶
Move the pointer to an absolute position or image template.
Embedded arguments:
- ${destination}: Where to move the pointer to. If ${destination}
is a tuple (x, y) of integers, the pointer will move to the absolute position given by the tuple. Otherwise, if ${destination} is the path of an image template file, the pointer will move to the center of the first matching template region. ${destination} can also be a string, and the pointer will move to the center of the found text.
Absolute position of the pointer after the move, as a tuple (x, y) of integers.
Example¶
Move Pointer To ${CURDIR}/button.png
Move Pointer To Continue
Move Pointer To ${destination} In ${domain}¶
Move the pointer to an absolute position or image template.
Embedded arguments:
- ${destination}: Where to move the pointer to. If ${destination}
is a tuple (x, y) of integers, the pointer will move to the absolute position given by the tuple. Otherwise, if ${destination} is the path of an image template file, the pointer will move to the center of the first matching template region. ${destination} can also be a string, and the pointer will move to the center of the found text.
- ${domain}: Given region or template to search for ${destination} within.
Absolute position of the pointer after the move, as a tuple (x, y) of integers.
Example¶
Move Pointer To Continue In ${CURDIR}/dialog.png
Move Pointer To (${x}, ${y})¶
Move the pointer to an absolute position.
Embedded arguments:
- ${x}: Integer absolute x-coordinate to move the pointer to.
- ${y}: Integer absolute y-coordinate to move the pointer to.
Example¶
Move Pointer To (${640}, ${480})
Move Pointer To Proportional (${x}, ${y})¶
Move the pointer to a destination position given as proportions to the size of the display output.
Embedded arguments:
- ${x}: Output-relative x-coordinate to move the pointer to.
It must be in the range 0..1, where 0 represents the left edge, and 1 represents the right edge of the output.
- ${y}: Output-relative y-coordinate to move the pointer to.
It must be in the range 0..1, where 0 represents the top edge, and 1 represents the bottom edge of the output.
Absolute position of the pointer after the move, as a tuple (x, y) of integers.
Example¶
Move Pointer To Proportional (0.5, 0.5)
Press And Wait For Match¶
Press a key combination and wait for the template to match.
Positional and named arguments¶
Name |
Type |
Default Value |
Kind |
Required |
Documentation |
|---|---|---|---|---|---|
keys-combo |
POSITIONAL_OR_NAMED |
Yes |
|||
template |
POSITIONAL_OR_NAMED |
Yes |
|||
timeout |
10 |
POSITIONAL_OR_NAMED |
No |
||
tolerance |
${DEFAULT_TEMPLATE_MATCHING_TOLERANCE} |
POSITIONAL_OR_NAMED |
No |
Example¶
${combo}= Create List Control_L s
Press And Wait For Match ${combo} ${CURDIR}/save_dialog.png
Press Combo And Match¶
If the provided template is not already matching, press a key combination until it does.
Positional and named arguments¶
Name |
Type |
Default Value |
Kind |
Required |
Documentation |
|---|---|---|---|---|---|
keys-combo |
POSITIONAL_OR_NAMED |
Yes |
|||
template |
POSITIONAL_OR_NAMED |
Yes |
|||
tentatives |
1 |
POSITIONAL_OR_NAMED |
No |
||
timeout |
2 |
POSITIONAL_OR_NAMED |
No |
||
tolerance |
${DEFAULT_TEMPLATE_MATCHING_TOLERANCE} |
POSITIONAL_OR_NAMED |
No |
Example¶
${combo}= Create List Control_L n
Press Combo And Match ${combo} ${CURDIR}/window.png
Press Key And Match¶
If the provided template is not already matching, press a key until it does.
Positional and named arguments¶
Name |
Type |
Default Value |
Kind |
Required |
Documentation |
|---|---|---|---|---|---|
key |
POSITIONAL_OR_NAMED |
Yes |
|||
template |
POSITIONAL_OR_NAMED |
Yes |
|||
tentatives |
1 |
POSITIONAL_OR_NAMED |
No |
||
timeout |
2 |
POSITIONAL_OR_NAMED |
No |
Example¶
Press Key And Match Down ${CURDIR}/menu.png tentatives=5
Walk Pointer To ${destination}¶
Moves the pointer in incremental steps from the current pointer position to an absolute position or image template.
Embedded arguments:
- ${destination}: Where to walk the pointer to. If ${destination}
is a tuple (x, y) of integers, the pointer will walk to the absolute position given by the tuple. Otherwise, if ${destination} is the path of an image template file, the pointer will walk to the center of the first matching template region. ${destination} can also be a string, and the pointer will move to the center of the found text.
- ${step_distance} (optional): Size of each step, in pixels.
Default is 16.
- ${delay} (optional): Time to sleep after each step, in seconds.
Default is 0.01.
Absolute position of the pointer after the walk, as a tuple (x, y) of integers.
Positional and named arguments¶
Name |
Type |
Default Value |
Kind |
Required |
Documentation |
|---|---|---|---|---|---|
step_distance |
16 |
POSITIONAL_OR_NAMED |
No |
||
delay |
0.01 |
POSITIONAL_OR_NAMED |
No |
Example¶
Walk Pointer To ${CURDIR}/button.png
Walk Pointer To (${x}, ${y})¶
Move the pointer in incremental steps from the current pointer position to an absolute position.
Embedded arguments:
- ${x}: Integer absolute x-coordinate to walk the pointer to.
- ${y}: Integer absolute y-coordinate to walk the pointer to.
- ${step_distance} (optional): Size of each step, in pixels.
Default is 16.
- ${delay} (optional): Time to sleep after each step, in seconds.
Default is 0.01.
Positional and named arguments¶
Name |
Type |
Default Value |
Kind |
Required |
Documentation |
|---|---|---|---|---|---|
step_distance |
16 |
POSITIONAL_OR_NAMED |
No |
||
delay |
0.01 |
POSITIONAL_OR_NAMED |
No |
Example¶
Walk Pointer To (${640}, ${480}) step_distance=32
Walk Pointer To Proportional (${x}, ${y})¶
Move the pointer in incremental steps from the current pointer position to a destination position given as proportions to the size of the display output.
Embedded arguments:
- ${x}: Output-relative x-coordinate to move the pointer to.
It must be in the range 0..1, where 0 represents the left edge, and 1 represents the right edge of the output.
- ${y}: Output-relative y-coordinate to move the pointer to.
It must be in the range 0..1, where 0 represents the top edge, and 1 represents the bottom edge of the output.
- ${step_distance} (optional): maximum distance to move per step horizontally, 0 < step_distance <= 1
- ${delay} (optional): Time to sleep after each step, in seconds.
Default is 0.01.
Absolute position of the pointer after the walk, as a tuple (x, y) of integers.
Positional and named arguments¶
Name |
Type |
Default Value |
Kind |
Required |
Documentation |
|---|---|---|---|---|---|
step_distance |
0.01 |
POSITIONAL_OR_NAMED |
No |
||
delay |
0.01 |
POSITIONAL_OR_NAMED |
No |
Example¶
Walk Pointer To Proportional (0.5, 0.5)