Search code examples
javahtmlunit

How i can find a elements with tag table in a html page


I have the html page, and me need find some elements with tag a 'table', but such tables maybe more than one, and they don't have id or class name. Example:

<table>
<tbody>
<tr>
.....

<table>
<tbody>
<tr>
.....

<table>
<tbody> 
<tr>    <-------BINGO! 
.....

How i can it's do with help HtmlUnit? Thanks...


Solution

  • Use HtmlPage.getElementsByTagName("table") and iterate over the returned list of HtmlTable objects until you find the table you want to find.