我想selenium webdriver点击这个链接,所以我可以继续我的项目。这是我的代码。没有错误,但没有点击链接。Selenium不会点击,无名称,ID或类
x = driver.find_element_by_xpath('/html/body/table[2]/tbody/tr[2]/td/span/
a[7]')
x.click()
下面是HTML
<tr>
<td width="100%">
<span style="white-space: nowrap">
<a href="#">
<img src="https://staffmate.com/imagessm/OEA_sm_lt.gif" border="0" width="125" height="36">
</a>
<a href="#">
<img src="https://staffmate.com/imagessm/OPOS_sm_lt.gif" border="0" width="125" height="36">
</a>
<a href="#">
<img src="https://staffmate.com/imagessm/OCTR_sm_lt.gif" border="0" width="125" height="36">
</a>
<a href="#">
<img src="https://staffmate.com/imagessm/OCL_sm_lt.gif" border="0" width="125" height="36">
</a>
<a href="#">
<img src="https://staffmate.com/imagessm/OVEN_sm_lt.gif" border="0" width="125" height="36">
</a>
<a href="#">
<img src="https://staffmate.com/imagessm/OEV_sm_dk.gif" border="0" width="125" height="36">
</a>
<a href="eprintreports.php?eSessID=199495633810875522501415473608154261624185901388039708769020171218111124">
<img src="https://staffmate.com/imagessm/PREP_sm_lt.gif" border="0" width="125" height="36">
</a>
</span>
</td>
</tr>
我想点击链接第七。我从Chrome的检测工具中直接复制了xpath。我知道一个绝对的xpath是不可靠的,但是当没有类名,id或者名字时我还有什么可用的?帮助将不胜感激。
可以共享URL? –
我已添加网址 – Cameron
该网址似乎仍然不是描述中,请添加它,这样我们可以帮助进一步 – Danny