鉴于此 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。我在尝试选择属于“Virginia Beach City Public Schools”的“删除”链接时遇到问题。我是 xpath 的新手。
我在尝试:
xpath=(//td[text()='Beach')]/@class.contains('delete'))
但它没有找到元素。
注意:我不能使用 ID,因为这些是重复测试,并且 ID 每次都会更改。