Skip to content

Screen Actions

Screen Actions are actions to interact with the computer screen.

Actions

screen.find_image

Find the best match of template image, from assets, inside the screen and return the position on screen.

Parameters:

template_image - name of the asset image used as template.

threshold (optional) - minimum match to consider that the template was found (default=0.9 - 90%).

screenshot_img (optional) - if the template should be found on a given screen beside on current screen (default=None - take a new screenshot).

Returns:

x - left position of the found image on screen/screenshot_img

y - top position of the found image on screen/screenshot_img

width - width of the found image on screen/screenshot_img

height - height of the found image on screen/screenshot_img

Exceptions:

ImageNotFoundException - if no matching image were found until the timeout is reached

screen.find_image_center

Find the best match of template image, from assets, inside the screen and return the center position of the found image.

Parameters:

template_image - name of the asset image used as template.

threshold (optional) - minimum match to consider that the template was found (default=0.9 - 90%).

screenshot_img (optional) - if the template should be found on a given screen beside on current screen (default=None - take a new screenshot).

Returns:

x - center position from left of the found image on screen/screenshot_img

y - center position from top of the found image on screen/screenshot_img

screen.find_image_multiple

Find all matches of template image, inside the screen and return its position.

Parameters:

template_image - name of the asset image used as template.

threshold (optional) - minimum match to consider that the template was found (default=0.9 - 90%).

screenshot_img (optional) - if the template should be found on a given screen beside on current screen (default=None - take a new screenshot).

overlap_factor (optional) - percentage of overlap to consider the same image. If the overlap between two images is higher than the overlap_factor, the two found images are considered to be the same (default=0.5 - 50%).

Returns:

List of image posisions, with values:

x[num] - left position of the found image on screen/screenshot_img

y[num] - top position of the found image on screen/screenshot_img

width[num] - width of the found image on screen/screenshot_img

height[num] - height of the found image on screen/screenshot_img

length - number of images found

screen.find_image_multiple_center

Find all matches of template image, inside the screen and return its center position.

Parameters:

template_image - name of the asset image used as template.

threshold (optional) - minimum match to consider that the template was found (default=0.9 - 90%).

screenshot_img (optional) - if the template should be found on a given screen beside on current screen (default=None - take a new screenshot).

overlap_factor (optional) - percentage of overlap to consider the same image. If the overlap between two images is higher than the overlap_factor, the two found images are considered to be the same (default=0.5 - 50%).

Returns:

List of image posisions, with values:

x[num] - center position from left of the found image on screen/screenshot_img

y[num] - center position from top of the found image on screen/screenshot_img

length - number of images found

screen.wait_image

Waits until a matching image apears on the screen.

Parameters:

template_image - name of the asset image used as template.

threshold (optional) - minimum match to consider that the template was found (default=0.9 - 90%).

screenshot_img (optional) - if the template should be found on a given screen beside on current screen (default=None - take a new screenshot).

timeout (optional) - maximum number os seconds to waits for a matching image. If no matching image pears throws a ImageNotFoundException (default=60).

Returns:

x - left position of the found image on screen/screenshot_img

y - top position of the found image on screen/screenshot_img

width - width of the found image on screen/screenshot_img

height - height of the found image on screen/screenshot_img

Exceptions:

ImageNotFoundException - if no matching image were found until the timeout is reached

screen.wait_image_disapear

Waits until a matching image disapears from the screen.

Parameters:

template_image - name of the asset image used as template.

threshold (optional) - minimum match to consider that the template was found (default=0.9 - 90%).

screenshot_img (optional) - if the template should be found on a given screen beside on current screen (default=None - take a new screenshot).

timeout (optional) - maximum number os seconds to waits for a matching image to disapear, if not throws a TimeoutException (default=60).

Returns:

This action has no return

Exceptions:

TimeoutException - if the matching image still visible after timeout reaches