XPath Cheat Sheet v1.1
XPath Cheat Sheet v1.1
PARTIAL TEXT
//tagName[contains(text(),'value')]
GRAND PARENT TO CHILD
(xpath of ancestor)//child-tagName
LAST CHILD
(xpath of parent)/child-tagName[last()]
COLLECTION
XPath pattern based on the
indexes with(out) relations.
Note: index starts at 1
AXES
USING ITEM INDEX XPath pattern based on the
(xpath)[index] sibling & Cousin relatiionships
USING OR CONDITION
//tagName[@att1='v1' or @att2='v2'] YOUNGER COUSIN
(xpath)/following::cousin-tagName
ELDER COUSIN
(xpath)/preceding::cousin-tagName