Monday, 8 February 2016

What is difference absolute & relative xpath? Write one xpath manually?



Ans:  XPATH is a language that describes how to locate specific elements, attributes, etc. in a xml document. It allows you to locate specific content within an XML document. 
1) Absolute XPath : Relative XPath starts with / ( Note : ‘/’ is used for root path)
b) html/body/div[23]/div[4]/div[1]/div[2]/div/div
2) Relative XPath : Relative XPath starts with // (Note :‘//’ is used for current path)
Syntax//element_type[@attribute_name =’value’]
e.g. a) //*[@id='gbqfba']
b)//div[4]/div[1]/div[2]/div/div
  

No comments:

Post a Comment