How to extract functions right?

Hi, I have a problem, my event listener looks like this:


And utils file:

When I run the tests I got Webdriver as ‘undefined’(TypeError: Cannot read property ‘browser’ of undefined), but if I move all my functions to even listener, everything is working.

I don’t want to have them in one file, but don’t see what I am missing, I believe it is something simple that I cannot see because of my lack of knowledge…

Hi @Erzgerzog,

you should write your functions to a custom helper class that extends the Helper from codeceptjs and then require this new class (*.js file) in the codeceptjs config -> helper section.

Because then you have access to all available Helpers (like Webdriver) by getting it from the (parent) Helper:

example customActions.js:

const Helper = codeceptjs.helper;

class CustomActions extends Helper {

  get webDriver() {
    return this.helpers.WebDriver;

   clickViaWebdriver(locator) {;

This must be required in the codecepjs.conf otherwise codecetpjs does not know anything about the new Helper:

helpers: {
CustomActions: {
      require: "../helpers/customActions.js"

Now you could access the functions via I.clickViaWebdriver(locator)
For detailed infos regarding custom helpers check the documentation: