'descendant' attribute is used to select the first element on a page always
<ul>
<li> Buy</li>
<li> Buy using Credit Card</li>
<li> Buy using Debit Card</li>
<li> Buy using Cash On Delivery </li>
</ul>
- Select the very first `li`
/descendant::li[contains(text(),'Buy')][1]
- Select the preceding Sibling of the a node
/descendant::li[contains(text(),'Buy')][2]/preceding-sibling::li
Selection <li> Buy</li>
/descendant::li[contains(text(),'Buy')][3]/following-sibling::li
Selection
<li> Buy using Cash On Delivery </li>
No comments:
Post a Comment