coding:utf-8
引用webdriver
from selenium import webdriver
用来查找页面元素的类
from selenium.webdriver.common.by import By
模拟鼠标行为
from selenium.webdriver.common.action_chains import ActionChains
睡眠时间
import time
path = r’D:\webdriver\chromedriver.exe’
打开浏览器
wd = webdriver.Chrome(executable_path=path)
wd.get(‘http://192.168.1.251:9012/ui/test/ex17’)
time.sleep(3)
wd.find_element(By.XPATH, “/html//input[@id=‘file’]”).send_keys(r"D:\exmple.txt")
wd.find_element(By.ID, “test10”).click()
time.sleep(2)
wd.find_element(By.LINK_TEXT, ‘确定’).click()
time.sleep(10)
wd.quit()