New answers tagged


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.


Have you tried to run it? constructor(page) { = page; } and later: module.exports = new SearchPage(); What about that missing 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