简体   繁体   English

我如何在HTML页面中使用标签表查找元素

[英]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. 我有html页面,我需要找到一些带有“表”标签的元素,但是此类表可能不止一个,并且它们没有id或类名。 Example: 例:

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

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

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

How i can it's do with help HtmlUnit? 我该如何使用HtmlUnit帮助? Thanks... 谢谢...

使用HtmlPage.getElementsByTagName("table")并遍历返回的HtmlTable对象列表,直到找到要查找的表为止。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM