【虫师】【selenium】参数化

 #
1
#coding=utf-8 2 from selenium import webdriver 3 import os,time 4 5 source = open("F:\\test\\info.txt","r") 6 values = source.readlines() 7 source.close() 8 9 #执行循环 10 for serch in values: 11 browser = webdriver.Chrome() 12 browser.get("http://www.baidu.com") 13 browser.find_element_by_id("kw").send_keys(serch) 14 print(serch) 15 browser.find_element_by_id("su").click() 16 browser.quit()

 

posted @ 2017-08-28 22:36  猪猪宝丫  阅读(289)  评论(0编辑  收藏  举报