How healenium/healenium-web works
Project Type and Purpose
• This is a Java client-side library (“healenium-web”) that wraps Selenium WebDriver to provide self-healing of locators.
• It relies on an external healenium-backend (and optional imitator) service to fetch or compute alternative locators when a standard locator fails.
• Key use-case: integrate into existing Selenium test suites to transparently recover from broken locators.
File-Structure Analysis
• src/main/java/com/epam/healenium
• Core entrypoint: SelfHealingDriver, SelfHealingDriverWait
• Engine: SelfHealingEngine
• Handler/proxy layer: SelfHealingHandler, proxy invocation handlers (WebElementProxyHandler, TargetLocatorProxyInvocationHandler)
• Processor chain: BaseProcessor and its concrete implementations (FindElementProcessor, HealingProcessor, SaveHealingResultsProcessor, etc.)
• Client: RestClient
• Model/DTOs: RequestDto, ResponseDto, HealingResultDto, etc.
• Mapper: HealeniumMapper and by-strategy mappers under mapper/by
• Config: ProcessorConfig
• Utilities: ProxyFactory, ResourceReader, StackUtils
• src/main/resources: default configs (application.conf, simplelogger.properties), JS helper, index.html stub
• tests: integration tests bring up an embedded Jetty server (TestServer) to simulate backend, and use TestContainers (BackendContainer) for real-backend tests.
README Insights
• Expects a running healenium-backend at hlm.server.url
• Initialization via SelfHealingDriver.create(delegate)
• Configurable via healenium.properties (recovery-tries, score-cap, heal-enabled, backend URLs)
• Uses standard Selenium By or @FindBy annotations and an optional @DisableHealing
a. Main Components (rectangles)
• Test Code / User’s Test Suite
• SelfHealingLibrary (client)
• WebDriver Delegate (ChromeDriver or other)
• Proxy Layer (InvocationHandlers)
• SelfHealingEngine
• Processor Chain (FindElementProcessor → HealingProcessor → SaveHealingResultsProcessor, etc.)
• RestClient (HTTP client)
• Configuration Loader
• External Services
• healenium-backend (REST API)
• healenium-imitator (optional, for imitator calls)
1. Test invokes driver.findElement(By…) on SelfHealingDriver
2. SelfHealingDriver proxies call to WebElementProxyHandler
3. Handler delegates to SelfHealingEngine
4. Engine orchestrates Processor Chain
– FindElementProcessor tries standard locator → on failure → HealingProcessor
– HealingProcessor builds RequestDto and calls RestClient
5. RestClient → HTTP POST to healenium-backend API → returns HealingResultDto
6. Engine applies healed locator, invokes delegate.findElement(healedBy), returns WebElement proxy
7. SaveHealingResultsProcessor optionally sends metrics back to backend
c. Architectural Patterns & Principles
• Proxy Pattern: to intercept WebDriver and WebElement calls
• Chain of Responsibility: processors handle find, heal, save operations in sequence
• Dependency Injection (config loaded from properties & System properties)
• Strategy Pattern: different ByMapper implementations for locator strategies
d. Key Technologies/Frameworks
• Java 8+ with Maven (pom.xml)
• Selenium WebDriver
• REST client (e.g., OkHttp or Apache HTTP Client within RestClient)
• JSON (Jackson via NodeSerializer/NodeDeserializer)
• TestContainers/JUnit for integration tests
• Typesafe Config (application.conf)
Essential Architectural Elements to Capture
• Interception layer (proxies) around WebDriver and WebElement
• Engine coordinating processor chain
• Processor chain stages (find, heal, save)
• REST interaction with external services
• Configuration influence (recovery-tries, score-cap, heal-enabled)
• Mapping/serialization components (mappers, converters)