How to upload a file in wdio?
The element that allows you to select a file to upload (the normal way) is just an 'Upload File' clickable link.
Source:
<a href="javascript:void(0)" id="fileupload1" name="DocumentCreatedFileId"
ng-hide="Model.Uploading" pl-upload="" pl-progress-model="Model.Percent"
pl-auto-upload="true" ng-disabled="disabled" pl-files-model="Model.Files"
pl-filters-model="filter" on-file-added="Uploading(true)"
on-file-uploaded="Uploading(false)" class="ng-binding ng-isolate-scope"
pl-max-file-size="20mb" pl-url="/api/storage/upload"
pl-flash-swf-url="/content/moxie.swf"
pl-silverlight-xap-url="/content/moxie.xap">Upload File</a>
I've tried browser.chooseFile(documentsAddPage.uploadFile, 'X.png');
, but I get the webdriver.io's favourite error - selector needs to be typeof 'string'
The documentsAddPage.uploadFile
is { get: function () { return browser.element('#fileupload1'); } },