Selenium RC upload local file
2014-01-27 17:55
381 查看
Selenium RC use attachFile() to upload the local file.
作者: Max.Bai
时间: 2014/01
Selenium RC upload local file
1. Use attachFile()
set browser "*chrome ..." replace "*firefox..."
The upload file only can be save on C: driver(maybe system dir)
The fileLocator is URL
--for network path like "http://localhost/abc.txt"
--for local path like "File:///C:/tem/abc.txt", but need remove the c:/ string for AttchFile method.
Sample for c#:
the browser button locator is "//input[@id='inputFile']"
Note: only support firefox, Need check in IE
2. Use autoit
This solution can be found on web.
Selenium Webdriver upload file:
http://blog.csdn.net/max229max/article/details/36664121
作者: Max.Bai
时间: 2014/01
Selenium RC upload local file
1. Use attachFile()
set browser "*chrome ..." replace "*firefox..."
The upload file only can be save on C: driver(maybe system dir)
The fileLocator is URL
--for network path like "http://localhost/abc.txt"
--for local path like "File:///C:/tem/abc.txt", but need remove the c:/ string for AttchFile method.
Sample for c#:
the browser button locator is "//input[@id='inputFile']"
string sLocalFile = @"C:\uploadFolder\uploadfile.txt"; string sFileLocator = @"file:///uploadfolder/uploadfile.txt"; Selenium.AttachFile("//input[@id='inputFile']", sFileLocator); Selenium.Click("//input[@id='OkButton']");
/// <summary> /// Attach local file /// </summary> /// <param name="sFilePath">local file path, only accept C: driver</param> /// <returns></returns> public void UploadFile(string sFilePath) { Selenium.AttachFile(Page.Browse_Button.Selector, new Uri(sFilePath).ToString().ToUpper().Replace("C:/", "")); }
Note: only support firefox, Need check in IE
2. Use autoit
This solution can be found on web.
Selenium Webdriver upload file:
http://blog.csdn.net/max229max/article/details/36664121
相关文章推荐
- if语句的效率
- 我的2013年
- C#.MVC+JQuery1.9自定义下拉框控件
- HDU:2795 Billboard
- java动态代理的内部实现
- 【设计模式-代理模式】
- Understanding a Kernel Oops
- Google java 编程规范
- Linux网络基本配置
- Python 关于拷贝(copy)汇总(列表拷贝 // 字典拷贝 // 自定义对象拷贝)
- 系统之家GhostXPSP3装机2014版
- 右侧底部跟着浏览器滑动
- [LeetCode]Reverse Linked List II, 解题报告
- 九度OJ 1078 二叉树遍历
- 九度OJ 1078 二叉树遍历
- 如何正确的在java web配置数据池
- Android系统中setprop,getprop,watchprops命令的使用
- 转:瑞利信道,莱斯信道和高斯信道模型
- 状态模式
- 12306采用Pivotal GemFire分布式解决方案 解决尖峰高流量并发问题