Interactive XPath Practice

130 challenges from Easy to Hard. Inspect a live DOM snippet, write an XPath, and watch it validate and highlight in real time — every answer comes with an explanation and the concept you practiced.

Progress0 / 130 solved
0%
Accuracy
🥇🎯🚀🧠👑
130 questions
EasyBasic attributesQuestion 1 of 130

Select by ID

🎯 Select the Username input field using its id attribute.

🖥️ Rendered pagematches highlight as you type
live preview
</> HTML sourceinspect the DOM to plan your locator
<form class="login">
  <label for="username">Username</label>
  <input type="text" id="username" name="user" placeholder="Username">
  <label for="password">Password</label>
  <input type="password" id="password" name="pass" placeholder="Password">
  <button type="submit" class="btn primary">Sign in</button>
</form>

Write your XPath

⌨️Type an XPath to preview live matches.

Stuck? Get progressive help

  • By id (most stable): //input[@id='username']. Prefer id when it is present and static.
  • By name: //input[@name='user'] — a good fallback when there is no id.
  • By type: //input[@type='text'] — acceptable only while it uniquely identifies the field.