I am using WebdriverIO to run a file-uploading .exe created with AutoIt.
I am running the script inside a browser.execute command. The file needs to run from the local drive and execute wd in Chrome browser.
Here is the code :
this.open("https://smallpdf.com/word-to-pdf");
this.SubmitClick("//div[@class='l0v3m7-3 hIetmU']");
this.BrowserSleep(2000);
scr.runAutoItScript('C:\\test\\desktopApp\\autoit', 'fileUpload.exe')
//scr have the child process:
const { execFile } = require('child_process').execFile;
module.exports = {
runAutoItScript(pathToScript, scriptName) {
console.info(`\n> Started execution of ${pathToScript} / ${scriptName} ...`);
execFile(`${pathToScript}/${scriptName}`, (error, stdout, stderr) => {
if (error) {
throw error;
} else {
console.info(`\n> Finished execution of ${scriptName}! | Output: ${stdout}`);
}
});
}
}