Dealing with dynamic drop-down list


I have an empty field where I can type some short text, let’s say it’s a company name. When I type this name a drop-down list appears. Depending on the typed text there may be three cases:

  1. The drop-down list consists of one record which is the company name.
  2. The drop-down list consists of more than two identical records (literally you get several options which have absolutely the same name).
  3. The drop-down list is empty (let’s treat it as if the company is not in the database).

I need to learn to distinguish all these three cases and make further actions depending on which case it is.

Any ideas on how to do it? I thought of playing with the Type Into activity and keys like “down” or “up” to get the number of records in the drop-down list. But I genuinely think it’s a bad idea because the list is always dynamic, it’s also unclear how to let the robot understand when to stop pressing those buttons and so on and so forth.

I would be grateful to read your ideas if any exist.

Did you try with ‘Find Children’ activity? Filter with the appropriate selector that has those dynamic values.

You can have the list of all the elements matched as filtered by this activity and then you can check whether it has 0 or more elements.

Let me know if it works.

Rammohan B.

1 Like


Maybe you could type in the company name and then see if you can use Element Exist with dynamic selectors in a loop to determine the amount of options in the list. Keen if it works!


I think your solution is the more robust solution!

@basvanderpol, @Rammohan91 Thank you for your replies. I’m going to be checking it the next week, but I wanted to collect ideas because this is what I don’t understand initially.

Here is an example of what I have done in the past to select items in a dropdown when the words are dynamic.

So, assuming the dropdown has a selector and that you can access its “items” attribute, you can get all the items found, then select the item you want by filtering it (In my case, I used .Where and .Contains() as my condition.

To be honest, it’s similar to using Find Children but simpler. So I guess it’s preference.

So that is one way if it helps.


@Rammohan91 But how can I create those values in the selector if I never know whether there will be options or not. I haven’t dealt with the ‘Find Children’ activity yet but I’ll take it into consideration.

When you get all the items in the dropdown stored in a list or array, you can use list.Count to see if there were items found.

@ClaytonM Thank you for your reply. In my case it will work similar to what we have in Google. When we start typing a request we get ‘hints’. In my case I may have similar ‘hints’, one ‘hint’ and no ‘hints’ at all. All these cases are to be distinguished.

However, if the items contain empty strings then you might need to join the list together, like

If String.Join("",list).Trim = ""

@ClaytonM That being said, I’m afraid that the likes of ‘Find Children’ will have no effect as it’s not ‘constructed’ like a list with items. You type ‘a’ and then you get all the hints starting with ‘a’. You add ‘b’, that is ‘ab’, you get all the hints with ‘ab’ at the beginning. Just like you search something in Google, with the only difference being that you can’t exactly know how many ‘hints’ you’ll get.

How the ‘Find Children’ activity will behave in this case?

What text will you be inputting in that textbox? Suppose you type a company name as ‘abc’ and then the popup appears with around 10 matched values. ‘Find Children’ activity will capture all the 10 elements if your selector is dynamic enough.

Again if you run the same workflow but this time having the input as ‘xyz’ which may have only 2 matched values, output of the ‘Find Children’ activity will have only those 2 elements.

Is that not what you are looking for?

Rammohan B.

@Rammohan91 Thank you. At least it sounds close to what I want. I will play around with this activity during the next week and if something goes right or wrong I’ll let you know. It’s just the case when I started thinking before doing :smiley:

Hi @ClaytonM,

In my case, I have a dropdown contains the last date of the every month. Now i need to select the last value of the dropdown list which is the latest one. Can you please help me on this?

Thanks in Advance!!

Hi @Abishek

I think the approach I would take for your problem would be to get all the items with possibly Get Attribute (“items” for attribute), then sort that enumerable list of items by date type, use the latest one in a Select Item activity to select the date.

However, which method to use could depend on the application or dropdown you are interacting with, so I’m just assuming the suggested approach would work.

Snippet Example with datesList as an Array Of String:


Can you please elaborate it?

@Abishek hi. Can you say which part you need a better explanation for? My suggestion was basically just showing 2 activities: one to get the items stored as an array and the other to select the item dynamically using a query method that sorts the array as a DateTime value.

1 Like