ClaudeCode_Playwright_Demo: Skill for Claude Code

.claude/skills/smart_locator_agent/SKILL.md

Smart Locator Agent is a skill for Claude Code from anhtester/ClaudeCode_Playwright_Demo. It costs 28 tokens per session (778 once invoked), scanned A, a copy of Smart Locator Agent, MIT.

Guidance for creating stable UI automation locators for Playwright, Selenium, and Appium. It requires inspecting the page or mobile interface first, then choosing reliable attributes and checking that the locator is unique.

In plain words
What is it for?
Use it to create or review locators for web and mobile UI tests, migrate locators between the supported frameworks, and choose between accessibility attributes, test IDs, IDs, CSS selectors, and XPath.
Why use it?
It helps prevent automated tests from breaking when a page's layout or text changes. It also provides a fallback when the preferred locator is fragile.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

This is anhtester/ClaudeCode_Playwright_Demo's own configuration. It tells Claude Code how to work on ClaudeCode_Playwright_Demo itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything ClaudeCode_Playwright_Demo configures →

Reuse

Borrowing it

Nothing to install: this file belongs to anhtester/ClaudeCode_Playwright_Demo. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/anhtester/ClaudeCode_Playwright_Demo/main/.claude/skills/smart_locator_agent/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/anhtester/ClaudeCode_Playwright_Demo

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for Smart Locator Agent

README.md
[![agentmods](https://agentmods.dev/badge/skills/anhtester/claudecode_playwright_demo/smart_locator_agent/github.svg)](https://agentmods.dev/skills/anhtester/claudecode_playwright_demo/smart_locator_agent)
Your own site
<a href="https://agentmods.dev/skills/anhtester/claudecode_playwright_demo/smart_locator_agent"><img src="https://agentmods.dev/badge/skills/anhtester/claudecode_playwright_demo/smart_locator_agent/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for Smart Locator Agent

Your own site · 80×15
<a href="https://agentmods.dev/skills/anhtester/claudecode_playwright_demo/smart_locator_agent"><img src="https://agentmods.dev/badge/skills/anhtester/claudecode_playwright_demo/smart_locator_agent.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 28 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 778 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00028 $0.00778
Opus 5.5 $0.00011 $0.00311
Sonnet 5.5 $0.00006 $0.00156
Haiku 4.5 $0.00003 $0.00078

Measured 1mo ago against content hash 4e7d04a5ec38, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

Smart Locator Agent scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to Smart Locator Agent — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.claude/skills/smart_locator_agent/SKILL.md · 146 lines

How it starts

The opening of the file, as written. The whole thing — 146 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Smart Locator Agent

Purpose: Generate stable and maintainable locators for UI automation.

Applicable frameworks:

  • Playwright
  • Selenium
  • Appium

When to Use

Use this skill when:

  • Generating locators for new UI elements
  • Reviewing existing locators for stability
  • Migrating locators between frameworks

Responsibilities

The agent must:

  1. Inspect the DOM or mobile UI hierarchy (NEVER guess)
  2. Identify stable attributes
  3. Generate a reliable locator
  4. Validate locator uniqueness
  5. Provide fallback locator if primary is fragile

Locator Priority

Use the following priority order:

  1. Accessibility attributes (aria-label, role)
  2. data-testid / data-test / data-qa
  3. id
  4. name
  5. Framework semantic locator
  6. css selector
  7. xpath (last option)

Note: For detailed rules, refer to .agent/rules/locator_strategy.md.


Playwright Locators

Preferred locator methods:

  1. getByRole() — Best for semantic elements
  2. getByLabel() — Best for form fields with labels
  3. getByPlaceholder() — Best for inputs with placeholder text
  4. getByText() — Best for text content
  5. getByTestId() — Best when data-testid is available

Example:

page.getByRole("button", { name: "Submit" })
page.getByLabel("Email")
page.getByPlaceholder("Enter your password")

Note: For detailed rules, refer to .agent/rules/playwright_rules.md.


Selenium Locators

Preferred order:

  1. id
  2. data-testid
  3. name
  4. cssSelector
  5. xpath

Example:

driver.findElement(By.id("login-button"));
driver.findElement(By.cssSelector("button[data-testid='submit-btn']"));

Note: For detailed rules, refer to .agent/rules/selenium_rules.md.


Appium Locators

Preferred order:

  1. accessibility id
  2. resource-id
  3. id
  4. iOS predicate string
  5. class chain
  6. xpath

Example:

driver.findElement(AppiumBy.accessibilityId("login_button"));
driver.findElement(AppiumBy.id("com.app:id/login_button"));
driver.findElement(AppiumBy.iOSNsPredicateString("label == 'Login'"));

Read the full file on GitHub · 146 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 146 lines · 28 tokens per session scan A 4e7d04a5ec38

Subscribe to this mod's changes

Smart Locator Agent is a skill published in the GitHub repository anhtester/ClaudeCode_Playwright_Demo (3 stars, last pushed 5mo ago), licensed MIT. It adds 28 tokens to every session and 778 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 100% identical to Smart Locator Agent, differing in 0 lines, and is treated as a copy.

Related

Other skills, from other repositories

android-do-not-mock

How to write (or fix) Chromium Java unit tests (Robolectric / JUnit) without mocking or spying android.view.View, android.app.Activity, or their subclasses. Use when removing @SuppressWarnings("DoNotMock"), fixing a "DoNotMock" Error Prone error, replacing Mockito.mock(View.class) / @Mock Activity / spy(view), or when…

chromium/chromium · 96 tokens

android-unit-test

Guide for writing and converting Chromium Android unit tests across host Robolectric (chromejunittests) and on-device (chromepublicunittestapk) suites.

chromium/chromium · 36 tokens

android-test-batching

Guide for auditing and applying batching annotations (@Batch) and AutoReset rules (AutoResetCtaTransitTestRule) to Android javatests in Chromium. Use this skill when optimizing Java instrumentation test runtimes, resolving test state leaks, or migrating tests to batched execution.

chromium/chromium · 60 tokens

java-memory-leaks

How to identify and fix Java memory leaks in Android Chrome using LeakCanary traces.

chromium/chromium · 22 tokens

loadline

Running and analyzing LoadLine 1 and 2 benchmarks on Android using Crossbench. Use when you need to measure page loading performance, evaluate performance-related changes in Chrome, or collect Perfetto traces with realistic Chrome workload.

chromium/chromium · 47 tokens

accessibility-cleanup

Finds common violations of the Android accessibility API in the Clank App Java code and attempts to address them (e.g. hardcoded state change announcements, missing events, focus moving, assertive live regions, etc).

chromium/chromium · 49 tokens