Selenium / Quiz

Locator Strategies: CSS vs XPath

Every flaky suite starts with a bad locator. Know exactly what CSS can and cannot do, when XPath earns its keep, and which locators are brittle by design.

Difficulty
Easy
Format
Quiz
Points
100
Estimate
10 min

// MISSION BRIEF

Your Mission

Your team inherits a suite where half the locators are absolute XPaths and the other half are auto-generated class names. Before you refactor a single line, prove you know the terrain.

Seven questions on locator strategy: capability differences, brittleness patterns, and the priority order that keeps suites alive. Speed bonus active.

// FIRST CONTACT

Battle teaser

Which statement about CSS selectors vs XPath in Selenium is TRUE?

  1. AXPath can traverse upward (parent/ancestor axes); CSS selectors cannot walk up the DOM
  2. BCSS selectors can reach into iframes without switching
  3. CCSS selectors can match elements by their visible text
  4. DXPath is always dramatically slower in every modern browser
Answers, scoring, hints, and the full battle stay sealed.

// SKILL TAGS

seleniumlocatorscssxpathweb