Xpath

Types of xpath

Difference between Absolute and Relative xpaths

  1. Absolute → xpath starts from root html node Relative → xpath directly jump to element on DOM
  2. Absolute → xpath start with single slash “/” Relative → xpath start with double slash “//”
  3. Absolute → xpath only use tags/nodes Relative → xpath use attributes

How to write xpaths manually

/html/body/div[6]/div[1]/div[1]/div[2]/div[1]/ul/li[1]/a

syntax of writing relative xpath :

//tagname[@attribute=’value’]