locatorhealeragent

Locator Healer Agent: automatically detects and repairs locators broken by DOM changes when automated tests fail.

Last repository push
GitHub Stars
156
Forks
59
Issues / PRs
0

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "locatorhealeragent" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-36fb5512a0e318d8500bf284916b4d0b54a2d3df9dae27d32f6a2fae52d06fec. Verify the upstream source and version against https://github.com/anhtester/antigravity-testing-kit before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

github.com

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Locator Healer Agent: automatically detects and repairs locators broken by DOM changes when automated tests fail.

0 Downloads

Introduction source: third_party · anhtester · 0.0.1 Reference

SkillPi interpretation

Tasks
Skill tự động phát hiện và sửa chữa locators bị hỏng khi automation tests fail do thay đổi DOM.
Audience
Use this skill when: A test fails with "element not found" or "element detached" errors UI has changed and existing locators no longer work After a frontend deployment that modifies DOM structure
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: Locator Healer Agent
description: Skill tự động phát hiện và sửa chữa locators bị hỏng khi automation tests fail do thay đổi DOM.

Locator Healer Agent

Purpose: Automatically repair broken locators when automation tests fail.


When to Use

Use this skill when:

  • A test fails with "element not found" or "element detached" errors
  • UI has changed and existing locators no longer work
  • After a frontend deployment that modifies DOM structure

Responsibilities

When a locator fails:

  1. Inspect current DOM or UI hierarchy
  2. Compare old locator with current page structure
  3. Identify updated attributes
  4. Generate a replacement locator
  5. Re-run test to verify the fix

Detection Strategy

Locator is considered broken when:

  • Element not found (NoSuchElementException / TimeoutError)
  • Element detached from DOM
  • Selector matches zero elements
  • Selector matches wrong element (different text/position)

Healing Workflow

Step 1: Analyze the Error

  • Read error log to identify which locator failed
  • Identify the Page Object file and line number

Step 2: Inspect Current DOM

  • Open the page using MCP tools
  • Navigate to the same state as the failing test
  • Inspect the target area in DOM

Step 3: Find Alternative Locator

Try the following in priority order:

  1. Accessibility attributes (aria-label, role)
  2. data-testid / data-test
  3. id (if stable, not auto-generated)
  4. Semantic locator (Playwright getByRole, getByLabel)
  5. css selector (stable attributes)
  6. xpath (relative, not positional)

Step 4: Validate & Replace

  • Verify the new locator matches exactly one element
  • Verify the element is the correct one (text, position, behavior)
  • Replace the broken locator in the Page Object class
  • Re-run the test

Difference from Smart Locator Agent

Aspect Locator Healer Smart Locator
Trigger Test failure (reactive) New element (proactive)
Input Broken locator + error log HTML/DOM element
Goal Fix existing locator Generate new locator
Workflow Error → Inspect → Replace → Verify Inspect → Generate → Validate

Verification

After healing:

  • [ ] Locator must match exactly one element
  • [ ] Element is the correct target (verify text/attributes)
  • [ ] Test must pass successfully
  • [ ] Locator is stable across page reloads

Rules References

  • .agent/rules/locator_strategy.md — Master locator priority map
  • .agent/rules/automation_rules.md — General automation best practices

Current listing version

0.0.1

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value78/100

Highlights

  • 解决自动化测试中因 DOM 变更导致定位器失效的高频痛点
  • 提供清晰的修复工作流和验证机制
Trigger Precision85/100

Highlights

  • 触发场景描述清晰,覆盖多种测试失败类型
  • description 位置正确且内容完整
Structure and Standards75/100

Areas to improve

  • 缺少具体代码示例 Reported severity: Minor

    Healing Workflow 中提到了 locator 生成策略,但缺少实际修复前后的 locator 代码示例,不利于用户理解具体操作。

    Recommendation: 建议在 Step 3 或 Verification 部分添加 1-2 个具体 locator 修复的代码示例(如修复前后的 CSS selector 或 XPath 对比)。

Highlights

  • 结构完整,包含完整的工作流和验证步骤
  • 章节划分清晰,逻辑连贯
Execution Reliability68/100

Areas to improve

  • 工具来源不明 Reported severity: Major

    Step 2 提到使用 MCP tools 打开页面和检查 DOM,但未明确说明具体使用哪些工具或如何调用,可能导致执行失败。

    Recommendation: 建议明确列出用于页面导航和 DOM 检查的具体 MCP 工具名称及调用方式。

  • 无不可逆操作确认机制 Reported severity: Major

    Step 4 提到替换 Page Object 文件中的 locator,此为不可逆操作,但未提供任何确认机制或备份建议,存在误操作风险。

    Recommendation: 建议在替换 locator 前添加确认步骤,如提示用户确认或自动备份原文件。

Highlights

  • 流程设计合理,覆盖主要异常场景
  • 提供了 locator 生成的优先级策略
Evidence Verifiability (mean of the first four)77/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.