How can I do with XPath:
//bookstore/book/title or //bookstore/city/zipcode/title
Just //tit
If you want to select only one of two nodes with union operator, you can use this solution:
(//bookstore/book/title | //bookstore/city/zipcode/title)[1]
All title
nodes with zipcode
or book
node as parent:
Version 1:
//title[parent::zipcode|parent::book]
Version 2:
//bookstore/book/title|//bookstore/city/zipcode/title
It the element has two xpath. Then you can write two xpaths like below:
xpath1
| xpath2
Eg:
//input[@name="username"] | //input[@id="wm_login-username"]