您的位置:首页 > 编程语言 > Python开发

16.Selenium2 自动化测试实战-基于Python语言-上传文件

2017-04-01 15:09 519 查看
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()
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: