stack twitter tryhackme rss linkedin cross

Wilco van Esch

Skip to main content

Search results

    Working with WebdriverIO | Issues you might encounter

    Examples of issues you might encounter:

    This version of ChromeDriver only supports Chrome version X

    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:

    1. Check the Chrome version on your machine
    2. Open your package.json
    3. Under devDependencies, change the chromedriver version specified to your Chrome version (Example: if my PC has Chrome 83.0.4103.97, my package.json needs “chromedriver”: “^83.0.0”)
    4. Execute npm i chromedriver
    5. Now run your tests again

    Cannot use import statement outside a module

    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:

    1. Ensure you have the Babel Node packages installed (@babel/cli, @babel/core, @babel/preset-env, @babel/register).
    2. Ensure you’re requiring Babel in your wdio.conf.js. In your cucumberOpts (or the options for whatever framework you’re using): requireModule: [ ‘@babel/register’ ],
    3. 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

    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

    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('/').