Program Description: Grab the live room number of the Betta live platform and the number of spectators, and finally count the total number of people and the total number of spectators at a given moment.Process Analysis:First, enter the fighting fish home http://www.douyu.com/directory/allEnter the platform homepage, to the bottom of the page to click on the next page, found that the URL address has not changed, so that the use of URLLIB2 send requests will not get full
Python + Selenium notes (12): data-driven testing, pythonselenium
(1)Preface
Data-driven tests are used to parameterize input values and expected results. (For example, you can directly read the data in the Excel document by entering data and expected results)
(2)Ddt
Using d
First, to configure the environment selenium+testng and POI package, selenium+testng environment is not elaborate, here is the sharing of POI package Https://pan.baidu.com/s/1BJEIWR57_4vwrCDy6WuBWAAfter downloading, add the Lib file to the project and put the desired POI package into it, and import its Java build path into the project.Second, create a new Excel data
Crawl Activity Tree Site meeting activity data (http://www.huodongshu.com/html/index.html)The specific idea is [Python crawler] in the Xi. crawl activity line site similar, are used multi-threaded to crawl, but because of the active tree site, each keyword search page ur is fixed, such as the search "number" results have 470 results, no page 10 records, the second page of the URL and the first page of the The URL is the same.Therefore, a single thread
on the IFRAME name//Here we use the name switchItargetlocator Tagetlocator =driver. SwitchTo (); //tagetlocator.frame (1); //Frame index.Tagetlocator.frame ("Login_frame");//frame frame name. varUserName = driver. Findelementbyxpath ("//*[@id = ' u ')"); //the username here is the text box for the user name.//set the value of the user nameUsername.sendkeys ("123456"); varPWD = driver. Findelementbyxpath ("//*[@id = ' P ']"); Pwd. SendKeys ("********"); varBtnlogin
1. Introduce the JAVA+SELENIUM+POM Automatic test framework, the first to realize the separation of code and account URL and other information. The 2nd supports cross-browser implementation by reading the configuration file.1) Add information such as account URL to the properties file and read2) write the browser class by fetching the configuration file to achieve browser switching3) Test Browser classProject structure:1. Create a new folder place the
input box, the data is passed into Send_keys (Hzy). This is called by loop until all the contents of the file are read.Second, login parameterizationNow according to the above ideas, the Automation script user, the name of the password parameterized, through the Python document we found that Python read the file: The entire file read, read-line, fixed byte read.Did not find a good way to read two data at a
Background: In the testing process, in order to achieve the implementation of the different test data batch cycle input, consider the need to read the CSV file by the way of parameterization of the steps to further parameterization, the sample code is as follows:Import CSV...Data_set = R ' C:\\test.csv 'data = Csv.reader (file (Data_set, ' RB '))def test_insert (self):...# A total of four fields for each
://attachments.tower.im/tower/ B1bcc47d835c45d892d2ce25d14e6eaf?version=autofilename=clipboard%20image.png "width=" 338 "height=" 354 "style= "Margin:.2em 0px;padding:0px;border:1px solid RGB (217,217,217); font-size:15px;vertical-align:middle;width:auto; Height:auto;color:rgb (51,51,51); font-family:arial, Sans-serif;white-space:normal;background-color:rgb ( 255,255,255); "/>This article comes from "No idea, no achievement!" "Blog, be sure to keep this provenance http://kemixing.blog.51cto.com/
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.