senlenium send.key批量输入

#coding=utf-8
from selenium import webdriver
import time
driver = webdriver.Safari()
driver.get(“http://192.168.1.17:8090/login”)
time.sleep(3)
driver.find_element_by_id(“amount”).send_keys(“输入你的账号”)
driver.find_element_by_id(“password”).send_keys(“输入你的密码”)
driver.find_element_by_xpath(“/html/body/section/div/div[2]/div/form/input”).click()
time.sleep(5)
a= 0
while a<=3:

connect = ["test1","hi",u"地方","dhf"]
for i in connect:

driver.find_element_by_xpath("/html/body/header/div/div[1]/ul/li[3]").click()
time.sleep(5)
driver.find_element_by_class_name("add-shop").click()
time.sleep(3)
driver.find_element_by_tag_name("input").send_keys(i)
driver.find_element_by_class_name("btn btn-primary").click()
a+=1
time.sleep(4)
driver.quit()

Leave a Reply

Your email address will not be published.