Automation.Getter
Description
Returns all children of a given element. Examples on a web page include list items within an ordered or unordered list or simply div elements located within other divs.
PropertiesAnalyst
- Description: Optional text for documentation purposes.
Common
-
Continue On Error: Continues the execution of the workflow even if an error occurs during the execution of the activity.
-
Delay Before: Delay time in milliseconds before the activity is executed. The default value is 250 milliseconds.
-
Delay After: Delay time in milliseconds after executing of the activity. The default value is 250 milliseconds.
-
Disable Log: Disables the logging functionality for this activity.
-
Disable Protocol: Disables the protocol functionality for this activity.
-
Exclude from Global Delay: Excludes this activity from the Global Delay functionality.
-
Timeout: Duration in milliseconds in which the activity tries to execute.
Element
- Automation Provider: The automation provider is usually automatically selected by the Smart Indicator depending on the application or browser you are automating. You can, however, change the automation provider manually while indicating (by pressing Shift + Up/Down)
- ArtefactID: If you have saved the selector value in an Artifact, you can reference it here. If the value is 0, it is not connected to any Artifact in the database.
- Element: In case you already retrieved the UIElement in the process, you can simply insert it in this field.
- Selector Value: This is the field where the Smart Indicator will store your indication result. You can, of course, also adjust the selector value manually.
- Show Debug Borders: If true draws a bounding rectangle around the element identified to be the target.
Output
- Elements: The activity will return an array of UIElements (UiElement[]). If your element does not have any children, an empty array of length zero will be returned.
returns all children of a given element. Examples on a web page include list items within an ordered or unordered list or simply div elements located within other divs.
Suppose you are on our helpdesk site and you want to print the displayed text of the headline of each section (i.e., Customer Portal, Release History and so on) as well as the text of the first link within each category (i.e., Account Management, Compatibility Matrix, etc.).
If you are iterating over the outer list items (class="sidenav__section"), you have to select its first child element (the highlighted span element) to retrieve the headline. This is done by using the Get Children of Element Activity with the outer li-element as input and subsequently selecting its first child element with the Get Text as shown in the following screenshots from within the For each UI Element activity:
In order to get the displayed text of the link, you will have to use the Get Children of Element Activity multiple times (or chain the GetChildren()-method as described in the tips and tricks section), because you must retrieve the text from the (first and only) grandchild of the second child of your initial array of outer list items:
Finally, the retrieved information is written into the log:
Here is an excerpt of the HTML structure of the web page. The relevant elements are highlighted:
<li class="sidenav__section " data-sidenav-section-id="360000499998"> <span class="sidenav__section-name">Customer Portal</span> <ul class="sidenav__articles-list " style="transition: transform 300ms" data-sidenav-parent-section="360000499998"> <li class="sidenav__article " data-sidenav-article-id="360001838498"> <a href="https://helpdesk.anothermonday.com/hc/en-us/articles/360001838498-Account-Management" class="sidenav__article-name">Account Management</a> </li> <li class="sidenav__article " data-sidenav-article-id="360001839218"> <a href="https://helpdesk.anothermonday.com/hc/en-us/articles/360001839218-Install-and-Activate-your-Applications" class="sidenav__article-name">Install and Activate your Applications</a> </li> ... </ul> </li> <li class="sidenav__section " data-sidenav-section-id="360000367717"> <span class="sidenav__section-name">Release History</span> <ul class="sidenav__articles-list " style="transition: transform 300ms" data-sidenav-parent-section="360000367717"> <li class="sidenav__article " data-sidenav-article-id="360002037177"> <a href="https://helpdesk.anothermonday.com/hc/en-us/articles/360002037177-Compatibility-Matrix" class="sidenav__article-name">Compatibility Matrix</a> </li>
Tips and Tricks
- You can use the Count property (for example, myChildrenUIArray.Count) in a Write Log to check how many children were returned.
- If you want to get children of children, you can chain the Get Children of Element Activity or use Visual Basic commands instead, for example you could use Assign Variable with variable type UiElement[] and myElement.GetChildren()(0).GetChildren() on the right-hand sight of the assignment if you want to retrieve all children of the first child element of myElement.
Troubleshooting
-
AM.Core.Activities.Exceptions.ElementNotFoundException: Failed to find Element by the given selector.
The activity could not find an element based on the selector value or element you provided as a target. Check if your selector value is correct.
See also