Examples of issues you might encounter:
This version of ChromeDriver only supports Chrome version X

Cause: the version of the chromedriver
Node package has to match the Chrome version on your machine.
Solution:
- Check the Chrome version on your machine
- Open your
package.json
- Under
devDependencies
, change thechromedriver
version specified to your Chrome version (Example: if my PC has Chrome 83.0.4103.97, mypackage.json
needs“chromedriver”: “^83.0.0”
) - Execute
npm i chromedriver
- Now run your tests again
Cannot use import statement outside a module

Cause: With ES6 you can create modules and import them from elsewhere in your application, but you do have to configure Babel correctly.
Solution:
- Ensure you have the Babel Node packages installed (
@babel/cli
,@babel/core
,@babel/preset-env
,@babel/register
). - Ensure you’re requiring Babel in your
wdio.conf.js
. In yourcucumberOpts
(or the options for whatever framework you’re using):requireModule: [ ‘@babel/register’ ],
- Ensure you have a Babel config:
babel.config.js
Example contents for Node 12:
module.exports = {
presets: [
['@babel/preset-env', {
targets: {
node: 12
}
}]
]
}
Missing ) after argument list

Cause: not every test has been given a closing parenthesis and closing bracket.
Solution: go through the test script and ensure every opening parenthesis and bracket has a partner.
Text not found despite being present in the DOM

Cause: you’re checking the page title without visiting the page first.
Solution: even if you add a baseUrl
, it won’t go there unless you do browser.url('/')
.