Test Automation / Quiz
Selectors Under Fire
Test ids, semantic roles, text, and structural paths: ranking selector strategies by how gracefully they die when the UI changes.
- Difficulty
- Easy
- Format
- Quiz
- Points
- 100
- Estimate
- 9 min
// MISSION BRIEF
Your Mission
Every selector is a bet about what will not change. Structural paths bet on the DOM tree. Text bets on copywriting. Test ids bet on team discipline. Semantic roles bet on the app staying accessible.
This quiz ranks those bets, framework-agnostic: the same logic drives Playwright, Selenium, Cypress, and Appium suites.
Speed bonus active.
// FIRST CONTACT
Battle teaser
Which selector survives the most kinds of change?
- AThe button's current visible text, always
- BA dedicated test id (or a semantic role + accessible name), because both are explicit contracts rather than rendering accidents
- Cdiv.container > div:nth-child(3) > button.primary
- DAn auto-generated class like .css-1x8v2ab
Answers, scoring, hints, and the full battle stay sealed.
// SKILL TAGS
test-automationselectorslocatorsmaintainabilitye2e-testing