0

I want to write some javascript code in nightwatch. I know that it need to call .execute() function but I want to separate into different file and calls from main file.

Please help me on this. Thanks.

1 Answer 1

0

You can do this.

test.js

module.exports = 'alert("Hello")'

main.js

const test = require('./test.js')
module.exports = {
    'Test' : function (browser) {
        browser
        .url('https://google.com')
        .execute(test)
    }
}

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.