[ACCEPTED]-Xpath: how to select an option based on its text not value property?-xpath

Accepted answer
Score: 35

To select by text value you can use text() function. And 8 normalize spaces is required, because they 7 are not removed by default. Here is an example:


@value - value 6 of "value" attribute

@val - value of 5 "val" attribute

normalize-space() - function returns 4 the argument string with whitespace normalized 3 by stripping leading and trailing whitespace 2 and replacing sequences of whitespace characters 1 by a single space

Score: 12

Well, if whitespace isn't an issue:


I'd need 2 to check re whitespace, though. You could 1 always normalize:


More Related questions