我想选择具有类名是从下方如何从网络访问表中的特定行
代码给网站上的表“topicRow后”的特定行
<table class="content" width="100%">
<tbody>
<tr class="topicTitle">
<tr class="topicSubTitle">
<tr class="topicRow post">
<tr class="topicRow_Alt post_alt">
<tr class="topicRow post">
<tr class="topicRow_Alt post_alt">
<tr id="forum_ctl03_ctl00" class="header2">
<tr class="post">
<tr>
</tbody>
</table>
硒码
WebElement Webtable=driver.findElement(By.xpath("//*[@class='content']"));
List<WebElement> TotalRowCount=Webtable.findElements(By.xpath("//*[@class='content']/tbody/tr[contains(@class,'topicRow post')]"));
System.out.println("No. of Rows in the WebTable: "+TotalRowCount.size());
问题
每次打印表中所有行的大小。请指导...
在开发人员工具中测试'xpath',您会得到多少结果? – Guy
@Guy在开发人员工具中,2行突出显示出现在表格中,我也希望选择相同的行。 –