如何点击给定的链接?

时间:2011-12-09 21:12:38

标签: python selenium click

<td class="button" nowrap align="center">  
    <a href="#" onKeyPress="javascript:checkkey(event);" onMouseDown="javascript:funclogin();">  
        Login  
    </a>  
</td> 

如何在python中使用selenium单击此按钮?

1 个答案:

答案 0 :(得分:0)

使用标签的类怎么样?

driver.find_elements_by_xpath("//td[@class='button']/a").click()

无论如何,您可能希望在代码中添加更好的标识符,以使其更加健壮。