Definition and Usage
This command allows you to locate and retrieve a specific related element (parent, sibling, or descendant) of a given element within a window. It enables you to navigate the DOM hierarchy by specifying relationships between elements, making it useful for complex UI automation scenarios where target elements need to be accessed based on their relationship to known elements.
Parameter Values
Input parameters
Parameter | Description | Possible Values | Required | Options / Notes |
Element | Select or capture an element to operate on | Any valid UI element | Yes | This is the base element from which the relative element will be found |
Relationship | Specify how the element will be related | Parent element, Previous sibling element, Following sibling element, First descendant element, All child elements, Specific child element | Yes | Determines the type of relationship to search for |
Relative XPath | Relative xpath of the child element relative to the selected element | Valid XPath expression | Conditional | Required when "Specific child element" is selected |
Index of child | Index of child in the parent element | Integer value | Conditional | Required when selecting a specific child by index |
Advanced settings
Parameter | Description | Possible Values | Required | Options / Notes |
Element timeout (s) | Wait time for element to appear (seconds) | Positive number | No | Default is usually 20 seconds; determines how long to wait for the element to be found |
Error handling
Parameter Name | Description |
Throw error & stop | When an error occurs, the action will trigger an error and stop the execution of the entire app. |
Retry command | If an error occurs, the action will retry the command in an attempt to resolve the issue and continue the process. |
Ignore error & continue | When an error occurs, the action will be ignored, and the workflow will continue without interruption. |
Variables produced
This action produces a variable that contains the found relative element. The variable can be used in subsequent actions to perform operations on.
Using Variables in Conditions
When you see a field with {x} icon, you can insert previously defined variables. This allows you to dynamically determine elements or parameters at runtime. For example, you might use a variable to specify which relationship type to use or to dynamically construct an XPath expression.
Variables can be used in conditions to make decisions based on whether elements were successfully found. For instance, you might check if the "Save element as" variable exists before proceeding with actions that depend on it.
Notes
Before using this command, ensure that the base element is properly identified and exists on the page.
The relationship type determines which relative element will be retrieved:
Parent element: Gets the direct parent of the selected element
Sibling elements: Gets elements at the same level in the DOM hierarchy
Descendant elements: Gets elements contained within the selected element
For "Specific child element" relationship, you need to provide either a relative XPath or an index.
If the relative element cannot be found within the timeout period, the action will fail according to the selected error handling option.
This command is particularly useful for navigating complex web page structures where direct element selection might be difficult or unreliable.