TestProject Forum
Powered by leading experts in the test automation community

Is there a way to prevent self-healing of elements?

Hi there. I am encountering a problem that I’m not sure how to solve.

I use dynamic locators for some elements on my page, like for example for an h3 element which is updated depending on my test parameters (inputs). My desire is that if this element is not found, my test should fail, as it indicates that some previous step has failed. However, what happens is that the self-healing functionality tries to find another element instead, in which case I can have a false “positive” test result.
I’d like to address 2 issues:

  • is there a way to specifiy that for locators including test properties (dynamic locators), self-healing is deactivated?
  • what I also noticed is that when using nested tests, if a self-healing action was performed in the nested test, the user does not see this in the current test report. This is also highly misleading and makes test debugging quite difficult. Could you include a message in the report to at least make the user aware of this?

Thanks!

Hello @sorina.negrila
Please check the following article on how ot disable the self-healing for specific elements.

1 Like