如何在量角器中使用 javascript 运行 命令
How to run a command using javascript in protractor
我有一个应用程序需要 运行 使用以下命令:
be-engine.exe -u producer -c D:\Workspace\V114_new\KinesisChannel\kinesis.cdd D:\Workspace\V114_new\KinesisChannel.ear -n logs002
这里我需要导航到已安装应用程序的 bin 目录和 运行 be-engine.exe 以及在 windows 上的命令中传递其他文件路径。
我想使用量角器自动执行此操作,以便在启动上述命令时自动 运行 并启动引擎。
有没有办法在量角器中使用 javascript.
NodeJS 有 exec 方法:
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
同时检查这个答案:Execute a command line binary with Node.js
我有一个应用程序需要 运行 使用以下命令: be-engine.exe -u producer -c D:\Workspace\V114_new\KinesisChannel\kinesis.cdd D:\Workspace\V114_new\KinesisChannel.ear -n logs002
这里我需要导航到已安装应用程序的 bin 目录和 运行 be-engine.exe 以及在 windows 上的命令中传递其他文件路径。
我想使用量角器自动执行此操作,以便在启动上述命令时自动 运行 并启动引擎。 有没有办法在量角器中使用 javascript.
NodeJS 有 exec 方法:
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
同时检查这个答案:Execute a command line binary with Node.js