Master XPath
Once and For All
Stop writing fragile locators. Learn to craft bulletproof XPath expressions with interactive tutorials, a live playground, and real-world challenges.
Why XPathDecoded?
Everything you need to go from XPath confusion to XPath confidence.
Write Robust Locators
Learn patterns that survive DOM changes. Every example rated for stability so you know what's production-ready.
Interactive Playground
Test XPath expressions against real HTML in real-time. See matches highlighted, get instant feedback.
Practice & Master
Reinforce learning with MCQs, timed quizzes, and hands-on challenges. Track your progress as you improve.
Everything in one place
Learn it, try it, test yourself, and walk into the interview with answers.
Lessons
29 lessons in 6 tracks
From your first predicate to shadow DOM, Appium and scraping.
Guides
8 dated articles
Versions, framework comparisons, trends and locator strategy.
Playground
9 sample DOMs
Evaluate live, click to generate suggestions, see robustness scores.
Quizzes
76 questions in 8 topics
Multiple choice with explanations for every answer.
Challenges
20 hands-on challenges
Write the locator against real markup and get checked instantly.
Interview Prep
49 questions with answers
Junior to senior, plus whiteboard scenarios.
Recipes
56 copy-paste locators
Forms, tables, lists, dialogs, navigation, SVG and dynamic attributes.
Glossary
47 terms
Every term defined and linked to its lesson.
Quick Recipes
Common XPath patterns ready to use. Click any recipe to try it in the playground.
By data-testid
stableTarget an element by its test id attribute
//*[@data-testid='login-button']Exact visible label
mediumMatch the trimmed visible text of a button, tolerant of whitespace and nesting
//button[normalize-space()='Sign In']Input by Label
stableFind the input that follows a label
//label[normalize-space()='Email Address']/following-sibling::inputTable Cell by Header
mediumFind a cell by computing the column index from its header
//table//tr/td[count(//th[normalize-space()='Price']/preceding-sibling::th)+1]Button in a specific row
stableFilter the row by content, then descend to the action
//tr[td[normalize-space()='USB-C Hub']]//button[@data-action='edit']Button in the card with a title
mediumContainer-by-content, then the control inside it
//article[.//h2[normalize-space()='Smart Watch Series 5']]//button[normalize-space()='Add to Cart']Button inside an open dialog
stableAnchor to the dialog landmark to avoid the page-level duplicate
//*[@role='dialog']//button[normalize-space()='Save']Button containing an icon
mediumMatch the icon by its data attribute, then the button around it
//button[.//*[local-name()='svg'][@data-icon='trash']]Latest Guides
Versions, framework changes, locator strategy and what is happening in the ecosystem. Dated and kept current.
Locator Strategy in 2026: Where XPath Fits Alongside Role and Test-ID Locators
The industry has moved toward user-facing locators. XPath has not gone away. A pragmatic decision framework for choosing between test ids, ARIA roles, CSS and XPath in a modern suite.
Diagnosing Flaky Locators in CI
A locator that passes locally and fails in the pipeline is almost never random. The six causes, how to tell them apart from the failure message alone, and the XPath changes that fix each.
Self-Healing Locators and AI-Generated XPath: What Works and What to Watch
Tools now generate locators, repair them when they break, and let language-model agents drive browsers. A sober look at what that means for XPath skills and locator quality.
Test ID Conventions: data-testid, data-cy, data-test and How to Agree on One
Test ids are the most robust locator hook there is, if the team actually uses them consistently. A practical convention covering attribute name, naming scheme, where to put them, and how XPath and every framework consume them.