1

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.

enter image description here

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'); } },

1 Answer 1

0

OK, it turns out that the special needs child, that is node.js+webdriverIO, can deal with AutoIT scripts.

Use this code, that I copied from here, to run .exe files.

var fun = function() {
  console.log("rrrr");
  exec('CALL hai.exe', function(err, data) {

console.log(err)
console.log(data.toString());
  });
}
fun();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.