Dynamic Drop Down Selection

uiautomation
studio

#1

Hi,
Can anyone help me how to pick a specific value from drop down. For example in a drop down, I have 3 rows. Select Value, 1, 2. I’m using the find child activity having variable type as IEnumerable with for each but doesn’t getting the result into string.
Let me know if you have any alternate method for dynamic downdrop with multiple values.


#2

What exactly are you trying to do? Are you trying to select a value from the dropdown, in that case did you try ‘select item’ activity?

Are you trying to get the list of all the drodown values using Find Children? If that’s the case, then the output of the Find Children element would always be 'IEnumerable<UiElement>' which will have the list of elements matching with the filter selector. I hope here you have give the filter selector such that only dropdown rows are returned. You can then use a for each loop set with TypeArgument Property as ‘UiElement’ and then using ‘Get Attribute’ activity with aaname(or any attribute that returns the value of dropdown) to get the dropdown row value for each of those UiElement.

Hope it helps.

Thanks,
Rammohan B.


#3

Hi Ram,
I want to select the value from dropdown dynamically. I cannot use the select item because there you have to provide the exactly value. I’m giving a example below:-
In drop down my value are 1,2,3 now every end of the month i want to select the 3 value and next month the 1 value. So how can i have index or item marked in dropdown so that i can pick the value.


#4

Hi @Dany069,

Do the values in the dropdown menu change?

If not, you can use a string variable and simply put it as an argument for the Select Item activity.


#5

but the string can be change so i cannot use the select item. Suppose below is the drop down item:-

Select value
1-xxx-xxx-yyy
7-xxx-zzz-ccc
6-xxx-aaa-www


#6

If you can spot the pattern, you could either use partial variable as your selection choice like this:
numberVariable + “-xxx-” + restOfSelectionText
(make sure to convert any int variables to a string

or use wildcards with the ‘*’ sign for the instances of the selection that are unique, like this:
“*yyy”
“*zzz-ccc*”
and so on


#7

can you show some example


#8

This is the value that i’m getting in my drop down nowi have select the 2row i.e. July i have to select every 2 last day of every month. and June will be selected whole month except the last 2 days. These are the there value the start number i.e. 6 or 7 can be change to 12 or 21.

Period


#9

You can access those records using a wildcard this way:
image
image

As to which value to select, that you need to add before as a condition IF or a switch.


#10

Thanks that works fine :grinning: