vlatko606
vlatko606

Reputation: 1149

WebdriverIO - How to run .bat script using WebDriverIO

Is there a possibility to run .bat file (script) using WebdriverIO, preferable into before hook, located into WDIO.conf file?

before: function () {
        console.log("this is before");
    },

Upvotes: 0

Views: 592

Answers (1)

Yevhen Laichenkov
Yevhen Laichenkov

Reputation: 8682

Yeah, it's possible you just need to import execFileSync and join methods and then you can run it like that:

const { execFileSync } = require('child_process');
const { join } = require('path');

before: function () {
   execFileSync(join(__dirname, './script.bat'));
}

Read more about execFileSync method here

Upvotes: 1

Related Questions