Examples of issues you might encounter:
This version of ChromeDriver only supports Chrome version X
![This version of ChromeDriver only supports Chrome version X](/assets/img/this-version-of-chromedriver-only-supports-chrome-version-x.png)
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
![Cannot use import statement outside a module](/assets/img/cannot-use-import-statement-outside-a-module.png)
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
![Missing parenthesis after argument list](/assets/img/missing-parenthesis-after-argument-list.png)
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
![Page title is empty though the page has a title](/assets/img/page-title-empty-though-page-has-title.png)
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('/')
.