Become a LocatorXpert

When your users expect rapid, high-quality releases, quick and reliable quality assurance (QA) is crucial. To meet this growing need,…

Testim LocatorXpert Webinar
Author Avatar
By Shahar Chen,

When your users expect rapid, high-quality releases, quick and reliable quality assurance (QA) is crucial. To meet this growing need, automation through code has grown in popularity, particularly in CI/CD pipelines. But using Xpath can incur heavy time costs and a heavy maintenance burden.

What are smart locators and why do you need them?

That’s why Testim built smart locators. What are these and what do they do? Testim offers a user-friendly interface to record your tests. Let’s say you click a button. When you record a click action, Testim uses an AI-based algorithm to analyze the DOM (i.e. structure of the web page) from the top all the way down to the clicked element. It collects unique identifiers for each element and assigns confidence levels to each attribute. For example, a “text” attribute might have a higher confidence level than a “style” attribute due to its unique nature.

Locators DOM

There’s a smarter, more automated way to find elements. Unlike other Xpath or CSS selectors, smart locators gather multiple parent elements, each with multiple unique attributes for a single element. This provides a stable way to find elements during testing and handles changes in the DOM gracefully, so your tests won’t break when attributes change in new versions.

Locators in action

During playback, Testim uses smart locators to locate and score the elements, giving a clear view into which element was selected along the way using element ID injected by Testim into the DOM:

ElementId

Furthermore, Testim’s smart locators allow for dynamic testing by letting you parameterize locators and use regex. If your application consistently presents a greeting message such as “welcome username,” for example, you can customize your locators using regular expressions (regex). There are several pre-defined regex options available, including “contains,” “starts with,” “ends with,” and “equals.” Here’s an illustration of the “contains” option:

ParamName

Say you need to select a specific value from a dropdown—no worries! You can define a parameter with a specific value and implement it in the Inner Text field inside the Edit Locator modal:

ParameterAgain

Give smart locators a try and drop us a line

Testim’s smart locators allow you to record tests with a user-friendly interface and tap into AI to find elements quickly and stabilizes your tests, so you can minimize the time you spend on maintenance and author new tests instead. Take them for a spin and let us know what you think! Happy testing.


📅 Save the date & join our webinar to become a LocatorXpert 💫

Locators Webinar - Invitation