Now a days most of the things devloped which
makes so easy to write Xpath without any HTML
knowledge. Anyway We have firebug for firefox browser where we can get
absolute Xpath and by using fire path we can check the relative Xpath for any
element.
In Same way in Chrome browser also we can add the
extensions where we can write our Xpath also which can generate relative Xpath
directly for any element.
1. By Using ChroPath : It's an extension
which we can add directly in chrome browser.
After added successfully inspect Element then go
to chropath and inspect Elements.
Below Snapshot:
2. By Using Relative Xpath Helper : It's
an extension which we can add directly
in chrome browser. After added successfully , Click on Relative Xpath Helper in
top of browser then Just right click on the elements you want to compare, or
type in your expression and press enter.
refer for more details : https://chrome.google.com/webstore/detail/relative-xpath-helper/eanaofphbanknlngejejepmfomkjaiic
