Selecting dynamic options from a drop down menu


I’m attempting to grab all the values of this drop down so that I can select the proper value based on a dynamic variable I’ve created from scraping a previous workflow. How would I create this and implement this? I’ve tried “Type Into” as an option so that it will go to the correct value but it doesn’t seem to work. I attempted hot keys but how would I build this to correctly grab the right option? For example, I’ve named the variable for this specific value varLocation. If the scraped value of varLocation was “Florida” in this case, how could I select this?

Thanks in regards, I’ve tried different ways, but I haven’t found anything to work yet.

@ajeffers, Hi

This sounds really complicated, but how about you use a nested if, and your condition can be something like, if ScrapedData.contains(“Florida”) then, if you know from the dropdown Florida selector index is for example index {1} then use a click parse in the Florida selector, unfortunately with this method you would have to repeat the same step through out your if nest for all different option.

or use a switch case if possible with the above steps.

Could you pose a possible example of this?

yes, if you can share a website with a dropdown that i can work with.

perfect, i will send you a sample solution in few minutes.

1 Like

with select item you can pass the variable dynamic for doing the selection

another option is to use find children activity and retrieve all selectItems. After an evaluation to filter to a particular selectitem, this selectitem can be used and get selected


The W3 school thing didn’t work, it does not have css and there for i couldn’t find selectors at all, the only way i could click on in is if i use Computer Vision but that’s outside of the scope for now. i used the WHO website, i hope it makes sense. Make sure you use this with chrome.

Main.xaml (12.1 KB)

give me some little time and i will have a look on it

1 Like

Find this demo game here:
ajeffers.xaml (11.3 KB)

  • opens a page with a states dropdown
  • find children to all state names
  • display an input with select list which has all state names in upper case
  • searches for the user input in the childrenlist (Outcome from find children) for the selected state
    • here it cannot search directly for upper case name and has to bring the state name to upper case for the compair
  • found single children’s text info is used for select item

so instead of upper case you can implement as startswith or contains method for the compair

Kindly note: this was a fast prototype so some linq statement are in use. But these statements cann still be rewirtten to essential uipath activities like for each, if e.g. implementing the filtering

Let us know your feedback

1 Like

I’m working on implementing the solution you’ve provided. I’m running into an error message (setting up as yours is stated) with the following error:


on your assign the left side variable is of wrong datatype and hast to be of UiPath.Core.UiElement instead of System.Window…

The error message reports it in a clear form

1 Like

Sweet. It worked as expected, now I need to find a way for the Robot to automatically input the data in the select field based on the variable I hand it. Example varLocation = “Florida” so it selects Florida. Working on this.

Here you can take it from the demo. The return from input dialog is similar to variable. And with the filtering (e.g. the code line from above with the Where) you will retrieve the specific selectitem. This can be used for selection. Maybe a second look on the demo on the select item part will help you

1 Like

I’m going to take a second look. To give you an overall idea of what I’m doing, I’m inputting data into text fields, most of which I can use Type Into. I put variables in these fields as they have values already stored in them. Of course, with some drop downs, I can’t use “Type Into” so this solution should help me find a way to implement said variable with stored data into that drop down. :slight_smile:

Maybe didnt get you 100%

varLocation = Chicago
Value in DropDown = Chicago, IL (I)

uiLocation = uiChildren.Where(function (x) x.Get(“innertext”).ToString.trim.Contains(varLocation)).Single
(if itemselect is not found or more are found for this value an exception will be thrown grace to the Single method)

Drop down selection then done with

as it is using the attribute “innertext” value from found uiLocation it selecting Chicago, IL (I)

I think I’m understanding this a bit better. Say I brought the variable containing the data over from a previous workflow (used an Invoke workflow) and saved it to a variable colAgencyOffice (ex. like varLocation) it would erase the need for the Input Dialog correct or do I still need that to access the innerHTML of all of the values of the Select Drop down menu?

you are right. the unput dialog was the play game showcasing / simulating a variable to look for. Converting to upper was simulating the a direct compair is not possible. my ToUpper is the equivalent to your contains for the where check

But the find children output you do still need as for the comapit and later for the select Item

Thanks! I’m going to try this and see if it works. :slight_smile:

Could you pose a possible example of this?