Consider this example
<select>
<option value="http://www.test1.com"> 1 </option>
<option value="http://www.test2.com"> 2 </option>
<option value="http://www.test3.com"> 3 </option>
</select>
How to I get in xpath the value of the option and not the display? Meaning, I want to get the value of the option element - http://www.test1.com for example and not 1, 2 or 3.
By position:
/select/option[1]/@value
By content:
/select/option[.=1]/@value
or
/select/option[normalize-space()='1']/@value
If you want the set of all values, simply use
/select/option/@value
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With