如何使用量角器上传多个文件?

编程入门 行业动态 更新时间:2024-10-27 08:32:51
本文介绍了如何使用量角器上传多个文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用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中上传多个文件

更多推荐

如何使用量角器上传多个文件?

本文发布于:2023-11-23 03:38:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1619943.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:量角器   多个   如何使用   上传   文件

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!