我正在使用 seleniumwebdriver.find_element_by_link_text('searchterm')
来获取 webElement。然后我可以href
通过使用'href'找到值,webElement.get_attribute('href')
我可以通过xpath定位元素本身:
.//*[@href=webElement.get_attribute('href')]
问题是这不是我要单击的链接,我要单击的链接具有文本“谷歌阅读器”,并且是三列:
<tr id="AB2Xq4gXoer9sCEEr-rRcZjVz1p021-gdypaX-U" class="ACTIVE">
<td class="checkbox">
<td class="alert-type" colspan="2">
<a href="RETRIEVABLE ATTRIBUTE">FOUND TEXT</a>
</td>
<td class="alert-volume">Only the best results</td>
<td class="alert-frequency">As-it-happens</td>
<td class="alert-delivery">
<a href="THE ELEMENT I WANT TO CLICK">Google Reader</a>
<a href="another link">
</td>
这里的问题是有一系列“google reader”链接,所以这个词不能用
有没有机会通过路径导航到我想要的元素/链接?
我一直在尝试去父母那里,然后去寻找合适的孩子,但我只是没有到达那里。
感谢任何时间和帮助!
真挚地