const webdriverio = require('webdriverio'); const chromedriver = require('chromedriver'); // todo: stop works only with 9515 const port = 9515; const args = [ // '--url-base=/wd/hub', `--port=${port}`, ]; console.log('start chromedriver'); const service = chromedriver.start(args); console.log('after start') const options = { port, path: '/', desiredCapabilities: { browserName: 'chrome', chromeOptions: { args: ['--headless', '--disable-gpu'], } }, }; const client = webdriverio .remote(options) .init() .on('error', (e) => console.error(e)) .once('end', () => { process.nextTick(function () { chromedriver.stop(); }); }) .url('https://www.google.com') .getTitle().then(function (title) { console.log('Title was: ' + title); }).catch(console.log) .end();