【发布时间】:2019-02-23 09:43:45
【问题描述】:
我有一个自动 python 脚本来检查 DOM 中的任何更改。我有一个有效的 xpath:
//td[@class='high-bg']/a[@class='link-action'][@data-hintbox='1'][@data-hintbox-static='1'][@role='button'][@href='javascript:void(0)']
但它给了我比我需要的更多的输出,其中一些会导致错误。所以我想从 xpath 中获取我需要的抽象项目,所以我尝试使用这样的东西:
//table[@id't5c711109b1eea263276674']/tbody[]/tr[]/td[@class='warning-bg']/a[@class='link-action'][@data-hintbox='1'][@data-hintbox-static='1'][@role='button'][@href='javascript:void(0)']
但它不起作用,那么甚至可以搜索带有那么多标签的xpath吗?
<table id="example">
<tbody>
<tr>
<td class="average-bg">
<a class="link-action" data-hintbox="1" data-hintbox-static="1" role="button" href="javascript:void(0)">1</a>
</td>
</tr>
</tbody>
</table>
【问题讨论】:
-
能否将html图片替换为文本格式的html
标签: python selenium xpath webdriver xpath-1.0