0

I've got a Puppeteer project where I'm trying to record and analyze the structure of some online forms. I expect to see a list of each form input's name attribute values printed to the console. But instead, I get the following error.

(node:4014) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 Symbol(Events.FrameManager.FrameDetached) listeners added to [FrameManager]. Use emitter.setMaxListeners() to increase limit

How can I locate the source of the memory leak or otherwise comply with the error warning message?

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  domains.forEach( domain => {
    const exts = [ null, ...contactExtensions, ];
    exts.forEach( async ext => {
      const a = [ domain, ext, ];
      const url = ext ? a.join(joiner) : domain;
      await page.goto(url);
      const pageFunction = $posts => {
        const data = [];
        $posts.forEach( $post => {
          data.push($post.name);
        });
        return data;
      };
      const data = await page.$$eval( 'form input', pageFunction, );
      console.log('data', data,);
    });
  });
  await browser.close();
})();
Let Me Tink About It
  • 15,156
  • 21
  • 98
  • 207

0 Answers0