- Home
- Skills
- Testing & Debugging
- web automation locator creator
web automation locator creator
Generate stable CSS and XPath locators for Playwright, Selenium, and Cypress with built-in uniqueness validation.
$10
Works with the AI Agents you already use
web automation locator creator
Example session with this skill installed
Generate locators for the Submit button on the login page. It has a dynamic ID but a stable data-testid='login-submit'. Use Playwright syntax.
- Read your context and instructions
- Compiled the web automation locator
I have generated and validated the locators for the Submit button on the login page. I prioritized the data-testid attribute to ensure stability against the dynamic IDs observed in the DOM.
Web UI Locators: Submit Button
| Detail | Value |
|---|---|
| Element | Submit Button |
| Page | Login Page |
| Framework | Playwright |
| Primary CSS | button[data-testid='login-submit'] |
| Fallback XPath | //button[@data-testid='login-submit' and normalize-space()='Submit'] |
Attribute Stability Analysis
- Stable:
data-testidis explicitly defined for testing and should persist across UI changes.
Volatile: The id attribute (e.g., id="btn_9921") is dynamic and changes on every page load; it has been excluded from these selectors.
Context: The element is nested within a form[name='login'] container, which provides additional structural anchoring if needed.
Validation Evidence
- Uniqueness Check: The CSS selector was queried against the provided DOM snapshot and returned exactly 1 match.
Execution Check: A Playwright page.locator() call successfully resolved to the target element without timeout or multiple-match errors.
3. Fallback Match: The XPath expression resolves to the same node as the primary CSS selector.
Next steps
- Copy the Primary CSS locator into your Playwright Page Object Model.
- Verify the locator in your staging environment to confirm no collisions with other forms.
- Store this report in your project's
docs/locators/directory for team reference.
Connects securely to your tools. The creator never sees your data.
About this skill
Writing resilient UI selectors for web automation is a constant battle against dynamic IDs and brittle DOM structures. This skill generates stable, framework-agnostic locators that survive minor UI updates and layout shifts.
What it does
- Multi-framework support generates specific syntax for Playwright, Selenium, Cypress, and Ted.
- Priority attribute selection targets stable markers like
data-testid,aria-label, andnamewhile ignoring volatile timestamps or dynamic hashes. - Dual-strategy output creates primary CSS selectors and deterministic XPath fallbacks for every element.
- Conflict detection ensures every generated locator resolves to exactly one element to prevent flaky test execution.
- Stability analysis identifies which attributes are reliable and which are likely to break during future deployments.
How it works
- DOM Inspection where the agent snapshots the target element and records structural context and attributes.
- Strategy selection to prioritize the most stable attribute available in the current HTML.
- Selector construction of primary CSS and fallback XPath strings using short, deterministic logic.
- Framework validation via a runtime query to confirm the selector returns a single unique match.
- Documentation of the result in a markdown report including validation evidence.
Frameworks & tools
The skill supports Selenium, Playwright, Cypress, and Ted. It works with HTML5, standard CSS, and XPath axes.
Why this beats prompting it yourself
Generic prompts often return brittle :nth-child selectors or rely on dynamic IDs that change on page reload. This skill enforces a strict hierarchy of stability and mandates a dual-selector approach with a required validation gate to ensure the code actually runs in your test suite.
Use cases
- Generating
data-testidbased selectors for a new React component library. - Refactoring brittle XPath strings in a legacy Selenium test suite.
- Building a locator map for a Playwright project during initial scaffolding.
- Handling elements with dynamic IDs or complex nested structures.
Known limitations
Does not support mobile native applications. Assumes target HTML is accessible and not hidden behind complex iframe or Shadow DOM security layers that block standard inspection.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Testing & Debugging.
No support for native mobile apps. Requires accessible DOM structure. Does not guarantee perfection without validation against the live application.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 2 days ago