python automated testing checkbox Select

click_checkbox DEF ( Self): 
'' '
checkbox select all
get all of the check boxes, be sure to use elements,
then traversal, click circulation
to prevent anti-election, is_selected checked to determine whether
the selected return True, otherwise False : return : ' '' self.driver.get ( r'E: \ test 2 \ data \ radio.html ') the CheckBox = self.driver.find_elements_by_xpath ( ' // the INPUT [@ of the type = "the CheckBox"] ') for i in the CheckBox: i.is_selected IF () == False: i.click () the else: Pass the time.sleep ( . 5) self.quit_page ()













Guess you like

Origin www.cnblogs.com/wangqianpeng/p/11237168.html