# Improve the quality of your CSS and XPath locators

**URL:** <https://club.ministryoftesting.com/t/improve-the-quality-of-your-css-and-xpath-locators/26026>\
**Category:** Archive\
**Tags:** cool-projects\
**Created:** [29 May 2019 08:29 UTC](https://club.ministryoftesting.com/t/improve-the-quality-of-your-css-and-xpath-locators/26026 "2019-05-29T08:29:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![davert](https://sea2.discourse-cdn.com/flex020/user_avatar/club.ministryoftesting.com/davert/32/3816_2.png) [@davert](https://club.ministryoftesting.com/u/davert)\
**Post date:** [29 May 2019 08:29 UTC](https://club.ministryoftesting.com/t/improve-the-quality-of-your-css-and-xpath-locators/26026/1 "2019-05-29T08:29:29Z")

</div>

I created a tool that validates your CSS or XPath locators and gives and advice on improving them.

➡[Locator Advicer - improve CSS / XPath locators - test CSS / XPath selectors](https://davertmik.github.io/locator/)

This tools should be used for everyone who runs browser tests with Selenium and wants to write better locators. Especially useful this should be for juniors to learn what is right and what is wrong ☀

 ![Selection_525](https://us1.discourse-cdn.com/flex020/uploads/ministryoftesting/original/2X/d/d8d0ad387ff45b14be522e836065d0b2f15b41ea.png)

It analyzes locators by 4 metrics

- length
- stability
- simplicity
- uniqueness

And shows you the result. Try your locators now!

---

<div class="post-metadata">

**Author:** ![rydberg](https://sea2.discourse-cdn.com/flex020/user_avatar/club.ministryoftesting.com/rydberg/32/6579_2.png) [@rydberg](https://club.ministryoftesting.com/u/rydberg)\
**Post date:** [26 March 2020 09:12 UTC](https://club.ministryoftesting.com/t/improve-the-quality-of-your-css-and-xpath-locators/26026/2 "2020-03-26T09:12:20Z")

</div>

Hello @davert This is a very cool tool. I am guilty of building very long x-path locators so I tried the tool and got some very good insights straight away.

I noticed that one xpath I use to find multiple elements got a low score in uniqueness and stability. Would it make sense to for the tool to ask whether the xpath is interned to locate a single element or multiple elements? The context matters I believe. Anyway thanks for building the tool. I will be using it in the future.

---

<div class="post-metadata">

**Author:** ![conrad.braam](https://sea2.discourse-cdn.com/flex020/user_avatar/club.ministryoftesting.com/conrad.braam/32/660_2.png) [@conrad.braam](https://club.ministryoftesting.com/u/conrad.braam)\
**Post date:** [12 October 2020 17:30 UTC](https://club.ministryoftesting.com/t/improve-the-quality-of-your-css-and-xpath-locators/26026/3 "2020-10-12T17:30:17Z")

</div>

Michael, was that typo in last line in your tester website intentional?  
“It’s simplifies your locators by 70% → simple and readble tests.”

Great idea by the way.
