0

I am trying to create an action for nightwatch that will upload files to a given upload form. Is it possible to create that kind of action in nightwatch? The nightwatch is integrated into a nodejs application and is running in a selenium webdriver.

Dranier
  • 251
  • 2
  • 24

2 Answers2

0

Use AutoIT to create an executable for the upload action. Execute the executable using the exec function of the Node. Upload.exe is the executable file compililed from the AutoIt script.

 exec('START "" .\\src\\Resources\\Upload.exe', function(err) {
        console.log('err: ' + err);})
PJAutomator
  • 326
  • 1
  • 12
  • Is AutoIt a plugin for nightwatch, I have my own framework so if it is a standalone framework I cannot use that – Dranier Jul 25 '18 at 02:44
  • Sorry for late reply, AutoIT is only for creating the executable which after creation can be used in any framework by simply executing the executable via script. – PJAutomator Aug 03 '18 at 17:15
0

This question is already asked here. The approved answer gives this solution:

.setValue('input#fileUpload', require('path').resolve(__dirname + '/testfile.txt'))

You can take a look here at the discussion that led to this fix.