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()
相关文章推荐
- 17.Selenium2 自动化测试实战-基于Python语言-操作cookie
- 2.Selenium2 自动化测试实战-基于Python语言-类和方法
- 6.Selenium2 自动化测试实战-基于Python语言-126邮箱登陆、获得验证信息
- 9.Selenium2 自动化测试实战-基于Python语言-键盘事件
- 11.Selenium2 自动化测试实战-基于Python语言-隐式等待
- 14.Selenium2 自动化测试实战-基于Python语言-多窗口切换
- 4. Selenium2 自动化测试实战-基于Python语言-跨目录模块调用
- 1.Selenium2 自动化测试实战-基于Python语言-设置窗口大小、调用JS调整滚动条、截取图片
- 18.Selenium2 自动化测试实战-基于Python语言-验证码处理
- 13.Selenium2 自动化测试实战-基于Python语言-多表单切换
- 8.Selenium2 自动化测试实战-基于Python语言-WebElement接口2
- 19.Selenium2 自动化测试实战-基于Python语言-数组与字典
- 10.Selenium2 自动化测试实战-基于Python语言-显示等待
- 15.Selenium2 自动化测试实战-基于Python语言-警告框处理
- 20.Selenium2 自动化测试实战-基于Python语言-函数
- 12.Selenium2 自动化测试实战-基于Python语言-定位一组元素
- 3.Selenium2 自动化测试实战-基于Python语言-模块调用
- 7.Selenium2 自动化测试实战-基于Python语言-WebElement接口1
- 5.Selenium2 自动化测试实战-基于Python语言-控制浏览器后退、前进
- 基于Java web技术文件上传和下载功能开发实战练习视频(fileupload)