Skip to content

Cannot pass variables to executeScript() #1463

@vitoo

Description

@vitoo

Hello,

With Codeceptjs v2.0.3
System : windows 10

When('i set value {string} in the field {string}',  (text, css) => {
    I.waitForVisible(css);  
    I.executeScript(function(text,css)  {
        document.querySelector(css).value = text;
    });
});

I got :
unknown error: Cannot set property 'value' of null
text & css variables are undefined inside the executeScript function
I got same error with gherkins or classic tests.

How can i achieve this ?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions