How are absolute XPaths different from relative XPaths? Which type is preferred?

875    Asked by BuffyHeaton in QA Testing , Asked on Jan 11, 2020
Answered by Buffy Heaton

XPaths begin with the root element are called Absolute XPaths. For example: html/head/body/table/tbody/tr/th

Relative XPaths start with “//”. For example: //table/tbody/tr/th

Relative XPath is favoured increasingly over outright XPath on the grounds that creating the table traits as child components of the parent div component will prevent the absolute XPath from finding the th component. On the other hand, the relative XPath will work with no issue.



Your Answer

Interviews

Parent Categories