Get Screen Coordinates
AutomatR.Web.GetScreenCoordinates
The "Get Screen Coordinates" activity in AutomatR's Web Activities category allows users to determine the X and Y coordinates of a particular spot on the screen. This feature is useful when you need to capture the position of an element on a web page for further automation.
Properties
Name | Description |
---|---|
Input | |
Element | Allows you to select the web element using the selector window. Use this property if you want to indicate the web element directly within the activity. |
WebElement | Specifies the UI Element variable identified by the "Find Element" or other activities. This allows you to use a previously identified web element in the workflow. |
Misc | |
Display Name | Provides a customizable name for the activity displayed in the workflow. String variables containing the desired display name. |
Optional | |
Delay | Specifies the amount of time (in seconds) to wait before executing the "Get Screen Coordinates" activity. This can be useful for handling synchronization issues. Integer variables containing the delay duration. Ex.: If the amount of time is 1000 milliseconds or 1 sec, i.e., 1. |
Delay Before Click | Specifies the wait time (in seconds) before the activity performs any operations. This delay can be used to ensure that the element is ready for interaction. Integer variables containing the delay duration. |
Scroll Element | If checked, the coordinates will be captured after moving the element to the center of the screen. |
Timeout | Specifies the maximum time (in seconds) to wait for the activity to be executed before throwing an exception. Integer variables containing the timeout duration. The default timeout is set in the Constants.Timeout constant. |
Output | |
Result | Outputs a string containing the screen coordinates in the format: "{X=123, Y=456, Width=789, Height=1011}". Use a string variable to store the result for further processing within the workflow. |
How to use:
- Drag and drop the "Get Screen Coordinates" activity onto the workflow.
- Configure the properties by choosing either the direct web element or providing a UI Element variable.
- Optionally, configure the delay, delay before click, and timeout based on your requirements.
- If needed, check the "Scroll Element" option to capture coordinates after moving the element to the center.
- Create a string variable to store the screen coordinates result (e.g., "screenCoordinates").
- Execute the workflow to obtain the screen coordinates from the specified web element.
Example: Consider an example where the "Get Screen Coordinates" activity is used to retrieve the coordinates of a button on a web page:
Get Screen Coordinates:
Delay: 2
Delay Before Click: 1
Timeout: 10
Element: Selector forButtonElement
Scroll Element: Checked
Result: screenCoordinates
In this example, the activity waits for 2 seconds, delays for 1 second before performing any operations, and has a timeout of 10 seconds. It captures the screen coordinates of the web element identified by the selector "forButtonElement" after scrolling it to the center. The result is stored in the "screenCoordinates" string variable for further use.