Form parameterization (CSV)

Source: Internet
Author: User

Form parameterization (CSV)
If I have an automated script to parameterize a form, the form needs to fill in the user name, mailbox, age, gender and other information, using the above method is difficult to solve the problem, the following method to read the CSV file to solve the problem.
Create a userinfo.csv file, 5.x
Figure 4.8
Create a table via WPS or Excel, save the file as select CSV format, modify the loop_reader.py file below to cycle read
Take:
#coding =utf-8
Import CSV #导入csv Package
#读取本地CSV file
My_file= ' D:\\selenium_python\\data\\userinfo.csv '
Data=csv.reader (File (my_file, ' RB '))
#循环输出每一行信息
For user in data:
Print User[0]
Print User[1]
Print User[2]
Print User[3]


Operation Result:
>>> ========================= RESTART ==============================
>>>
Testing
[Email protected]
23
Man
Testing2
[Email protected]
18
Woman
Testing3
[Email protected]
29
Woman
Csv.reader () is used to read the CSV file, User[0] represents the data (user name) of the first column in the table, User[0] represents the data (mailbox) of the second column in the table, and so on. It is more flexible to read files through CSV, which can iterate through each piece of data without limiting the number of data read each time.

Form parameterization (CSV)

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.