RE: How to write Relative Xpath
To choose the relative xpath, it is advisable to look for the recent Id attribute. Look below at the HTML code of the above screen shot.
You can see the recent or last Id produced is ‘footer_nav‘. This id would be appropriate in this case, so a quality xpath will look like this: //*[@id=’social-media’]/ul/li/a
Did you notice the difference between the Absolute and Relative xpaths?
Absolute xpath: /html/body/div/div/div/footer/section/div/ul/li/a
Relative xpath: //*[@id=’social-media’]/ul/li/a
Here , I am not getting how you written Relative Xpath ?