WebDriver 怎么处理window文件上传呢?

上一篇 / 下一篇  2012-05-14 14:38:46

 没用过,收藏一下, 以后用
String path = getFile("111.JPG").getAbsolutePath();
driver.getElement(By.id("adProductSpecification_0_upload")).sendKeys(path);

// get the data file
 public File getFile(String file) {
 URL url = getClass().getClassLoader().getResource(file);
Assert.assertNotNull(url);
return new File(url.getFile());
}
 
http://seleniumcn.cn/read.php?tid=2683

TAG:

 

评分:0

我来说两句

日历

« 2024-05-04  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 74400
  • 日志数: 80
  • 建立时间: 2012-04-12
  • 更新时间: 2013-05-21

RSS订阅

Open Toolbar