gpt4 book ai didi

xpath - xpath-如何查找信息

转载 作者:行者123 更新时间:2023-12-03 16:06:21 25 4
gpt4 key购买 nike

鉴于此HTML:

<tr class="even" id="district_22">
<td class="name">Virginia Beach City Public Schools</td>
<td class=""><a href="/admin/districts/22" class="member_link delete_link" data-confirm="Sure?" data-method="delete" rel="nofollow">Delete</a></td>
</tr>
<tr class="even" id="district_23">
<td class="name">Virginia City City Public Schools</td>
<td class=""><a href="/admin/districts/23" class="member_link delete_link" data-confirm="Sure?" data-method="delete" rel="nofollow">Delete</a></td>
</tr>
<tr class="even" id="district_24">
<td class="name">Virginia Town City Public Schools</td>
<td class=""><a href="/admin/districts/24" class="member_link delete_link" data-confirm="Sure?" data-method="delete" rel="nofollow">Delete</a></td>
</tr>


我正在尝试使用Selenium和xpath。
尝试选择属于“弗吉尼亚海滩市公立学校”的“删除”链接时遇到问题。
我是xpath的新手。

我在尝试:

xpath=(//td[text()='Beach')]/@class.contains('delete'))


但找不到元素。

注意:我无法使用ID,因为这些是重复测试,并且ID每次都会更改。

最佳答案

试试这个:

//td[contains(text(),'Beach')]/../td/a[contains(@class,'delete_link')]

关于xpath - xpath-如何查找信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13691156/

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