xpathadv
Here is the **full HTML version with Hints included** for your XPath Axes Practice & Task Page. You can copy and paste this entire block into a WordPress Custom HTML block.
“`html
XPath Axes Practice Page – With Hints
Use this page to practice XPath axes concepts. Each section includes tasks with expandable hints to check your answers.
1️⃣ Basic Axes: child:: and descendant::
Hint
//div[@id='menu']/ul/child::li
Task: Select descendant li under “Courses”.
Hint
//li[text()='Courses']/descendant::li
2️⃣ parent:: and ancestor::
Hint
//input[@name='email']/parent::div
Task: Select ancestor div of label.
Hint
//label[text()='Email Address']/ancestor::div
3️⃣ Sibling Axes: following-sibling:: and preceding-sibling::
Password must be at least 8 characters.
Hint
//input[@name='password']/following-sibling::small
Task: Select label using preceding-sibling.
Hint
//input[@name='password']/preceding-sibling::label
4️⃣ following:: and preceding::
This is paragraph 1.
This is paragraph 2.
This is paragraph 3.
Hint
//p[text()='This is paragraph 1.']/following::p[2]
Task: Select paragraph 1 using preceding::.
Hint
//p[text()='This is paragraph 3.']/preceding::p[2]
5️⃣ self:: and descendant::
Course Information
Instructor: John Doe
Duration: 6 weeks
Hint
//h3/self::h3
Task: Select all descendant p elements in .card.
Hint
//div[@class='card']/descendant::p
6️⃣ Advanced Table Navigation
| Student Name | Course | Status | Action |
|---|---|---|---|
| Alice | Manual Testing | Completed | View |
| Bob | Automation Testing | In Progress | View |
| Charlie | Manual Testing | In Progress | View |
Hint
//td[text()='Alice']/following-sibling::td[2]/a
Task: Select “Manual Testing” from “In Progress”.
Hint
//td[text()='In Progress']/preceding-sibling::td[1]
Task: Select “In Progress” from “Bob”.
Hint
//td[text()='Bob']/following-sibling::td[2]
Bonus: Select “View” link for Charlie.
Hint
//td[text()='Charlie']/following-sibling::td[2]/a
“`
