Self-healing element lookup for UI test automation — a prioritized chain of locator strategies, with visibility into which one actually locked onto each element. Generated Sep 25, 2026 03:06 UTC
Realism ladder
Same Strategy pattern, staged levels of proof
Strategies search a plain in-memory list — no browser at all. Proves the fallback chain and none_found reporting are correct in isolation.
The same strategies, backed by a real Chromium page rendering an inline HTML snippet instead of a Python list.
A public, unmodified login form. The submit button has no id, so the engine has to actually fall through to a role-based strategy to succeed.
OpenCV template matching against a screenshot — the last-resort strategy for elements with no reliable DOM attributes at all.
Self-healing spotlight
The differentiator, not just the pass/fail count
Detection, not silent magic
When an element is found by anything other than the first strategy in the list, the engine logs a WARNING naming the target and which strategy ultimately recovered it. It doesn't rewrite your locators for you — it tells you the moment one has gone stale, which is the first honest step toward self-healing.
Full results
14 tests · 10.77 s
| Module | Test | Result | Resolved via | Duration |
|---|---|---|---|---|
| Unit | test_exact_id_match | Passed | primary match | 1 ms |
| Unit | test_falls_through_to_next_strategy_when_id_is_stale | Passed | exact_id → visible_text | 1 ms |
| Unit | test_no_strategy_matches | Passed | primary match | 1 ms |
| Unit | test_warning_logged_when_locator_heals | Passed | exact_id → visible_text | 1 ms |
| Unit | test_no_warning_logged_when_primary_strategy_matches | Passed | primary match | 1 ms |
| Synthetic Browser | test_engine_finds_element_via_playwright_exact_id[chromium] | Passed | primary match | 733 ms |
| Synthetic Browser | test_engine_falls_back_to_visible_text_when_id_is_stale[chromium] | Passed | playwright_exact_id → playwright_visible_text | 3.09 s |
| Real Page | test_locator_engine_logs_in_on_a_real_page[chromium] | Passed | playwright_exact_id → playwright_role | 3.40 s |
| Real Page | test_locator_engine_reports_failed_login_via_visible_text[chromium] | Passed | playwright_exact_id → playwright_visible_text | 3.29 s |
| Visual Match | test_finds_reference_image_at_its_true_position | Passed | primary match | 38 ms |
| Visual Match | test_reports_not_found_for_unrelated_image | Passed | primary match | 11 ms |
| Visual Match | test_missing_files_return_none_instead_of_raising | Passed | primary match | 1 ms |
| Visual Match | test_below_threshold_match_is_treated_as_not_found | Passed | primary match | 13 ms |
| Visual Match | test_plugs_into_modular_locator_engine_as_a_fallback_strategy | Passed | primary match | 51 ms |