javascript - How to upload file using Protractor to the ng-file-upload element -
the html follows:
<input type="file" style="display: none" ng-file-select="" ng-file-change="upload($files)" ng-multiple="multiple" accept=".jpg,.png">
i need upload file element uses ng-file-upload uploading image file using protractor:
var uploadfile = element(by.css('input[type="file"]')); uploadfile.sendkeys('c:\\temp\\test.png'); uploadfile.evaluate("openmetadatadialog({file:imgfile})");
the above not working. not able understand how upload file! per understanding, sendkeys input element, upload function should called itself! however, not seem happening!
regards,
sakshi
it seems ng-file-upload doesn't react .sendkeys(...)
, file-change doesn't invoked. can use standard onchange
event invoke custom upload logic:
<input type="file" style="display: none" onchange="angular.element(this).scope().upload(this)" ng-file-select ng-multiple="multiple" accept=".jpg,.png">
this points input element has property files.
Comments
Post a Comment