/html/body/form/select/option[@val = '1' and @val = '3']
so that means select the first and third option in a select-multiple form ?
If an xpath refers multiple elements on the DOM, It should be surrounded by brackets first () and then use numbering. if the xpath refers 4 elements in DOM and you need 3rd element then working xpath is (common xpath)[3].
By adding square brackets with index. By using position () method in xpath.
Did you mean or
?
/html/body/form/select/option[@val = '1' or @val = '3']
That should select both elements. By using and
you're trying to select an element whose val
is both 1
and 3
, which isn't going to work. :-)
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