Skip to content

SelfHealingDriver Fails to Update Locator After UI Change #310

Description

@anandxp

When running tests with Healenium 3.5.6, the SelfHealingDriver fails to update a locator after a UI element's class attribute changes, causing test failures. The healing mechanism doesn't seem to detect the new locator.

Steps to Reproduce

Set up Healenium 3.5.6 in a Maven project with Selenium 4.15.0.

Configure SelfHealingDriver:

WebDriver baseDriver = new ChromeDriver();
SelfHealingDriver driver = SelfHealingDriver.create(baseDriver);

Navigate to a test page (e.g., https://explore.jobs.netflix.net/careers).
Interact with an element: driver.findElement(By.cssSelector(".go-btn-careers")).click();.
This page UI was changed and it become .go-button later

Rerun the test without updating the locator in the code.

Expected Behavior
Healenium should Detect the UI change and update the locator to .go-button automatically, allowing the test to pass.

Actual Result:
The test fails with a NoSuchElementException because the original locator .go-btn-careers is not found, and Healenium does not heal it.

Environment
Healenium Version: 3.5.6
Selenium Version: 4.15.0
Java Version: 21
Browser: Chrome 126
OS: Windows 11

Healenium Proxy: Running at http://localhost:8085

Logs
org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":".go-btn-careers"}
Healing Report: No alternative locator found for .go-btn-careers

Additional Context :
The test page is a simple HTML page with a button that changes its class on page refresh.
The issue persists even after restarting the Healenium proxy.
It seems the healing algorithm might not be parsing the updated DOM correctly. Could the issue be related to caching or incomplete DOM scanning?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions