Active Elements

Active Elements represent objects that can be applied into the screen, for example masks and working areas. Such elements help Aiviro Robot find desired objects on the screen and interact with them efficiently.

Mask

class aiviro.core.utils.active_elements.Mask(element: SearchObjectArea, color: Color = <Color RGBA (0, 0, 0, 1.0)/>, mask_group_name: str = '__default_group', inverted: bool = False)

Creates a mask on the screen over the provided element.

Parameters:
  • element – Element to apply mask on.

  • color – Color of the mask (black by default).

  • mask_group_name – Name of the mask group

  • inverted – Masks everything except the provided element if set to True

See also

set()

class aiviro.core.utils.active_elements.MaskByDisplay(element: SearchObjectArea, color: Color = <Color RGBA (0, 0, 0, 1.0)/>, mask_group_name: str = '__default_group', include_object: bool = True, to_top: bool = False, to_right: bool = False, to_bottom: bool = False, to_left: bool = False)

Creates a mask on the screen up to the borders of the display.

Parameters:
  • element – Element to apply mask on.

  • color – Color of the mask (black by default).

  • mask_group_name – Name of the mask group

  • include_object – Includes the provided element in the mask if set to True.

  • to_top – Masks everything above the element if set to True.

  • to_right – Masks everything to the right of the element if set to True.

  • to_bottom – Masks everything below the element if set to True.

  • to_left – Masks everything to the left of the element if set to True.

See also

set() Mask

class aiviro.core.utils.active_elements.MaskWindowsTaskbar(color: ~aiviro.core.utils.search_objects.other.Color = <Color RGBA (0, 0, 0, 1.0)/>, position: str = 'bottom', size_pixels: int = 40)

Covers windows taskbar with a screen mask.

Parameters:
  • color – Color of the mask (black by default).

  • position – Position of the taskbar, supported are ‘top’, ‘bottom’, ‘left’ and ‘right’

  • size_pixels – Size of the taskbar in pixels

See also

set() Mask

Working Area

class aiviro.core.utils.active_elements.WorkingArea(element: SearchObjectArea | None = None, check_stability_outside: bool = False)

Sets the working area to the provided element, where to search for desired objects.

Parameters:
  • element – Element to be set as a working area. If set to None, no working area will be set and the previous one will be removed.

  • check_stability_outside – If True, the working area will be checked for stability outside of the element.

See also

set()

class aiviro.core.utils.active_elements.WorkingAreaByGrid(row_area: SearchObjectArea, column_area: SearchObjectArea, check_stability_outside: bool = False, max_width: int = 0, max_height: int = 0)

Defines a working area for the robot based on an area computed from two coordinate areas x and y.

Working area is an area in which it is supposed to look for elements to interact with. Using a working area limits the scope of elements with which subsequent commands work with, making them more easily identifiable, reducing naming ambiguity and avoiding confusion other similar elements.

Working area by grid should be mainly used for recognition in tables, forms or wherever you need to interact with information which is in a grid bounded by grid lines. If the table has no lines, or you want to use it on non-grid screen you need to set max_width and max_height in order to limit the lookup.

Parameters:
  • row_area – Boundary box area for grid row.

  • column_area – Boundary box area for grid column.

  • max_width – Used to limit the size of the lookup for column width. Default=0 which covers the entire area of the column. Caution if the element has no distinct limits it can expand to the whole screen.

  • max_height – Used to limit the size of the lookup for row height. Default=0 which covers the entire area of the row. Caution if the element has no distinct limits it can expand to the entire screen.

  • check_stability_outside – If True, it checks screen stability outside the provided working area

See also

set()

class aiviro.core.utils.active_elements.WorkingAreaAsIntersection(first_area: SearchObjectArea, second_area: SearchObjectArea, extra_areas: Iterable[SearchObjectArea], check_stability_outside: bool = False)

Defines a working area for the tester which is computed as an intersection of the input objects.

Working area is an area in which it is supposed to look for elements to interact with. Using a working area limits the scope of elements with which subsequent commands work with, making them more easily identifiable, reducing naming ambiguity and avoiding confusion other similar elements.

Parameters:
  • first_area – Area, from which the total intersection working area is computed.

  • second_area – Area, from which the total intersection working area is computed.

  • extra_areas – Additional areas, from which the total intersection working area is computed.

  • check_stability_outside – If True, it checks screen stability outside the provided working area

See also

set()