New answers tagged

0

You want to export a class: module.exports = { SearchPage }; , not an object of that class: module.exports = new SearchPage(); If you export a class, you can instantiate new objects as required however if you just export an created object, then you cannot create more objects out of it, if required.


2

Have you tried to run it? constructor(page) { this.page = page; } and later: module.exports = new SearchPage(); What about that missing page? this.page in the object will be undefined, so none of the methods will actually work and you will get some sort of exception at runtime. A solution could be to send page to every method: async search(page, text) {...


Top 50 recent answers are included