Healenium: Self-Healing Library for Selenium-based Automated Tests

16 / Feb / 2023 by mahesh.wankhede 0 comments


Due to the altered layout and broken selectors, all automated UI tests eventually encounter NoSuchElementException. The build becomes red and the test crashes as a result. This discussion presents the new self-healing automation tool – Healenium that helps you to overcome problems of instability of automated tests automatically and spend less time on test maintenance.

You may incorporate Healenium into your automation test code base because it is a standalone Java JAR. You may locate controls (new locators) for updated websites and adjust your tests in runtime by using machine learning (ML) methods for recognizing webpage changes…



Improve Stability of Selenium-Based Automated Tests

Replace broken locator value with one that best matches & fixes tests in runtime

Minimize Maintenance Time

Reduce the amount of non-product-related test failures

Receive Rich Reporting

Manage actionable controls with new values in the code base with just one click



Healenium allows us to overcome the problem of instability of automated tests and spend less time on automation script support.

Adopts test to UI changes

Self-healing capabilities allow to replacement “broken” locator with a new value and the fixed test in runtime.

Improves E2E tests stability

UI changes will not affect the automated E2E test’s stability

Handles NoSuchElement test failures

In runtime, Healenium replaces failed to control with a new value that best matches and performs an action with replaced control successfully

Updates test code base

IntelliJ IDEA plugin updates control with new values in the code base in just one click

Supports advanced features

Healenium supports parallel test runs, remote test runs, IFrames, Actions, and Selenide integration

Visualize controls state

Provides detailed reporting with fixed control values and screenshots

Test on mobile

All of these features are available for mobile testing as well



how it works

Healenium integrates with Test Automation Framework for frictionless Selenium testing

Handles NoSuchElement test failures: In runtime replaces failed to control with a new value that matches the best and performs an action with replaced control successfully;

Can be easily configured by just wrapping your Selenium driver with SelfHealingDriver. Usage of ML algorithm for page changes identification will help to find controls (new locators) for updated pages and fix your tests in a runtime.

Friendly reporting and Healenium plugin for IntelliJ IDE brings visibility of controls state and provides an ability to update “broken” locators automatically in the code base.


Tool and technologies involved

Healenium consists of two parts: one is the client which integrates with the test automation framework and the other part is a back-end system that stores the state of each UI page.

Client – healenium-web is available as a Gradle/Maven dependency at the epam repository. Add a plugin to enable the Healenium report to get overall results for the self-healing elements.

Back-end – The dockerized image of the back-end application and database as Postgres is used to store the state of UI pages and application maintain DB transaction form application. Two files are used to set up the backend: one is the Compose file having both docker images, required volume, and network configuration; the other one is an SQL file that creates the schema and grants privileges to the user.

Setup and Internal Working

The Healenium client consists of self-healing algorithms using Tree comparison dependencies. Whenever a test is run, it captures the current DOM state of the page in a Tree format at the database level and within the structure; it also includes the test class name, package, locator details, and node path.

To set up Healenium, you should first set up the back-end created for the grab docker-compose and the init.sql file – you can access this from the GitHub location here and place it below the directory structure and click on compose – https://github.com/healenium/healenium-backend/tree/master/example

Go to docker-compose location > docker-compose up -d. This will create the Postgres container with the healenium database in it, and the init.sql file will create the schema inside the healenium db. Then create a healenium/hlm-backend container as a client, which will create the required table under the healenium schema, as shown below. After that, you can integrate the test framework with healenium and add healenium-web dependencies. These dependencies typically are service calls to the back end. Now we wrap the WebDriver in the new SelfHealing Driver.



Healenium successfully corrected all the failures in the above scenarios and proved to be a very reliable solution for test projects using page object patterns. It can be extended to mobile automation using the Appium-based adapter and Healenium also provides a plugin for IntelliJ IDEA IDE for updating the code base with the new values of the locators. Our product was relatively mature and had a stable UI where we didn’t feel it was necessary to implement the Healenium solution at a larger scale as the perceived ROI was lower; however, we definitely recommend evaluating it for applications going through frequent changes where it will deliver much higher value. Moreover, it’s an AI implementation into automation, which is a step forward in building and maintaining resilient automation suites.

This blog contains only the introduction and some quick steps for getting started. I am working on another blog for detailed and step-by-step tutorials for Healenium.

See you there…

Thank you for reading this blog, if you have queries or feedback please let me know in the comment section.


Leave a Reply

Your email address will not be published. Required fields are marked *