gpt4 book ai didi

java - 不使用 XPath 从 webtable 内的元素获取文本(Selenium Web 驱动程序 + Java)

转载 作者:行者123 更新时间:2023-12-01 08:16:11 25 4
gpt4 key购买 nike

<table class="shoppingCart" cellspacing="0" cellpadding="0" border="0" width="100%">
<thead>
<tfoot>
<tr>
<tr>
<tr>
<!-- show if promo discount applied -->
<!-- end discount -->
<tr>
<td/>
<td/>
<th scope="row" colspan="2">Order total</th>
<td class="total ajaxCart_total"> $284.96 </td>
</tr>
</tfoot>
<tbody>
</table>

有人可以帮我解决这个问题吗?我想在运行时捕获文本 $284.96。而且我不想使用绝对 Xpath(//table/tfoot/tr[4]/td[3]) 因为页面是动态的并且 Xpath 可能经常更改。我怎样才能做到这一点?

提前致谢,迈克

最佳答案

如果所需 td 中提到的类是唯一的,您可以像这样使用 xpath :

//td[@class='total ajaxCart_total']

关于java - 不使用 XPath 从 webtable 内的元素获取文本(Selenium Web 驱动程序 + Java),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13227309/

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