简体   繁体   中英

Check box using Selenium Python

I am currently learning to use Selenium with Python, and I am writing an autofill program.

I want to be able to check a box on the form to confirm I have read terms and conditions, but I cannot figure out the proper search to do so.

This is the HTML of the object to be clicked:

<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>

So far, I have tried: driver.find_element_by_class_name("iCheck-helper").click() where driver is my WebDriver object. This has been unsuccessful though.

How would I go about doing this?

我使用driver.find_element_by_xpath(".//*[contains(text(), 'I have read and agree to the')]").click()来查找文本并选择它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM