本文介绍了如何使用量角器上传多个文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用webdriver.WebElement.sendKeys和Path上传单个文件.代码如下:
I am using webdriver.WebElement.sendKeys and Path to upload a single file. The code looks like this:
var path = require('path'), uploadInput = element(by.css("input[type=file]")), fileToUpload = "../test_image/download.jpeg", absolutePath = path.resolve(__dirname, fileToUpload); uploadInput.sendKeys(absolutePath);对于一个文件来说,这很好用.我需要测试多个文件上传.如何传递多个文件?
That works fine, for one file. I need to test multiple file uploads. How do I pass multiple files?
推荐答案硒仍然不支持多个文件上传:
Selenium still does not support multiple file uploads:
- Support <input type=file multiple>
但是,根据 webdriver:上传多个文件,您应该能够解决它在Chrome浏览器中 通过用换行符将文件路径连接起来:
But, according to webdriver:upload multiple files, you should be able to solve it in Chrome by joining file paths with a new-line character:
uploadInput.sendKeys(absolutePath1 + "\n" + absolutePath2);另请参阅:
- 文件上传-在FireFox中上传多个文件
更多推荐
如何使用量角器上传多个文件?
发布评论