Locators & DOM
Locator Lab
One workbench for CSS, XPath, axes and Playwright locators: 95+ tricky scenarios with live match checking.
Practice tasks
- Solve one scenario in every category: CSS, XPath, XPath axes and Playwright built-in locators.
- Write the same locator three ways (CSS, XPath, getByRole) and compare how robust each is.
- Make a locator that matches exactly one element, then break it on purpose and read the strict-mode warning.
- Paste your own HTML into the Sandbox tab and pick locators by clicking elements in the preview.
- Try the shadow DOM and iframe scenarios and explain why XPath cannot reach inside shadow roots.