Get Siblings from Element - Activities - Foundation 23.2 - Foundation 23.2 - Ready - Hyland RPA - external

Hyland RPA Activities

Platform
Hyland RPA
Product
Activities
Release
Foundation 23.2
License

Automation.Getter

Description

Returns all siblings of a given element. Examples on a web page include retrieving all other list items of an unordered or ordered list or all div elements that are on the same hierarchy level on the web page as the initial element.

Properties

Analyst

  • 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

  • Siblings: The activity will return an array of UIElements (UiElement[], containing all siblings of the element you set under Element). If your element does not have at least one sibling, an empty array with zero elements will be returned.

Example

Suppose you are on our helpdesk site and that you currently have an array of all links (class="sidnav__article-name") leading to the relevant article.

Starting with this array, you want to retrieve the text of the headline corresponding to each link (i.e., Account Management => CUSTOMER PORTAL, Update Your Applications => CUSTOMER PORTAL, Compatibility Matrix => RELEASE HISTORY and so on). In order to get the displayed text of the span element, you will have to use the Get Parent from Element activity twice (or chain the GetParent()-method as described in the tips and tricks section) as shown in the following screenshots from within the For each UI Element:

Second, you need to retrieve your final target element (the span element), namely the first sibling of this grandparent of your initial link element (parentOfLinkElement). The Get Siblings from Element will again return an array of UIElements (here: siblingsOfLIElement).

Finally, you can use the Get Text to extract the text from the headline (access the first sibling like this: siblingsOfLIElement(0)) as well as the text from your initial link element. Their content is written to the log using the Write Log activity:

This example will hopefully help you to become comfortable with the Get Parent from Element and Get Siblings from Element activity. Here is an excerpt from the web page (relevant parts 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, mySiblings.Count) in a Write Log activity to check how many siblings were returned.
  • If you want to get the siblings of the grand- or grand-grandparents of your current element, you can chain the methods in a VB commands instead (for example, you could use Assign Variable with variable type UiElement and myElement.GetParent().GetParent().GetSiblings()(0) on the right-hand sight of the assignment if you want to retrieve the span element mentioned in the exercise above starting from the link element). The same logic applies to children and grandchildren as well.

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.