Selecting a particular items in a drop down

Hi Guys,

Hope you are doing well.
I need to select a drop down & the select items should contain some data. I do not know what are the drop down values are available.

Condition for selected Item are below, both condition should be matched.

  • List item It should end with “XXXX”

  • List item It should contain the value - “#####”

My approach - as to get the items present in the drop down, then iterate one by one & get the match. And at the end pass that matched value to drop down.

Please help on this. If you can share one sample code then that will be great.

@hasib08 @aanandsanraj @Palaniyappan

1 Like

You need to use like this with the right expression and selector for your dropdown:

"<webctrl aaname='"+System.Text.RegularExpressions.Regex.Match("Name 123","\w+").ToString+"' tag='A' />"

1 Like

Assign value into variable and place the variables into selector of matching the two conditions.


Hi @Ashish6541

Sorry for late response
Assign value to variable and change the selector as dynamic like below
"<webctrl aaname='"+variable+").ToString+"' tag='A' />"

As far i know, we can do it in below ways,
Way 1: Directly Pass the value to the selector of the drop down.
Way 2: Use get attribute to get the all the available drop down values and store it in a array. Then iterate it and check the required the condition to get the required value to select. But if there is more drop down values then this can not be good choice.
Way 3: use Regex in the Selectors to select the value - see the comments of @bcorrea in this post above.
Way 4: As mentioned by @aanandsanraj in the previous comment.

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