Agent skill

Locator Replacer

by DanielSuo117 in DanielSuo117/velocitai

替换占位定位符为真实选择器(六级优先级)。触发:替换定位符、locator、selector、定位失败、元素找不到、DOM 分析。

MITAuto-check passedTesting & QA

Install Locator Replacer

skills CLI
$ npx skills add DanielSuo117/velocitai --skill locator-replacer -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install DanielSuo117/velocitai locator-replacer --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/DanielSuo117/velocitai.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/locator-replacer .claude/skills/locator-replacer && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
locator-replacer
GitHub stars
158
Token cost
~703 tokens
SKILL.md length
158 words
Files
3 (incl. references)
Skills in repo
13
Repo updated
First seen
Licence
MIT

At a glance

替换占位定位符为真实选择器(六级优先级)。触发:替换定位符、locator、selector、定位失败、元素找不到、DOM 分析。

  • Works in 5 steps: 分析目标页面 DOM → 为每个元素选择定位策略 → 更新页面对象 → …
  • Testing & QA work in your project
  • SKILL.md covers 适用场景, 定位符选择策略(六级优先级), 执行流程 and 定位符质量检查清单, plus 1 more section
  • Calls pytest

What it does

Locator Replacer is an agent skill from DanielSuo117/velocitai. 替换占位定位符为真实选择器(六级优先级)。触发:替换定位符、locator、selector、定位失败、元素找不到、DOM 分析。

Its SKILL.md is about 700 tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files, including reference files (for example `references/priority-levels.md` and `references/troubleshooting.md`).

It sits in Testing & QA. The repository describes itself as: Next-generation UI automation harness powered by Python & Playwright. Chat with AI Agents to seamlessly generate, architect, and execute enterprise-grade UI test code. The licence is MIT.

When your agent uses it

  • Testing & QA work in your project

Example prompts

  • “/locator-replacer”

Requirements

  • Python 3

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. 分析目标页面 DOM
  2. 为每个元素选择定位策略
  3. 更新页面对象
  4. 验证
  5. 同步更新文档

What it can do on your machine

Read from SKILL.md and the folder at commit dfcca7e. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • pytest

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Locator Replacer loads about 703 tokens when it runs, and up to ~1.8k if it reads all its reference files. Until then it costs about 21 tokens; SKILL.md has 158 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~21
When it runs · the whole SKILL.md, loaded when a task matches
~703
With references · SKILL.md plus every file in references/, read only if the agent opens them
~1.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from DanielSuo117/velocitai at commit dfcca7e, republished under its MIT licence (© DanielSuo117). 158 words, ~703 tokens.

Download SKILL.mdSave it as .claude/skills/locator-replacer/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
locator-replacer
description
替换占位定位符为真实选择器(六级优先级)。触发:替换定位符、locator、selector、定位失败、元素找不到、DOM 分析。

Locator Replacer — 定位符替换 Skill

适用场景

  • 将页面对象中 text= 占位定位符替换为真实选择器
  • 前端构建后原有选择器失效,需要重新定位
  • 新增页面元素需要选择最佳定位策略

定位符选择策略(六级优先级)

按优先级从高到低,逐级尝试,选中即停。优先使用页面上已有的语义化信息, 避免依赖需要前端额外配合的属性。

级别策略抗什么代价
P0ARIA role + 可见文本CSS 重构、构建哈希文案变更需同步
P1可见文本CSS 重构、构建哈希文案变更需同步、可能不唯一
P2表单特有属性(name/placeholder/type)样式与文案变更仅适用于表单控件
P3语义化 CSS class / id文案变更样式重构即失效
P4data-testid几乎全部需前端配合添加
P5相对 XPath / CSS 结构——最脆弱,最后手段

完整写法、判断依据与代码示例 → references/priority-levels.md

执行流程

Step 1: 分析目标页面 DOM

使用 agent-browser 打开目标页面,获取交互元素信息(工具选型遵循 agent-behavior P0.4,agent-browser 未安装时降级到 Playwright MCP):

操作步骤:
1. browser_navigate → 访问目标页面(已认证状态)
2. browser_snapshot → 获取页面无障碍树(accessibility tree)
3. browser_evaluate → 执行 JS 提取元素属性:
   - document.querySelectorAll('[data-testid]')  → 已有 testid
   - document.querySelectorAll('[role]')          → ARIA role
   - document.querySelectorAll('button, a, input') → 交互元素
Step 2: 为每个元素选择定位策略

对照页面对象中的每个占位定位符,按 P0→P5 逐级尝试,命中即停:

检查顺序条件使用
P0有 role + namerole=button[name='...']
P1text= 唯一且稳定text=...(标记"已验证唯一")
P2表单属性(placeholder/name/type)[placeholder='...']
P3稳定 CSS class(非哈希)css=.xxx
P4有 data-testid[data-testid='...']
P5以上均无相对 XPath(≤3 层)
Step 3: 更新页面对象
python
class <PageName>(BasePage):
    # 定位符 — 已替换为真实选择器(<日期>)
    <PRIMARY_ACTION_BTN> = "role=button[name='<按钮文案>']"  # P0: ARIA role
    <SECONDARY_LINK> = "text=<链接文案>"                      # P1: text(已验证唯一)
    PAGE_IDENTIFIER = "role=heading[name='<页面标题>']"       # P0: ARIA role

更新规则:

  • 在定位符行尾注释标注选择级别(# P0: ARIA role / # P1: text / ... / # P4: testid / # P5: XPath)
  • 如果 text= 经验证确实稳定且唯一,注释标记 # P1: text(已验证唯一)
  • 删除原来的 # 定位符 — 后续替换为实际选择器 注释
  • 更新为 # 定位符 — 已替换为真实选择器(日期)
Step 4: 验证
bash
# 在对应角色的回归文件中跑指定用例(运行前向用户确认 --env,见 agent-behavior P0.2)
pytest framework/tests/<role>/test_<role>_flow.py --env=<pre|prod> -v -k "test_<story_name>"
Step 5: 同步更新文档

更新 docs/regression-points.md 中对应 PageObject 的"关键定位符"段。


定位符质量检查清单

替换完成后,逐项确认:

  • 没有使用绝对 XPath(/html/body/...)
  • 没有使用哈希类名(sc-xxx, css-xxx, _module_xxx)
  • 没有使用纯数字索引(div[3],除非列表取第 N 项)
  • 每个定位符行尾标注了选择级别(# P0 ~ # P5)
  • XPath 层级不超过 3 层
  • 主流程测试在真实环境通过

常见问题处理

同一文本重复、元素无稳定属性、构建后批量失效等症状的处理方式 → references/troubleshooting.md

© DanielSuo117, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (references) in skills/locator-replacer of DanielSuo117/velocitai.

  • SKILL.md
  • references/priority-levels.md
  • references/troubleshooting.md

Open the folder on GitHubat commit dfcca7e

Compare with similar skills

Locator Replacer next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Locator Replacer compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Locator Replacer this skillDanielSuo117/velocitai158—~703Automated safety check: PassMIT
Web Application Testinganthropics/skills180k51 repos~966Automated safety check: PassApache-2.0
Diagnosing Bugsfossasia/eventyay-interpretation1.6k32 repos~2.1kAutomated safety check: PassApache-2.0
TDDpietheinstrengholt/rssmonster56430 repos~906Automated safety check: PassMIT
TDD WorkflowhellangleZ/burn-in-cceverywhere-ralph11211 repos~2.4kAutomated safety check: PassNone
TDDsanity-io/sanity6.4k20 repos~1kAutomated safety check: PassMIT

Similar skills

  • Web Application Testing

    anthropics/skills

    Official

    Tests local web applications with Python Playwright scripts, checking frontend behavior, capturing screenshots and reading browser console logs.

    180k GitHub starsUsed in 51 repos~966 tokens
    Testing & QAAuto-check passed
  • Diagnosing Bugs

    fossasia/eventyay-interpretation

    Diagnosis loop for hard bugs and performance regressions. An agent skill from fossasia/eventyay-interpretation.

    1.6k GitHub starsUsed in 32 repos~2.1k tokens
    Testing & QAAuto-check passed
  • TDD

    pietheinstrengholt/rssmonster

    Test-driven development. An agent skill from pietheinstrengholt/rssmonster.

    564 GitHub starsUsed in 30 repos~906 tokens
    Testing & QAAuto-check passed
  • TDD Workflow

    hellangleZ/burn-in-cceverywhere-ralph

    A skill your agent uses when writing new features, fixing bugs, or refactoring code.

    112 GitHub starsUsed in 11 repos~2.4k tokens
    Testing & QAAuto-check passed
  • TDD

    sanity-io/sanity

    Official

    Test-driven development with red-green-refactor loop. An agent skill from sanity-io/sanity.

    6.4k GitHub starsUsed in 20 repos~1k tokens
    Testing & QAAuto-check passed
  • Context Driven Development

    Ibrahim-3d/orchestrator-supaconductor

    A skill your agent uses when working with Conductor's context-driven development methodology, managing project context artifacts, or understanding the relationship between product.md, tech-stack.md…

    381 GitHub starsUsed in 9 repos~2.9k tokens
    Testing & QAAuto-check passed

More from DanielSuo117/velocitai

All 13 skills in this repo
  • Architecture

    DanielSuo117/velocitai

    POM 分层与 context 共享决策树。触发:架构、分层、POM、Page Object、基类设计、新增角色. An agent skill from DanielSuo117/velocitai.

    158 GitHub stars~726 tokensUpdated 12 days ago
    Auto-check passed
  • Page Load Assertion

    DanielSuo117/velocitai

    ispageloaded() 四种验证模式与调用层级。触发:页面断言、ispageloaded、page loaded、页面加载验证。

    158 GitHub stars~776 tokensUpdated 12 days ago
    Auto-check passed
  • Quick Debug

    DanielSuo117/velocitai

    测试失败时免登跳转原地排查修复。触发:排查、纠错、debug、定位符失败、超时、元素找不到、断言失败. An agent skill from DanielSuo117/velocitai.

    158 GitHub stars~471 tokensUpdated 12 days ago
    Auto-check passed
  • Save Verify Strategy

    DanielSuo117/velocitai

    表单保存后验证(Toast / 重定向 / 数据对比 / 富文本清空)。触发:保存验证、toast、重定向检测、Meta+A、保存成功判断。

    158 GitHub stars~547 tokensUpdated 12 days ago
    Auto-check passed
  • Test Runner

    DanielSuo117/velocitai

    运行 pytest + 结构化分析失败原因。触发:运行测试、跑测试、run test、pytest、失败分析、allure。

    158 GitHub stars~404 tokensUpdated 12 days ago
    Auto-check passed
  • Add Regression Point

    DanielSuo117/velocitai

    为已有 PageObject 增量添加回归测试点。触发:新增测试点、添加回归点、add test point、增加覆盖、扩展页面方法。

    158 GitHub stars~639 tokensUpdated 12 days ago
    Auto-check passed

Categories

Questions about Locator Replacer

What does Locator Replacer do?

替换占位定位符为真实选择器(六级优先级)。触发:替换定位符、locator、selector、定位失败、元素找不到、DOM 分析。. Locator Replacer is an agent skill from DanielSuo117/velocitai.

When should I use Locator Replacer?

Locator Replacer fits situations like: testing & QA work in your project.

How do I install Locator Replacer in Claude Code?

Run `npx skills add DanielSuo117/velocitai --skill locator-replacer -a claude-code`. Or copy the skill folder (skills/locator-replacer in DanielSuo117/velocitai) into .claude/skills/locator-replacer in your project. Claude Code loads it when a task matches its description.

How do I install Locator Replacer in Codex?

Run `npx skills add DanielSuo117/velocitai --skill locator-replacer -a codex`. Or copy the skill folder (skills/locator-replacer in DanielSuo117/velocitai) into .agents/skills/locator-replacer in your project. Codex loads it when a task matches its description.

Can I use Locator Replacer in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add DanielSuo117/velocitai --skill locator-replacer -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/locator-replacer, .gemini/skills/locator-replacer, .github/skills/locator-replacer and .opencode/skills/locator-replacer in your project.

What does Locator Replacer need to run?

Going by SKILL.md and its folder, Locator Replacer needs the command-line tools its instructions call (pytest). Our summary lists: Python 3.

Does Locator Replacer access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Locator Replacer safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Locator Replacer use?

Locator Replacer is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Locator Replacer use?

About 703 tokens (SKILL.md is roughly 2.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.1k tokens, read only when the agent opens those files.

What are the alternatives to Locator Replacer?

Skills that share tags, products or a category with Locator Replacer: Web Application Testing (anthropics/skills, 180k stars), Diagnosing Bugs (fossasia/eventyay-interpretation, 1.6k stars), TDD (pietheinstrengholt/rssmonster, 564 stars) and TDD Workflow (hellangleZ/burn-in-cceverywhere-ralph, 112 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Locator Replacer?

DanielSuo117 (a GitHub user) maintains it in DanielSuo117/velocitai, which has 158 GitHub stars. The repository holds 13 skills in this directory. The repository was last updated on September 27, 2026.

Source: DanielSuo117/velocitai on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.