使用量角器自动执行文件上载功能

时间:2015-09-14 04:43:43

标签: angularjs automation protractor

如何使用量角器自动化文件上传功能?

1 个答案:

答案 0 :(得分:0)

我相信你问的是如何将文件上传到你的应用程序,对吗?如果是这样,这段代码就可以了:



var path = require('path');
//the file to upload
var fileToUpload = 'C:\\your file path',
  //this is variable that inserts the path to find file to upload
  absolutePath = path.resolve(__dirname, fileToUpload);
//inserts the path
$('input[type="file"]').sendKeys(absolutePath);