whatisgithub

What is self-healing-locator-framework?

mrnewdelhi/self-healing-locator-framework — explained in plain English

Analysis updated 2026-05-18

0TypeScriptAudience · developerComplexity · 3/5Setup · moderate

In one sentence

A TypeScript framework that repairs broken UI test locators automatically by asking the Google Gemini SDK for ranked replacement candidates, cached with confidence scores.

Mindmap

mindmap
  root((Self-Healing Locator))
    Cache
      Local JSON Store
      Confidence Scoring
      DOM Fingerprinting
    AI Escalation
      Text Pass
      Vision Pass
      Screenshot Context
    Validation
      Playwright Runtime
      Candidate Ranking
    Fallback
      No API Key Mode
      CI Compatibility

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Keep existing UI automation tests running when a CMS driven or third party website changes its markup unexpectedly.

USE CASE 2

Automatically generate and validate replacement element locators using an AI model instead of manually fixing broken selectors.

USE CASE 3

Track locator reliability over time with a confidence scored local cache instead of a binary pass or fail selector store.

USE CASE 4

Add a self healing locator layer to an existing Playwright test suite without changing the underlying test flow.

What is it built with?

TypeScriptPlaywrightGoogle Gemini SDKNode.js

How does it compare?

mrnewdelhi/self-healing-locator-framework0xradioac7iv/tempfsabboskhonov/hermium
Stars000
LanguageTypeScriptTypeScriptTypeScript
Setup difficultymoderatemoderatemoderate
Complexity3/53/54/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires a Gemini API key for live AI powered locator healing, though a deterministic fallback mode works without one.

So what is it?

Self-healing-locator-framework is a TypeScript project that shows how to keep UI automation tests working even when a website's elements change unexpectedly. It is aimed at teams running automated tests against CMS driven or black box products they do not fully control. The problem it addresses: element identifiers like button ids, page markup, and visible text can change without warning, for example when a client updates content through a CMS. When that happens, automated test locators break even though the test itself is still logically correct, and teams end up spending time updating locators by hand. This framework adds a self healing layer between the test and the browser rather than changing the test flow. When a test asks for an element, it first checks a local JSON cache of previously successful locators. Each cached entry has a confidence score that rises when it works and falls when it fails. If the cache misses, or a cached locator stops working, the framework calls the Google Gemini SDK to suggest up to five ranked replacement candidates. The first attempt uses a faster text based Gemini model working from DOM and accessibility snapshots, and if that does not produce anything usable and a screenshot is available, captured through Playwright, it escalates to a vision capable Gemini model that can also look at the page image. Whichever candidate the browser can actually locate is saved back to the cache with an updated confidence score. Element identity is kept stable through DOM fingerprinting, so the framework can still recognize an element even after its id or surrounding markup has changed. The included demo runs against a public sample website, and falls back to a deterministic local mode when no Gemini API key is present, so continuous integration pipelines keep working without needing a live key. The README also notes that adapting this approach to mobile testing through Appium requires extra handling, since mobile accessibility trees are usually limited to what is currently visible on screen.

Copy-paste prompts

Prompt 1
I want to add self healing locators to my Playwright test suite so tests survive small UI changes. Explain how a local locator cache with confidence scores could work.
Prompt 2
Show me how to use DOM fingerprinting to recognize the same UI element across page versions even after its id changes.
Prompt 3
How would I call an AI model like Gemini to suggest ranked CSS or role based locator candidates for a broken selector, then validate each candidate in the browser?
Prompt 4
Explain the tradeoffs between a text only pass and a vision enabled pass when asking an AI model to find an element from DOM snapshots plus a screenshot.
Prompt 5
I need my test automation to keep working in CI when no AI API key is configured. How do I build a deterministic local fallback for this?

Frequently asked questions

What is self-healing-locator-framework?

A TypeScript framework that repairs broken UI test locators automatically by asking the Google Gemini SDK for ranked replacement candidates, cached with confidence scores.

What language is self-healing-locator-framework written in?

Mainly TypeScript. The stack also includes TypeScript, Playwright, Google Gemini SDK.

How hard is self-healing-locator-framework to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is self-healing-locator-framework for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.