consider both types:
<select name="garden">
<option>Flowers</option>
<option selected="selected">Shrubs</option>
<option>Trees</option>
<option selected="selected">Bushes</option>
<option>Grass</option>
<option>Dirt</option>
</select>
Is @val for actually indicating the value="" attribute ?
Is @value for indicating the innerText value ?
for example what happens if <option> doesn’t contain any value="" property. how would you select it then ?
select/option[@value = "Grass"]
Does Xpath automatically ignore white spaces for the case above? Should it be trimmed?
EDIT:
for selecting multiple options would this suffice ?
select/option[normalize-space(text())="Grass" or normalize-space(text())="Trees"]
To select by text value you can use
text()function. And normalize spaces is required, because they are not removed by default. Here is an example:@value– value of “value” attribute@val– value of “val” attributenormalize-space()– function returns the argument string with whitespace normalized by stripping leading and trailing whitespace and replacing sequences of whitespace characters by a single space