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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Andrew LeniartFreelance Journalist & IT ConsultantCommented:
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
Craig KehlerDirector of Customer 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.



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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 LeniartFreelance Journalist & IT ConsultantCommented:
You're very welcome Sukhoi35. Glad I was able to help a little.

Regards, Andrew
Craig KehlerDirector of Customer RelationsCommented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.