Test Automation / Quiz

XPath Battle

Axes, predicates, functions, and the one thing CSS can't do. Prove you can navigate any DOM with surgical XPath. Timed.

Difficulty
Hard
Format
Quiz
Points
200
Estimate
8 min

// MISSION BRIEF

XPath Battle ⚔️

CSS is your daily driver, but some targets only XPath can reach, traversing upward, matching on text, walking sibling axes. This battle tests real XPath fluency, not memorized snippets.

Rules of engagement:

  • Every question has exactly one best answer.
  • Watch for the classic traps: text() vs ., // re-scanning from root, attribute vs state.
  • Timer is live.

Best score counts.

// FIRST CONTACT

Battle teaser

You have a cell `<td>INV-042</td>`. You need the ROW (`<tr>`) that contains it. Which XPath does what CSS cannot?

  1. A//td[text()='INV-042']/ancestor::tr
  2. B//td[text()='INV-042'] > tr
  3. C//tr/td[text()='INV-042']
  4. D//td[text()='INV-042']/parent::table
Answers, scoring, hints, and the full battle stay sealed.

// SKILL TAGS

xpathlocatorsautomationbattle