Get Style Attribute of Locator: getStyleAttribute
The Get Style Attribute of Locator function retrieves the specified CSS style attribute (e.g., color, background color, or border color) of a UI element identified by a locator. This function is useful for verifying UI properties in automation workflows.
Example Usage: Suppose you want to check the background color of a button on the login page to ensure it meets UI design requirements.
Steps to Configure:
- Select Set a Variable Value from the Action dropdown.
- In the Element Key field, enter a variable name to store the retrieved attribute value (e.g., ButtonColor).
- In the Parameter section, click Form and select Functions from the dropdown.
- Choose Get Style Attribute of Locator from the list of functions.
- Provide the following values:
- Page Name: Enter the name of the page where the element is located (e.g., LoginPage). Ensure that the page name is already defined before using this function.
- Locator Key: Enter the locator key to identify the UI element (e.g., LoginButton).
- Attribute: Select the style attribute to retrieve from the dropdown. The available options are:
- Color
- Background-color
- Border-color
- Click Save.
Note: While the steps for adding an command are identical in both views, the display of the steps changes:


Expected Outcome
- The retrieved style attribute value (e.g., rgb(0, 128, 255)) is stored in the specified variable.
- This value can be used in subsequent steps using the syntax ${VariableName}
(e.g., ${ButtonColor}).