Skip to content

Webdriverio using async/await – What is recommended? [closed]

I am running my functional tests using WebdriverIO. I can get the WebdriverIO tests to pass even without async/await. But I read some articles that async/await is the best way of coding javascript to handle promises.

I am new to Javascript and pretty lost on promises. What is the best way to code in WebdriverIO (using async/await, or not | e.g: turn sync off in config and use this?)

The wdio.conf.js config file states the following:

// By default WebdriverIO commands are executed in a synchronous way using
// the wdio-sync package. If you still want to run your tests in an async 
// e.g. using promises you can set the sync option to false.
sync: true



WebdriverIO still uses async/await in the background, it just handles it for you. I’d definitely recommend using ‘sync’ mode, as it reduces the verbosity of your tests.

User contributions licensed under: CC BY-SA
3 People found this is helpful