cool hit counter selenium automation using excel files for bulk value passing_Intefrankly

selenium automation using excel files for bulk value passing


selenium automation testing, often use data to do batch testing, the common way to read txt files, xml files, Csv files and excel files several, this article to explain how to use the excel file in selenium to achieve the bulk transfer value, python read excel mainly used xlrd library, this library can be manually downloaded in pycharm such libraries.

The case of this demonstration: open the Baidu page, read the keywords in the excel file, enter them into the Baidu search box, and click the Baidu button.

The following is a screenshot of the script code that implements the requirement.

The effect after executing the script is as follows.

The code explains.

1、First introduce webdriver, time,xlrd three packages.

2, the definition of excel file path, the excel data stored in the data variable, select the first workbook, print the table with the number of lines of data, open Google Chrome, maximize the window, open Baidu, loop to read each line of the first column of the cell table content data, export input to the Baidu search box, and click the Baidu button, pause for 5 seconds, clear the text in the Baidu search box, continue to perform the previous operation, until the data in the table is read, exit webdriver and close Google Chrome.


Recommended>>
1、Great list of low risk business ventures for 2018 I love to exchange barter platform has become a big dark horse
2、The paradox of big data
3、Array formula deduplication
4、From human freezing to artificial wombs these five scifi settings became reality in 2017
5、MySQL Manual Injection Basic Injection Process

    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号