HTML select list - getting item by value

Hi -

I am trying to select items from an HTML Select list, where the text of the values may change but the underlying values themselves will not. For example:

<select id="events">
  <option value="5001">Create User</option>
  <option value="5002">Create User Address</option>
  <option value="5003">Create Response Code</option>
  <option value="5004">Remove User</option>
</select>

In this example I want to select the item associated with value 5001, which currently reads as “Create User” but in the future may be changed to “Create Client” or some other text. I haven’t found a clear-cut way to approach this.

Thanks!

1 Like

One way using less activities, if select item works.

  1. Find Element on your List. - element as output
  2. Assign your value to a string variable - strVal = 5001
  3. In Select Item activity pass - element.FindFirst(FindScope.FIND_CHILDREN,new Selector("<webctrl value='"+strVal.Trim+"' />")).Get("aaname").ToString

go a chance to test, sample fyi

SelectItem_Value.xaml (7.9 KB)

3 Likes

Yes! That is what I was looking for - thank you very much.

Hello @vvaidya

I am not able to select the following webctrl value for the day and month option.

https://www.vivus.es/registration

can you help me out, please? I am able to find the selector but creating the new selector to assign the string value the error message its that it cant be found.

regards and thanks…

I’ve done it.

and outsite the “if” the Get element activity.

regards

What if I am trying to fill a form that the HTML value is the same with the data that I have in my excel file? Can you help me with that?

what if i have to fill it up from excel data?