Skip to main content
2 of 2
simplfied click of element

Suchit Parikh's Answer is close, but when selenium tries to click the second checkbox, it is likely that it will throw a StaleElementReferenceException

You can get by this by storing some unique information from the check boxes in another list, then iterate through that new list and finding the elements again.

Example:

   elements = self.driver.find_elements_by_xpath("//input[@name='arr[]']")
    
   element_list = []
   for elm in elements:
       element_list.append(elm.get_attribute('value'))
    
   for elem_value in element_list:
       self.driver.find_element_by_xpath("//input[@value='" + elem_value + "']").click()