【发布时间】:2021-07-08 12:09:23
【问题描述】:
是否有可能使用 WebdriverIO 运行 .bat 文件(脚本),最好放在位于 WDIO.conf 文件中的 before hook 中?
before: function () {
console.log("this is before");
},
【问题讨论】:
标签: webdriver-io
是否有可能使用 WebdriverIO 运行 .bat 文件(脚本),最好放在位于 WDIO.conf 文件中的 before hook 中?
before: function () {
console.log("this is before");
},
【问题讨论】:
标签: webdriver-io
是的,您可能只需要导入 execFileSync 和 join 方法,然后您就可以像这样运行它:
const { execFileSync } = require('child_process');
const { join } = require('path');
before: function () {
execFileSync(join(__dirname, './script.bat'));
}
阅读更多关于execFileSync方法here
【讨论】: