Why locate a group of objects?
How do we implement the idea of locating a group of objects in the process of locating a group of objects? The previous is through the specific object positioning, then the positioning of a group we need to use CSS to locate in a single anchored object using find_element_by_id () but to locate a set of objects need to use find_elements_by_css_selector eg: #定位所有的checkbox对象checkboxs = Dr.find_elements_by_css_selector (' input[type=checkbox] ') for checkbox in Checkboxs:check box. Click () If you need to locate all the types in a page equal to some time? Inputs = dr.find_elements_by_tag_name (' input ') for input in inputs:if input.get_attribute (' type ') = = ' checkbox ': Input.click () Of course, you can also locate a group of select = find_element_by_id (' uid ') by locating a parent node first, and then through the parent node. Find_elements_by_tag_name ("option") For I in Select:i.click ()
Selenium python to locate a group of objects