Skip to content Skip to sidebar Skip to footer

How To Specify Xpath That Return Whole Table Without Last Row?

Here is the code of a table. I need to extract whole table without last row. Whole table:
th in your xpath. And you want to filter out the last tr within the same table instead of filtering out the last td within the same tr :

//table[@class="product-content__table"]//tr[position() < last()]/td

remove trailing /td if you want to get list of <tr> instead of <td>.


Solution 3:

This works:

//table//tr[position()<last()]

Post a Comment for "How To Specify Xpath That Return Whole Table Without Last Row?"