Selenium python to locate a group of objects

Source: Internet
Author: User
Tags selenium python

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.