How to get all values of the drop down in UiPath

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.

https://acme-test.uipath.com/vendors/inventory

Step 1:-

First we will use the ‘Open Browser’ Activity of the UiPath to open the website.
image

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’.
image

Step 2:-

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.
image

Use the Find Children activity and indicate an element on the drop down of Vendor code
.
image

image

Once the element on the screen is indicated , then we will see that the selector of Find Children activity is automatically created.

image

Now, we will store the result of Find Children activity into the Output variable.

Note:- Use Ctrl+K key to create a new variable.
image

Step 3:-

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.
image

Now, we will use the ‘For each’ activity to loop through all the UiElements of an array.
image

Note:- Don’t forget to change the Type Argument from the properties panel to UiPath.Core.UiElement.

Step 4:-

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.
image

Let’s click on the drop down button of the Get Attribute activity & we will see the list of attributes available.

image

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.

image
image

Now, we will store the result of Get Attribute activity into one Output variable. lets say ResultOutput

image

Step 5:-

Now, Just to show you the result, I will use ‘Log Message’ activity inside the For loop.
image

Step 6:-

Run the workflow to check the result.

We will see that workflow has captured all the values of the drop down.

image

I hope you enjoyed learning it.

Happy Automation!!

1 Like

use select item

Select item property would also work to get the values of a drop down. You can use either of the approach to retrieve the result.