在网站上抓取值,但结果显示我需要的值与其他人共享相同的类名。
HTML代码
1 ]=> (with-stack-sampling 10 maxall)
;Stack-sampling...
;The procedure #[compiled-procedure 3 ("foo" #x4) #x3 #x1b9ee4] has been called with 0 arguments; it requires exactly 1 argument.
;To continue, ...
我需要第二行(0.8948)和第三行的值 - 日期值(2016年12月19日),但我使用的代码只显示第一个值(1)。
<tr class="table_bdrow1_style">
<td></td>
<td style="text-align:center" class="table_bdtext_style">1.</td>
<td style="text-align:center" class="table_bdtext_style">
<div id="a">
"0.8948"
</div>
</td>
<td style="text-align:center" class="table_bdtext_style">December 19, 2016</td>
</tr>
不确定如何提取第二个和第三个值,而不是第一个值。有人可以帮忙吗?非常感谢!
答案 0 :(得分:0)
只需在提取调用中指定相应的索引:
' for second tag
IE.Document.getElementsByClassName("table_bdtext_style")(2).innerText
' for third tag
IE.Document.getElementsByClassName("table_bdtext_style")(3).innerText