How to check if an option does not exists in a IEnumerable?


I have to work with a dropdownmenu which doesn’t work with “Select Item”.
I would like to check if the value I am looking for does not exists in the dropdownmenu.
I have used a find children with the result in an IEnumerable.
How do I check if the value I am looking for does not exists in this IEnumerable?
For example: the dropdownmenu had the options BLUE, RED and YELLOW.
I want to check if there is an option calles BLACK. Than I can take further actions.

Many thanks in advance!

Give a try at:
FindChildrenOutPutVar.Any(Function (x) x.Get("innertext").toString.Trim.ToUpper.Equals("BLACK"))

The IEnumerable is ienumColor. Where do I have to place it?

Please share some more details with us, as from the description Find Children was mentioned.

  • Screenshot from find children
  • elaboration on some more details from Flow/Use Case

find children output vs. Color Enum

OK, the real case is somewhat different than the example (with the colors) I gave above.
I have to find a country in a dropdownlist.

Properties of Find Children:


So I would like to check if the country BELGIUM (strTarget) exists in ienumRegion (it does not exists).

just be always close to the case:
FindChildrenOutPutVar.Any(Function (x) x.Get("innertext").toString.Trim.ToUpper.Equals("BELGIUM"))

Or with variable:
FindChildrenOutPutVar.Any(Function (x) x.Get("innertext").toString.Trim.ToUpper.Equals(strTarget.ToUpper.Trim))

but do I use this in an Assign-activity or in an If-activity?

Hi @100981 ,

Try performing a Debug and Check the ienumRegion variable values through the immediate panel and send screenshots of it.

It would help us to identify the attributes and provide the appropriate attribute for selection.

statement is returning a boolean, so you can assign the return to a Boolean variable or use it within a condition e.g. IF Activity as you do need

About LINQ and the Any Operator has a look here:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.