locatorhealeragent

定位器修复代理:自动检测并修复因 DOM 变更导致自动化测试失败时损坏的定位器。

仓库最近推送
GitHub Stars
156
Forks
59
Issues / PRs
0

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "locatorhealeragent":https://skillpi.com/zh/skills/deepskill-36fb5512a0e318d8500bf284916b4d0b54a2d3df9dae27d32f6a2fae52d06fec。安装前核对上游来源和版本:https://github.com/anhtester/antigravity-testing-kit。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

定位器修复代理:自动检测并修复因 DOM 变更导致自动化测试失败时损坏的定位器。

0 下载

介绍来源: third_party · anhtester · 0.0.1 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
适合谁
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
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

当前收录版本

0.0.1

核对来源版本 ↗

安全与评测信息

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值78/100

亮点

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

亮点

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

待提升项

  • 缺少具体代码示例 原报告严重程度:轻微

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

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

亮点

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

待提升项

  • 工具来源不明 原报告严重程度:重大

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

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

  • 无不可逆操作确认机制 原报告严重程度:重大

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

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

亮点

  • 流程设计合理,覆盖主要异常场景
  • 提供了 locator 生成的优先级策略
证据可验 (前四项均值)77/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

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

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。