Common WebDriver operations controlled by Python scripts & lt; 20 & gt; process form elements

Source: Internet
Author: User

 

The operations on form objects are relatively simple. You only need to remember the following points:

  • Use the send_keys method to assign values to the multi-row text box and single-row text box;
  • Use the click method to select checkbox
  • Use the click method to select radio
  • Click button using the click Method
  • Select option using the click method to select a specific menu item in the select drop-down box.

 

HTML code for testing:

                                     form                                                                            form                                                                                                            Legend                                                                                                                                                                                                                                             0                                    1                                    2                                                                                                                                                         

 

 

Python code for testing:

 selenium  time    os.environ:  os.environ[==  + os.path.abspath(dr.find_element_by_css_selector(5dr.find_element_by_css_selector(5dr.find_element_by_class_name().find_elements_by_tag_name()[-25dr.find_element_by_css_selector(5

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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.