Select item drop down. list

Desktop application: Can I use “select item” option to store all the drop down items in a variable. Because I can’t able to get the items using find children.

Please suggest!!!

@Ragul_sharma,

I think it’s already resolved.

Thanks,
Ashok :slight_smile:

Select Item doesn’t store things, it selects an item. Find Children works fine.

I can’t able to get the child items by using find children. But I’m getting all the list by using select item. Is there any other way to solve this problem

If you can’t get them with Find Children then you have it configured wrong. Did you set it to FIND_DESCENDANTS?

Find children only I have used. I’m using thsi solution for desktop application testing

FIND_DESCENDANTS is a setting in the Find Children activity.

Oh Then I have to use descendants right. I will check with descendants.

1 Like

Using Find Children…

  • Indicate the dropdown
  • Set Scope to FindScope.FIND_DESCENDANTS
  • Set Filter to "<webctrl tag='OPTION' />"
  • Put your cursor into the Children (output) property, press CTRL+K, type a name for your variable, press enter

Now run it and your variable will be an IENumerable of the UI Elements which you can now loop through and do other things with.

Remember, the UI Element is an object with many properties. The output of Find Children is not the text of the pulldown options, it’s the UI Element objects. So you have to then get the attribute you want such as innertext:

image

image

1 Like

Thanks @postwick. I want to use this for desktop application testing. So in selector what should I give.

If you’re trying to get the values in a pulldown then you indicate that pulldown.

1 Like

It’s working well. But one doubt in below image

I want to store this values as list. In get attribute save to is accepting only string. So I have given string as data type instead of list of strings.(UISTRING is of data type string only)
I want to store this items as list

The Save To just saves the value of the name attribute for that one UI Element that the loop is currently on.

You don’t even need the Get Attribute activity. Do this…

  • Create a variable, let’s call it OptionList - set the datatype to IEnumerable(of string) and then in the default put: New List(Of String)
  • delete the Get Attribute activity
  • put in an Assign activity and set it to: OptionList = OptionList.Concat({ITEM.Get("name").ToString})

After the loop is complete, OptionList will be a list of the values.

1 Like

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