How to heal the locators with Self Healing Mechanism in Katalon Studio

Reading Time: 4 minutes

Hi Folks!

While performing automated testing, there are many instances when an automation engineer encounters NoElementFoundException. This generally means that your script is unable to find the specified locators. This can be due to many of the reasons, either it is broken locator, race condition, wrong locator strategy etc.

The question that arises now is how can we avoid such errors in our automation scripts. Well, we can achieve this by implementing Self Healing Mechanism. Katalon Studio is a powerful tool that implements a self-healing mechanism. Before moving to the implementation, let’s first know what is a self healing mechanism.

What is Self Healing Mechanism?

  • Self Healing Mechanism is when your script is unable to find its default locator, it will keep looking for other alternatives. In this way, our test execution will be running instead of being failed due to an element not found exception.

Katalon and Self Healing

  • Katalon has an inbuilt mechanism of self-healing. If enabled, it will help us to reduce the flakiness of the test cases.
  • If Katalon is unable to find the default locator of a web object, it will keep locating the object with its pre-configured alternative locators. This will keep the test execution seamless.
  • Once the test case has passed, the broken locator can be permanently replaced with the alternative one.

Katalon Studio introduced self-healing since version 7.6 for the Web UI testing.

Setting Up Self Healing in Katalon Studio

How to enable Self Healing in Katalon Studio

Self Healing is enabled in Katalon Studio by default.

  • To verify the same, check the Self Healing menu in the toolbar. If it has Disable Self-healing option, then the self-healing is enabled for your project.
  • Or, you can navigate to Project > Settings > Self Healing> WebUI and then turn on or off the Self Healing option.
  • Self Healing in Katalon Studio currently supports 4 locator methods: XPath, CSS Selector, Attribute and Images.
Self Healing settings
  • One can decide to use one or more element locator methods by simply checking and unchecking the checkboxes. We can also prioritize the order of alternative methods by moving them up and down.
  • This gives rise to a very obvious question – what do we mean by priority? In simple words, priority is actually an order in which Katalon Studio will look for an alternative.

For example, if Katalon Studio fails to recognise the default locator of some web object, it will start looking in the following order.

  • First, it will look for the relative XPath. If it is successful in locating the alternative Xpath, it will continue execution and later suggest replacing the default XPath with an alternative one.
  • If it fails to locate an object by the XPath, Katlon will move to attributes, then CSS and lastly image.
  • We can also generate the alternative locators automatically by using the Record and Playback or Object Spy method that automatically captures the web element and its properties.

When not to use Self Healing?

  • Self Healing is best to use when you have to interact with the web object. Like if you want to click some link, set the text etc. In this case, if Katalon fails to find the object by default locator, it can interact by locating it using an alternative locator. This helps to run our test cases smoothly.
  • Self Healing is not for the purpose where we are verifying or asserting something. Such as in verifyElementPresent or verifyElementPresent etc. This will result in false positives or false negatives.
  • We can also configure keywords to opt out of Self Healing Mechanism. Just add the keywords in Exclude section and the objects used with these keywords will never be self-healed. By default, it has verifyElementPresent and verifyElemenNotPresent.
excluded keywords

Passed Test Execution with self healed test cases

  • Here’s an example where Katalon encountered broken objects and it kept executing the test cases by self-healing the objects.
test execution
  • After successful test execution, it gives us the choice to replace the current locators with the older ones. You can review all the self-healed objects under self-healing insights.
self healing insights
  • Here, we can get an insight into the self-healing process. It has detailed information about the broken locator, the locator that helped in locating the object, the method etc. It will suggest replacing the broken one with an alternative option. Once approved, it will permanently replace the broken locator with the proposed one.


Self Healing Mechanism is very useful where we need to interact with the web objects and there are more chances of broken locators. It helps us to keep the execution and avoid flakiness in the test cases.

Written by 

Gargi Sanadhya is a QA consultant with an experience more than a year in manual and automated testing. She is familiar with the core concepts of manual testing and automated testing using Selenium and Katalon Studio. She is always eager to acquire new tech skills and learn new & advanced concepts to advance herself. She likes to read books, watch web series and know more about space and technology.