from selenium import webdriver
import time ,os
driver =webdriver.Chrome()
file_path='file:///'+os.path.abspath('./webdriver_api/web_page/upfile.html')
driver.get(file_path)
#定位上传按钮,添加本地文件
driver.find_element_by_name("file").send_keys("C:\\Users\Administrator\AppData\Local\Programs\Python\Python35-32\webdriver_api\web_pageupload_file.txt")
time.sleep(5)
driver.quit()
16.Selenium2 自动化测试实战-基于Python语言-上传文件
最新推荐文章于 2024-09-29 13:57:14 发布