0

I have an application which needs to run with the following command: be-engine.exe -u producer -c D:\Workspace\V114_new\KinesisChannel\kinesis.cdd D:\Workspace\V114_new\KinesisChannel.ear -n logs002

Here i need to navigate to the bin director of the installed application and the run the be-engine.exe passing other file paths as well in the command on windows.

I want to automate this using protractor so that on start the above commands run automatically and engine gets started. Is there a way to do this in protractor using javascript.

ashish chauhan
  • 353
  • 1
  • 3
  • 14
  • take a look at `grunt task runner` – Sergey Pleshakov Sep 11 '19 at 12:55
  • You can do this using bat file, mention all of your commands in the .bat file and execute it. This will invoke the other commands as well. I would not recommend to use the protractor for this task. – Zohair Sep 11 '19 at 13:49

1 Answers1

0

NodeJS has exec method for this:

const { exec } = require('child_process');
exec('be-engine.exe -u producer -c D:\Workspace\V114_new\KinesisChannel\kinesis.cdd D:\Workspace\V114_new\KinesisChannel.ear -n logs002', (error, stdout, stderr) => {
  if (error) {
    console.error(`exec error: ${error}`);
    return;
  }
  console.log(`stdout: ${stdout}`);
  console.error(`stderr: ${stderr}`);
});

https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback

Check also this answer: Execute a command line binary with Node.js

Xotabu4
  • 3,063
  • 17
  • 29