robotframework+selenium2library之上传本地文件
来源:互联网 发布:js下拉刷新原理 编辑:程序博客网 时间:2024/06/08 10:59
针对将本地的文件上传到测试系统,selenium2library提供了一个关键词
choose file
官方给定的解释如下:
Source:
Selenium2Library <test library>
Arguments:
[ locator | file_path ]
Inputs the `file_path` into file input field found by `identifier`.
This keyword is most often used to input files into upload forms. The file specified with `file_path` must be available on the same host where the Selenium Server is running.
Example:
Choose File my_upload_field /home/user/files/trades.csv
一开始以为进入到上传页面,点击浏览,再使用choose file,结果发现,这个函数包含了 点击浏览--选中文件 那么点击浏览就是多余的操作了
在该页面,就只需要执行choose 就可以将图片选中,执行的具体命令为:
choose file xpath=//div[@class='pd6 dot fcb']/span/input C:\\Documents and Settings\\zhouxuan\\My Documents\\My Pictures\\bug5.png
其中xpath为选中浏览图标的路径,而 C:\\Documents and Settings\\zhouxuan\\My Documents\\My Pictures\\bug5.png(此处的\\为转义用,当只用\时会出现错误)则为需要上传的图片的路径。
该操作执行完毕后,则会显示为:
图片已经顺利加载进来了,后续的操作就很简单了。
ps:
一开始点击上传图片的按键的时候,一直失败,各种调试和转换路径,但是都失败,后来换到同事的环境下执行,一切OK,查看火狐的版本,我的是35.0版本,他的是22.0.后来我也火狐浏览器的版本降低到22.0.脚本运行正常了。想想之前有时候在火狐下运行会导致浏览器不响应,也可能和浏览器相关。今天应该解决了。
- robotframework+selenium2library之上传本地文件
- RobotFramework-Selenium2Library
- RobotFramework & Selenium2Library 安装指南
- RobotFramework+Selenium2Library环境安装
- RobotFramework+Selenium2Library环境安装
- RobotFramework+Selenium2Library环境安装
- robotframework + selenium2library 经验总
- Selenium2Library使用Remote功能(RobotFramework)
- 【转】RobotFramework+Selenium2Library环境安装
- robotframework+ride+Selenium2Library+AutoItLibrary配置
- robotframework-selenium2library-导入可选参数
- RobotFramework+Selenium2Library+Httpwatch测试前端性能
- robotframework + selenium2library 一点测试的经验
- RobotFramework+Selenium2library使用遇到的问题汇总
- robotframework+selenium2Library使用遇到的问题
- RobotFramework+Selenium2Library批处理自动安装说明
- Selenium2library关键字之富文本框和上传文件
- 00 RobotFrameWork + Selenium2Library 轻松玩转自动化开篇
- MAC快捷键
- GitHub上最火的74个Android开源项目(三)
- 工作中apache 的两个不同配置
- 程序员的心理疾病
- Jquery在指定DIV加载HTML
- robotframework+selenium2library之上传本地文件
- 关于oozie的一些参考网址
- 尽量不要使用#define,而是用const、enum、inline替换。
- ttt
- 在WIN32控制台程序中使用MFC头文件
- projecteuler No.64 Odd period square roots
- Wininet模拟登陆网站
- TOJ-3499. Network
- For循环显示邮件列表