Executing the TestsAuto-Healing Support for Custom action Xpaths in Web Automation Framework
Auto-Healing Support for Custom action Xpaths in Web Automation Framework
Now auto-healing functionality includes for custom actions to improve script robustness and reduce maintenance caused by locator changes. To enable this enhancement, a key architectural update has been made regarding how element locators and HTML targets are captured.
What Has Changed
Centralized Locator Capture: The call to CommonUtil.storeElementInJson(output, elementHtml); has been removed from individual workflow methods and custom function calls.
New Central Method: Element locator and HTML target capture is now centralized in the getYMLObjectRepositoryData()method. This ensures a consistent and unified tracking mechanism, which is essential for enabling the new auto-healing feature.
Action Required by Developers
To support this upgrade, developers must update their custom method definitions to include an additional identification parameter. This parameter should be passed to the getYMLObjectRepositoryData() method to allow:
Proper locator and element HTML tracking
Correct inclusion of locator metadata in htmlElement.json
Continued functionality of the auto-healing mechanism for custom code paths
The HtmlElement.json file will not be present initially; it is automatically generated after script execution, enabling auto-healing to function properly.
Example Update
Before:
public void customClickMethod(WebElement element) { // old way}
After:
public void customClickMethod(String elementIdentifier,WebElement element) {getYMLObjectRepositoryData(elementIdentifier); // Newcentralized call }
Output Storage
Captured locator and element data are stored in the htmlElement.json file, enabling runtime fallback and healing if a locator fails.
Advantages
Reduces script breakages due to DOM changes.
Improves maintainability for large test suites.
Provides consistent locator tracking across standard and custom methods.
Note: Users can create an overriding method to customize behavior without affecting the existing mapped custom actions. However, auto-healing will not work for these overridden methods.
Additionally, when creating any new custom method using the getYMLObjectRepositoryData method, make sure to include the two additional arguments as described earlier.