gpt4 book ai didi

Watir:如何访问没有 ID 或 NAME 的表

转载 作者:行者123 更新时间:2023-12-04 22:08:31 25 4
gpt4 key购买 nike

我正在尝试编写我的 watir 脚本来获取以下数据(表正文标题和表行数据,但我在试图弄清楚如何访问表时遇到了麻烦。(一旦我得到了,其余部分蛋糕)。

任何人都可以想出一些可以帮助我访问 table 的东西吗?它没有名字或身份证...

<div id="income">
<table class="tHe" cellspacing="0">
<thead>
<tr>
<th id="companyLabel" class="tFirst" style="width:30%"> Quarter Ending </th>
<th id="201004" class="tFirst right">Apr&nbsp;10 </th>
<th id="201001" class="tFirst right">Jan&nbsp;10 </th>
<th id="200910" class="tFirst right">Oct&nbsp;09 </th>
<th id="200907" class="tFirst right">Jul&nbsp;09 </th>
<th id="200904" class="tFirst right">Apr&nbsp;09 </th>
</tr>
</thead>

<tbody id="revenueBody">
<tr>
<td class="indtr">Totals</dfn></td>
<td class="right">2849.00</td>
<td class="right">3177.00</td>
<td class="right">5950.00</td>
<td class="right">4451.00</td>
<td class="right">3351.00</td>
</tr>
...

最佳答案

如果没有其他具有相同类名的表,ie.table(:class=>'tHe') 应该可以工作

ie.table(:after?, ie.div(:id, 'income')) 如果没有其他带有 id 'income' 的 div 应该可以工作

或 ie.table(:index=>0) - 你需要检查你的页面,看看你的表的正确索引值是什么。

关于Watir:如何访问没有 ID 或 NAME 的表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3434672/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com