Reputation: 2822
Say I have the XPath expressions //*[@class="red"]/a
and //*[@class="blue"]
. How do I get both results in a single XPath expression? This is an OR operation.
Upvotes: 0
Views: 103
Reputation: 52665
You can try one of below options if you want your XPath to fetch nodes with class="blue"
OR class="red"
:
//*[@class=("blue", "red")]/a # XPath 2.0
//*[@class="blue" or @class="red"]/a
In case you need both node with class="blue"
and child of node with class="red"
:
//*[@class="blue"] | //*[@class="red"]/a
Upvotes: 2