【虫师】【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()