RE: Advise on hierarchy for element locators


Hi, whilst I am aware of how to search for the different elements on a page, xpath, id, css etc, I was after some advise as to which hierarchy to use and why? E.g. should we use xpath locators before reverting to searching for the id?

Any help would be appreciated.

tilston1001 Train Asked on December 8, 2014 in Selenium WebDriver.
Add Comment
3 Answers

Hi Andy,

Thanks for supporting my answer Andy. Yes absolute xpaths are never advisable and we should always use relative xpath. I request you to download the tool Firepath and it will automatically generate relative xpath for you, you dont need to learn. Plus I am sharing the URL for Firepath usage and Effective xpaths techniques:

Firebug and Firepath
Choose Effective xpath

Please close the answers.

Lakshay Sharma

Professor Answered on December 9, 2014.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.