Improve the quality of your CSS and XPath locators

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

:arrow_right: 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 :sunny:

It analyzes locators by 4 metrics

  • length
  • stability
  • simplicity
  • uniqueness

And shows you the result. Try your locators now!

4 Likes

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.