executablePath missing: fatal puppeteer error

Latest CodeceptJS + puppeteer does not work I.amOnPage('/'); anymore.
I get a fatal exception below.

Do I need to add an executablePath in helpers.Puppeteer and what should its value be?
CodeceptJS documentation only shows an electron path example.

Error: An `executablePath` or `channel` must be specified for `puppeteer-core`
    I am on page "/"
TypeError: Cannot read properties of undefined (reading 'mainFrame')
  ✖ FAILED in 12ms


-- FAILURES:

  1) Homepage
       Test website content and navigation:
     Cannot read properties of undefined (reading 'goto')
      at Puppeteer.amOnPage (node_modules/codeceptjs/lib/helper/Puppeteer.js:681:21)
      at Step.run (node_modules/codeceptjs/lib/step.js:123:49)
      at /home/ingo/Code/ingo-steinke.de/node_modules/codeceptjs/lib/actor.js:138:23
  
  Scenario Steps:
  - I.amOnPage("/") at Test.<anonymous> (./codecept/homepage_test.js:9:5)

My configuration:

module.exports = {
  tests: './codecept/*_test.js',
  output: './codecept/output',
  helpers: {
    Puppeteer: {
      url: '',
      show: true,
      windowSize: '1200x900'
    },
    "ResembleHelper" : {
      "require": "codeceptjs-resemblehelper",
      "screenshotFolder" : "./codecept/output/",
      "baseFolder": "./codecept/screenshots/base/",
      "diffFolder": "./codecept/screenshots/diff/"
    }
  },
  include: {
    I: './codecept/steps_file.js'
  },
  bootstrap: null,
  mocha: {},
  name: 'ingo-steinke.de',
  plugins: {
    pauseOnFail: {},
    retryFailedStep: {
      enabled: true
    },
    tryTo: {
      enabled: true
    },
    screenshotOnFail: {
      enabled: true
    }
  }
}

My node packages:

"codeceptjs": "^3.6.0", ...
"playwright": "^1.43.1", ...
"codeceptjs-resemblehelper": "^1.9.6"

My system software:

  • node v20.12.2
  • npm --version 10.5.0
  • Ubuntu 22.04.4 LTS (jammy)
  • Linux 6.5.0

Any help is appreciated!

I also tried to install and configure "puppeteer-core": "^22.6.5", explicitly in my configuration:

  helpers: {
    Puppeteer: {
      url: '',
      show: true,
      windowSize: '1200x900',
      executablePath: require('puppeteer-core'),
    },

But the error is the same.

may you try this before running tests?

npm i puppeteer@$(npm view puppeteer version) && npx puppeteer browsers install chrome

1 Like

Thanks, now it works again!