If you’ve been in UI test automation for more than a minute, you’ve probably encountered a failed test with an error of “element not found.” Elements are visual components in your web application that users can engage, such as buttons, entry fields, or toggles. When a test automation tool can’t find the element, it fails the test.
However, we often find that the target element didn’t disappear; it just may have moved or changed in a way that an automation tool couldn’t recognize.
Today, Testim uses AI-powered smart locators to keep tests stable—and they just got wiser. Testim now automatically identifies when underlying properties change from initial baselines and uses AI to improve the locators to reflect the current state. For dynamic web applications, auto-improve is a game-changing advancement in keeping tests stable and minimizing maintenance.
Before we get into the details, let’s review how test automation works.
The art of identifying elements
Automation tools need to identify elements in a web application to take action. Think: locate a button and click it. Many automation tools (including all open-source frameworks) use a single selector like XPath (its location) or a CSS property (a descriptor) to find the object before taking action. However, web applications are often dynamic. When a developer changes the position of a button, or perhaps the color, text, or ID used to identify it, these single-selectors fail, and the test needs to be updated.
Testim’s approach is superior. Rather than use a single selector, Testim’s AI-powered smart locators scan the entire web application page to understand how elements are constructed and relate to each other. The algorithm scores the locators and assigns a confidence level to each element.
If a few attributes change, no problem; the Testim smart locators will still identify the object and keep the test functioning. For instance, if a developer changed a button’s location, its color from blue to green, and the text from “ADD TO CART” to “ADD TO BAG,” a user would still understand the button’s purpose, as does Testim.
So then why does Testim need to improve its locators?
Applications are increasingly dynamic, and while Testim’s locators will overcome a few changes, Testim’s confidence level will decrease. Additional changes to the button or the objects related to the button can cause further declines in confidence. That’s where auto-improve locators come in.
To enhance the accuracy of our AI-powered Smart Locators over time, they now adjust to changes. On each test execution, our algorithm compares the locator’s accuracy against the expected values. If the algorithm detects drift in the scores, it analyzes prior runs and automatically updates the locators to reflect a current, more reliable, and accurate state.
The new, improved locator is based on advanced learning of prior results and by evaluating the accuracy of the new, improved, and suggested locator. The algorithm validates the new locator accuracy, and only when validation passes successfully, Testim replaces the current locator with the new, improved locator.
As a result, tests authored in Testim remain highly stable as element locators are kept up to date even when changes in the application are frequent and vast. This dramatically improves the resiliency of the tests over time and minimizes the need for updates.
If you have customized your locator, we assume that you did that for a reason and we won’t attempt to improve it.
You can view your auto improved tests right from the Test Library marking all auto-improved tests:
By selecting an auto improved test you can view the new test revision created by the Testim Auto Improve process. In this example, the auto improve revision was created a month ago, marked with the special Auto-Improve [Ai] icon:
Drilling down to the test, you can see an example with the elements that were auto improved by Testim.
By simply toggling-on “show improved steps”, all the auto improve steps will be highlighted as shown in the below image.
Clicking on a specific step that was auto improved you will be able to see the improved locator and the improvement timing.
In this example the following element was selected:
Showing that the smart locator was auto improved 2 months ago:
When Testim uses AI to make an auto-improvement, it will include a marker to indicate which tests and elements Testim updated. You can see these updates in the test list, and the visual editor.
If you are using Testim, there’s nothing you need to do to take advantage of this enhanced learning. Testim will automatically detect when the locator needs improvement, make a proposed change, test the change, and upgrade the locator. The most resilient and stable tests in the industry just raised the bar to a new level.