Search code examples
javascriptprotractorautoit

How to run an exe file using java script at runtime


I am trying to automate some stuff using protractor. I have a situation where I need to deal with a Windows pop-up and I have an AutoIt script compiled (.exe) for this. I could import this at runtime in Java and selenium. I am not sure how to do that in Protractor and JavaScript case. Thanks.


Solution

  • If you want to open external files, then you should use the built-in child_process module.

    var { exec } = require("child_process");
    //the function acts like a shell, so just use shell commands.
    exec("cmd.exe");