An autonomous self-healing agent for Playwright tests with AI-powered Root Cause Analysis.
Project description
Healix
Healix is an intelligent web automation agent that self-heals broken selectors and adapts to dynamic web pages using AI-powered DOM analysis.
๐ฏ The Problem
Web automation is fragile. Selectors break when:
- Developers change class names
- DOM structure shifts
- Content loads dynamically
- A/B tests alter page layouts
๐ The Solution
Healix uses an agentic loop to automatically detect and fix selector failures:
- Observe - Analyze the current page state and DOM
- Reason - Use AI to determine the correct selector/action
- Act - Execute the corrected action
- Verify - Confirm the action succeeded
- Learn - Cache successful fixes for future use
Operational Workflow
flowchart TD
subgraph Execution["Test Execution Layer"]
Start(["๐ฅ Test Failure Detected"])
RetryCache(["โป๏ธ Re-run with Cache"])
RetryAI(["โก Re-run with AI Fix"])
end
subgraph Persistence["Persistence Layer"]
CheckCache{"๐ง Check Cache"}
ApplyCache["๐ฅ Apply Cached Selector"]
UpdateCache[("๐พ Update Cache")]
end
subgraph Intelligence["AI Intelligence Layer"]
CleanDOM["๐งผ DOM Scrubbing & Minification"]
AskOllama["๐ค Query Ollama (qwen2.5-coder)"]
Analyze["๐ Confidence Scoring"]
end
subgraph Feedback["Reporting Layer"]
Success(["โ
Healing Successful"])
Manual(["โ ๏ธ Manual Review Required"])
Proposal[("๐ Log Code Proposal")]
end
%% Flow Logic
Start --> CheckCache
CheckCache -- "Hit" --> ApplyCache
ApplyCache --> RetryCache
CheckCache -- "Miss" --> CleanDOM
RetryCache -- "Success" --> Success
RetryCache -- "Fail" --> CleanDOM
CleanDOM --> AskOllama
AskOllama --> Analyze
Analyze -- "High Confidence" --> RetryAI
Analyze -- "Low Confidence" --> Manual
RetryAI -- "Success" --> UpdateCache
UpdateCache --> Success
RetryAI -- "Fail" --> Manual
Success --> Proposal
Manual --> Proposal
Proposal --> End(["๐ Action Complete"])
%% Premium Styling
classDef startEnd fill:#f8fafc,stroke:#64748b,stroke-width:2px,color:#1e293b
classDef intelligence fill:#eff6ff,stroke:#3b82f6,stroke-width:2px,color:#1e3a8a
classDef persistence fill:#ecfdf5,stroke:#10b981,stroke-width:2px,color:#064e3b
classDef execution fill:#fff7ed,stroke:#f59e0b,stroke-width:2px,color:#7c2d12
classDef feedback fill:#faf5ff,stroke:#a855f7,stroke-width:2px,color:#581c87
classDef decision fill:#ffffff,stroke:#334155,stroke-width:2px,stroke-dasharray: 5 5
class Start,End startEnd
class CleanDOM,AskOllama,Analyze intelligence
class CheckCache,ApplyCache,UpdateCache persistence
class RetryCache,RetryAI execution
class Success,Manual,Proposal,GenerateFeedback feedback
class CheckCache,Analyze decision
๐๏ธ Architecture
healix/
โโโ .github/ # CI/CD workflows
โ โโโ workflows/
โ โโโ main.yml # Automated test runs
โโโ src/ # Source code for the library
โ โโโ healix/
โ โโโ __init__.py # Makes it a package
โ โโโ engine.py # The core Healix class
โ โโโ utilities/ # Helper functions
โ โโโ __init__.py
โ โโโ dom_scrubber.py # BeautifulSoup logic
โโโ tests/ # Test suites to verify Healix
โ โโโ integration/
โ โ โโโ test_login.py # Demo test case
โ โโโ unit/
โ โโโ test_engine.py # Testing the AI logic/cleaner
โโโ data/ # Local data storage
โ โโโ healix_cache.json # Persistent cache for fixes
โโโ docker/ # Containerized environments
โ โโโ Dockerfile
โโโ .gitignore # Ignore __pycache__ and local config
โโโ requirements.txt # Dependencies
โโโ README.md # This file
๐ ๏ธ Installation
# Clone the repository
git clone <repository-url>
cd healix
# Install dependencies
pip install -r requirements.txt
# Install Playwright browsers
playwright install chromium
๐ฆ Quick Start
import asyncio
from playwright.async_api import async_playwright
from healix.engine import smart_click
async def test_healix_agent():
async with async_playwright() as p:
browser = await p.chromium.launch(headless=False)
page = await browser.new_page()
await page.goto("https://example.com")
# Healix will automatically fix broken selectors
await smart_click(page, "#broken-selector")
await browser.close()
if __name__ == "__main__":
asyncio.run(test_healix_agent())
๐ง How It Works
DOM Cleaning & Privacy
- Strips scripts, styles, and heavy elements to save tokens
- Masks PII (Personally Identifiable Information) for privacy
- Focuses on actionable elements (buttons, links, inputs)
AI-Powered Reasoning
- Uses local LLM (Ollama) for selector analysis
- Considers both technical errors and visible page state
- Returns confidence scores and explanations
Persistent Learning
- Caches successful fixes in
healix_cache.json - Gets faster over time as it learns common patterns
- Maintains context across test runs
๐ง Configuration
Healix uses Ollama for local AI inference:
from healix.engine import Healix
# Default model: qwen2.5-coder:7b
healix = Healix(model="your-preferred-model")
Make sure Ollama is running:
ollama serve
๐งช Testing
# Run all tests
pytest tests/
# Run with coverage
pytest tests/ --cov=src/healix --cov-report=html
# Run integration tests (requires browser)
pytest tests/integration/
๐ณ Docker Support
# Build the container
docker build -t healix .
# Run tests in container
docker run healix
๐ค Contributing
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
๐ License
[Add your license here]
๐ฎ Roadmap
- Support for more AI models (OpenAI, Anthropic)
- Visual regression testing
- Multi-browser support expansion
- Performance optimization for large-scale testing
- Plugin system for custom healing strategies
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file healix_ai-0.1.0.tar.gz.
File metadata
- Download URL: healix_ai-0.1.0.tar.gz
- Upload date:
- Size: 10.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44dac58af04a51073fee93f1f34b782ad3da6cf7148369db34ac7d4c9a62761f
|
|
| MD5 |
775f7722ece4d8202feb1fba2bbdc68e
|
|
| BLAKE2b-256 |
aa1ce24e94146940fc04d3eb9b5bc7fcd82ced9f0477d47c0408b7395b1ddb9b
|
File details
Details for the file healix_ai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: healix_ai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c94c7c6d45739a2610d51cd736c94bbfc6deb1c69bb56292a7af985058eb8f99
|
|
| MD5 |
139b7368a91285916232ae3d1ff2276f
|
|
| BLAKE2b-256 |
bcaf28d4b7339d457ba4be200735bc00332f104e3b3d8fa9d2abb12318faa5c9
|