I have an html document that I need to grab all table
elements that are the 5th table deep in the DOM
, not to be confused with the 5th child table
. My problem is this 5 table
deep structure could be wrapped in any number of div
elements so I can't use an absolute path such as
/html/body/table/tbody/tr/td/table/tbody/tr/td/table/tbody/tr/td/table/tbody/tr/td/table
For example:
<body>
<table>
<table>
<table>
<table>
<!--Grab this one -->
<table>
</table>
</table>
</table>
</table>
</table>
</body>
Or This:
<body>
<div> <!--Could be wrapped more than just once though -->
<table>
<table>
<table>
<table>
<!--Grab this one -->
<table>
</table>
</table>
</table>
</table>
</table>
</div>
</body>