Easy way to find XPath to elements.

Experts, I have started working on Selenium and would need your help in finding XPATH of webpage elements in browsers. If there is any tutorial using which I can help find the right xpath to elements using developer tools, it will greatly help. Thanks.

Just to add, I have used the chrome Inspect Element -> XPath option, but would like to know if there are other non-browser tools or plugins which are more friendlier and descriptive.
Who is Participating?
Craig KehlerDirector of Customer Service & Community RelationsCommented:
Hi sukhoi35,

One word of warning, I would try to stay away from XPATHs unless you absolutely have to. I've found that css selectors or ids make more readable code and tend to break less than XPATHs. Check out the Katalon Automation Recorder add-on for Chrome and Firefox. It makes it a bit easier to see the different selectors available and locate items in the page. You can record clicking the element and then select from the drop down to see the available selectors. You can use it to record steps and export crude code to get the job done, but I have always preferred to structure the automation logic first then fill in the selectors.

This article has a good write up on how to use CSS selectors.


Andrew LeniartSenior EditorCommented:
Hi Sukoi35,

Not a topic I'm particularly familiar with myself but have you checked the excellent resources available in the Articles section of Experts Exchange?

Perhaps the answer you're looking for is there?  

Here's a search result you may like to check;


I hope that's helpful.

Regards, Andrew
sukhoi35Author Commented:
Dear Andrew and Craig,
Thanks for your responses. Craig, I will surely consider your suggestion. Andrew, thanks for the excellent resource, it looks like it contains many of the other things I was actually looking for.
Andrew LeniartSenior EditorCommented:
You're very welcome Sukhoi35. Glad I was able to help a little.

Regards, Andrew
Craig KehlerDirector of Customer Service & Community RelationsCommented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.