使用Selenium python复选框

时间:2016-05-12 06:47:42

标签: python html css selenium

我目前正在学习使用Selenium和Python,我正在编写一个自动填充程序。

我希望能够检查表单上的方框以确认我已阅读条款和条件,但我无法找到正确的搜索方式。

这是要点击的对象的HTML:

<ins class="iCheck-helper" style="position: absolute; top: -20%; left: -20%; display: block; w…roll 0% 0% rgb(255, 255, 255); border: 0px none; opacity: 0;"></ins>

到目前为止,我尝试过:driver.find_element_by_class_name("iCheck-helper").click()其中driver是我的webdriver对象。但这并不成功。

我怎么会这样做呢?

1 个答案:

答案 0 :(得分:0)

我已经找到了自己的答案。我使用driver.find_element_by_xpath(".//*[contains(text(), 'I have read and agree to the')]").click()查找文本并选择它。