Get position

Description

Gets an element coordinates and size using the element's selector. The 'Save value to variable' activity appears automatically when choosing the 'Get position' activity. It automatically saves the value to a variable. However, the activity is not mandatory to use and can be removed from the workflow.

Parameters

Interface element

Allows you to select an item from a list of created ones. After the item has been selected, the visual display of the item will automatically appear.

If the 'Use focused element' option is selected then the robot will get the position of the element where the cursor is located.

Comment

Contains an annotation to the activity. The input text will be displayed above the activity name.

Result

The received coordinates and size are stored in element_bounds variable by default. The variable represents an object with the following keys:

Keys and values of an object with the coordinates and size information
{
"y": "y coordinate of the top left corner of the rectangle with the element",
"x": "x coordinate of the top left corner of the rectangle with the element",
"height": "height of the rectangle with the specified element",
"width": "width of the rectangle with the specified element",
"bottom": "y coordinate of the bottom side of the rectangle with the element",
"top": "y coordinate of the top side of the rectangle with the element",
"right": "x coordinate of the right side of the rectangle with the element",
"left": "y coordinate of the left side of the rectangle with the element"
}

Usage Examples

This activity may be considered a kind of an 'anchor'. Suppose we have an element with a reliable selector but we are required to interact with another element with unstable selector. Assume we know that the distance between the 'stable' and 'unstable' elements is always fixed. In this case, we could then locate the first, that is stable, element position and then calculate a relative distance to the unstable element.