Skip to main content

robotframework-heal

A Robot Framework listener for failure triage, self-healing and root-cause analysis of UI tests (Browser/Playwright, SeleniumLibrary and Appium).

Every failed keyword is classified into a failure class, healed when possible — and always turned into a clean, enriched error record:

Failure class What happens
locator-drift tiered: deterministic candidates → LLM picks (verified live) → full-DOM fallback; elements inside iframes heal via frame >>> inner selectors
timing waits for page-ready and reruns — no LLM
viewport scrolls (web) or swipe-searches (Appium) the element into view — no LLM
overlay dismisses the blocking dialog/banner, verifies, reruns
form-state diagnoses unfilled required / invalid fields (DOM + optional screenshot)
assertion-drift opt-in: verifies UI text drifted and reruns with the corrected expectation
unknown root-cause analysis only

📙 Full documentation — tutorials, how-to guides, the complete generated HEAL_* configuration and CLI reference, and the design/benchmarks behind it.

Install

pip install robotframework-heal            # Browser/Playwright + Appium
pip install robotframework-heal[selenium]  # + SeleniumLibrary support

Quickstart

*** Settings ***
Library    Browser    timeout=3s
Library    Heal
# .env (auto-loaded from the working dir upwards; overrides the environment)
HEAL_MODEL=openai/gpt-4.1-nano
HEAL_BASE_URL=https://openrouter.ai/api/v1
HEAL_API_KEY=sk-...
heal doctor --role locator   # verify the endpoint
robot -d results suites/     # heal during the run

Then open results/heal/heal_report.html.

Library import

Library Heal is the canonical import. These also work:

Library    heal.rf.HealListener   # fully-qualified equivalent
Library    SelfHealing            # deprecated 0.3 shim (emits a warning)

Configuration

All configuration is read from HEAL_* environment variables. The nearest .env (searched from the working directory upwards) is loaded automatically and overrides already-set environment variables. The tables below cover the common settings; the full reference is generated from the schema and lists every option.

Model (required)

Variable Default Purpose
HEAL_MODEL – Model name (e.g. MiniMax-M2.5) or a pydantic-ai provider string (e.g. openai:gpt-4.1-mini)
HEAL_BASE_URL – OpenAI-compatible endpoint (vLLM, Ollama, LiteLLM, MiniMax, OpenRouter, …)
HEAL_API_KEY – API key for the endpoint
HEAL_OUTPUT_MODE auto Structured-output transport: auto / tool / native / prompted

Per-role overrides — each agent role can use its own backend; unset values fall back to the defaults above:

HEAL_TRIAGE_MODEL=openai/gpt-4.1-nano        # cheap/fast triage
HEAL_LOCATOR_MODEL=openai/gpt-4.1            # stronger locator healing
# also: HEAL_<ROLE>_BASE_URL / _API_KEY / _OUTPUT_MODE   (ROLE = TRIAGE|LOCATOR|VISION|RCA)

Behaviour / options

Variable Default Purpose
HEAL_ENABLED true Master switch for the healing engine
HEAL_LOCATOR_TIERS selection selection (candidates + index pick, ~70% fewer tokens) or generation (full-DOM prompt)
HEAL_FIX_TIER report Highest fix-application tier: report / patch / in-place
HEAL_WARM_START true Reuse healed locators from previous runs (history.sqlite) — repeat heals cost zero tokens
HEAL_HEAL_ASSERTIONS false Opt-in assertion-drift healing
HEAL_FORM_FILL false Opt-in form auto-fill (invents test data; diagnose-only by default)

Budgets

Variable Default Purpose
HEAL_MAX_FAILURE_SECONDS 60 Wall-clock cap per healing transaction
HEAL_MAX_FAILURE_TOKENS 50000 Token cap per transaction
HEAL_MAX_RUN_TOKENS 2000000 Token cap per run; breach degrades to RCA-only
HEAL_REQUEST_LIMIT 8 Max LLM requests per agent run within a transaction
HEAL_AGENT_RETRIES 3 Output-validator retries per agent run
HEAL_READY_TIMEOUT_SECONDS 20 Max wait for page-ready in timing recovery

Reporting

Variable Default Purpose
HEAL_REPORT_DIR <RF output dir>/heal Where artifacts are written
HEAL_HISTORY_DB <report dir>/history.sqlite Cross-run healing history (powers warm start)

What you get

After a run, the report directory contains:

  • heal_report.html — self-contained dashboard (healed and unhealed failures, evidence, costs, fix proposals)
  • events.jsonl — append-only, crash-safe run store
  • summary.json — for CI gates (e.g. fail above a heal-count threshold)
  • healed_files/ + diffs/ — read-only fixed copies and word-highlighted diffs (your suites are never modified)
  • heal.patch — git-appliable fixes (at HEAL_FIX_TIER=patch)
  • history.sqlite — cross-run memory

CLI

heal triage results/    # summarize failures, RCAs and fix proposals
heal report results/    # render dashboard + diffs
heal apply results/     # apply fixes (--patch / --in-place)
heal doctor --role all  # probe configured model endpoints
heal history db.sqlite  # repeat-healing hotspots
heal mcp results/        # MCP server for coding agents

Documentation

Development

uv sync
uv run invoke heal-utests                     # unit tests (no LLM, no browser)
uv run invoke heal-atests                     # acceptance tests (real browser, no LLM)
uv run invoke heal-atests --live-llm          # + live healing (needs HEAL_* config)
uv run --group docs mkdocs serve              # preview the docs site

License

Apache-2.0.

Metadata

Release files for robotframework-heal 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for robotframework-heal 0.4.0
File Size Uploaded
robotframework_heal-0.4.0.tar.gz 638.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for robotframework-heal 0.4.0
File Interpreter ABI Platform
robotframework_heal-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 740.7 kB

Release files / robotframework_heal-0.4.0.tar.gz

Download URL robotframework_heal-0.4.0.tar.gz
Size 638.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6ae36f44f4d6a63e3a60876ad0e3eea90baba6221b217cc3615d19fcc4874b62
BLAKE2b-256 checksum
How to use checksums
26f1dcf2ef864c87d6a8015538f271237a97aca81da18c9967e971bf6343f5af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / robotframework_heal-0.4.0-py3-none-any.whl

Download URL robotframework_heal-0.4.0-py3-none-any.whl
Size 102.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
395adf6c2e02aa3577f817026d5d751a792cf5ae92c51592c095b27af0cbc050
BLAKE2b-256 checksum
How to use checksums
cf335d73d56295985932b1088d92e604709ca1828e36ed0488a1596c797713f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page