In this tutorial we will learn about how we can allows the user to find similar elements within the webpage.
To achieve our goal we will use an activity provided by UiPath called as ‘Find Children’ activity.
- Implementation in UiPath***
We will use the below website to demonstrate the topic.
First we will use the ‘Open Browser’ Activity of the UiPath to open the website.
Note:- Don’t forget to Choose the Browser type from the properties panel.
Example- If you are doing your automation on Edge , then choose Browser type as ‘Edge’.
Now, we will use the ‘Find Children’ activity to get the Children of the container.
In the below image , all the values of the drop down all the Children of Vendor Code.
Use the Find Children activity and indicate an element on the drop down of Vendor code
Once the element on the screen is indicated , then we will see that the selector of Find Children activity is automatically created.
Now, we will store the result of Find Children activity into the Output variable.
Note:- Use Ctrl+K key to create a new variable.
We will now see the variable type of the Output variable(Children Element).
Here, the variable type is IEnumerable<UiPath.Core.UiElement> which means its an array of UiElement.
Now, we will use the ‘For each’ activity to loop through all the UiElements of an array.
Note:- Don’t forget to change the Type Argument from the properties panel to UiPath.Core.UiElement.
Now, we will use the ‘Get Attribute’ activity to get the specific attribute of the UiElement, here the UiElement means the Children.
Every UiElement has many attributes but we will use the one that is required for us.
Let’s click on the drop down button of the Get Attribute activity & we will see the list of attributes available.
Here, will use the ‘aaname’ attribute which will have the title of the UiElement.
Also, In the property panel of Get Attribute activity , we will pass ‘item’ to the Element.
Now, we may ask why we are passing item to the Element?
Inside the for loop , each item is the UiElement or the Children of the container, so the loop would iterate through each item & get the attribute (aaname) which is the title of UiElement.
Now, we will store the result of Get Attribute activity into one Output variable. lets say ResultOutput
Now, Just to show you the result, I will use ‘Log Message’ activity inside the For loop.
Run the workflow to check the result.
We will see that workflow has captured all the values of the drop down.
I hope you enjoyed learning it.