I need help on choosing locators while writing selenium script…
what are the differences between using XPath, CSS, identifiers?
Is XPath preferred over the others? If so, why?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
CSS would be my choice for speed in execution and readability/maintainability. Further, CSS locators probably witness the least amount of change in an iterative environment (as opposed to changing link names, captions, etc.). The only downside to using CSS is the lack of in-built support within the IDE for formulating them.
Here is a great post articulating why CSS is the locator of choice 🙂