In coded UI is there a way to set the value of a ComboBox using the value of Value Attribute. Consider the following Html of a ComboBox:
<select name="ParametersID" tabindex="-1" title="ABC" class="form-control select-control select2-offscreen" id="Parameters_ID" autocomplete="off" data-val="true" data-val-number="This is a sample HTML" data-sets='["A","B","C","D","E","F"]' data-placeholder="Select only one">
<option value=""></option>
<option value="7311">A</option>
<option value="7312">B</option>
<option value="7313">C</option>
<option value="7314">D</option>
<option value="7315">E</option>
</select>
I want to set value of Html ComboBox using the values 7311, 7312 etc. not by the text "A", "B" etc.
I found that we properties like SelectedItem (to select using the text value) and SelectedIndex (to select by Index).
SelectedItem: Currently I am using this option, it is good but it is not that reliable. Since, text values inside dropdown can be updated from Admin pages. Also, these text values depends upon language selected by user.
SelectedIndex: This doesn't fit to any of my requirement, because I don't know which value will be at what index position.
There is a property "ValueAttribute" but it is only for getting the value not for set.