我使用以下代码上传:
var path = require('path');
var fileToUpload = 'Desktop:/mdkg.jpg';
var absolutePath = path.resolve(fileToUpload);
var button = element(by.css('[ngf-select]'));
button.click();
var input = element(by.css('input[type="file"]'));
input.sendKeys(absolutePath);
element(by.buttonText('Post Image')).click();
我有多个上传图片的步骤:
HTML code:
<div ngf-drop ng-model="files" ngf-pattern="image/*" data-ngf-multiple="true" ng-repeat="image in images1" ngf-size> <img src="{{image}}" width = "100%" height = "100%" class="m-l img-responsive img-rounded m-b" alt="post images"> </img-crop> <span ng-show="loading" class="text-center col-xs-12" ></span> </div> </div> <div class="modal-actions "> <button type="submit " class="btn-link modal-action "> <strong><span class="icon icon-user "></span>postImg</strong> </button> <button type="button" id="fileinput" ng-model="files" ngf-select accept="image/* " data-ngf-multiple="true" class="btn-link
模态动作&#34;&gt; 上传图片