我怎么能取消选中复选框?

时间:2015-08-03 07:39:45

标签: python-2.7 selenium

对于pincode,我试过这个:

checkbox = webdriver.find_elements_by_xpath('//*[@name="add_in_fld"].onclick()')
            if checkbox.isSelected():
                    checkbox.click()

Sample Link

1 个答案:

答案 0 :(得分:0)

from selenium import webdriver
driver = webdriver.Firefox()
driver.get("http://www.findlatitudeandlongitude.com/batch-geocode/#.VbsHL7OqpHz")
cb = driver.find_element_by_css_selector(".cb_short input")
assert cb.is_selected()
cb.click()
assert not cb.is_selected()