Uipath select item from a dropdown

Hello Community,

I have to select an value from the drop down, and i am using select item activity to do that operation (desktop application automation).

But here is the problem:

The value to be selected is given through a variable as it is dynamic.
MyDropdownVar=a
so i have to select a from dropdown.

The dropdown values are :
abc
b
c

But this operation will select abc .
I just want to see if the MyDropdownVar is present in dropdown, if its there select it, else throw BE.
If the value is not present in the dropdown then business exception is thrown.

Can anyone help me with this?

Thank you

Are you perhaps using a wildcard * after the dynamic variable? That would cause the abc to be chosen. If not, it could be an issue with interaction between UiPath and target application. You could in that case try to do it with 2 clicks instead: 1st to open the dropdown and 2nd to click on the element you want to choose.

To do this you could use the “Find Children” activity. Point it to the dropdown and configure the filter to get just the dropdown items (use UiExplorer for help to get proper tags for the filter).

Yes, i am using wildcard to fill up the extra spaces,
The reason for that is the dropdown values are
The dropdown values contain spaces , but the values i get from excel doesn’t have spaces
abc
**b **
**c **

If all the dropdown items have the space, you could add a space to the variable before the wildcard:

MyDropdownVar = itemFromExcel + " *"

Then it wouldn’t pick the "abc ".

what if i have to pick abc from the dropdown? then will it work?

If also it has a space character after the characters, then yes.

incase of abc doesn’t have space at the end then it wont right. What can be done to select dropdown values with and without space at the end?

as mentioned by

A benefit is also that we can filter on the find children output with custom conditions (e.g. toupper, handling spaces…) but can still refert to the acutall value.

Example: DropDown Values
A10
a B 11
C 12

filter: Get(“text”).toString.ToUpper().Replace(" “,”").Equals(“AB11”)

and wil get back
a B 11 element

Will definitely look into this.