Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Protocol error (DOMDebugger.getEventListeners): Invalid parameters Failed to deserialize params.objectId #12434

Closed
1 of 2 tasks
firdous-qasolve opened this issue May 13, 2024 · 2 comments

Comments

@firdous-qasolve
Copy link

firdous-qasolve commented May 13, 2024

Minimal, reproducible example

async function getEventListeners(selector, page){
  try{
      if(!client){
        client = await page.target().createCDPSession();
      }
      const {result} = await client.send('Runtime.evaluate', {expression:`document.querySelector("${selector}")`, objectGroup:'handler'});
      const {listeners} = await client.send('DOMDebugger.getEventListeners', {objectId:result.objectId});
      await client.send('Runtime.releaseObjectGroup', {objectGroup:'handler'});
      return listeners.map(listener => listener.type);
  }catch(err){
      logger.error("Error occurred in getEventListeners "+ err);
      return [];
  }
}

Error string

Protocol error (DOMDebugger.getEventListeners): Invalid parameters Failed to deserialize params.objectId - BINDINGS: mandatory field missing at position 8

Bug behavior

  • Flaky
  • PDF

Background

I am trying to call this function on multiple elements in a document. And it starts throwing error sometimes.

Expectation

Please help me with this error, how can we fix it.?

Reality

It works most of the time, but only fails on few web pages.

Puppeteer configuration file (if used)

No response

Puppeteer version

19.7.0

Node version

16.20.1

Package manager

npm

Package manager version

8.11.0

Operating system

Windows

Copy link

This issue has an unsupported Node.js version: 16.20.1. Only versions satisfying >=18 are supported. Please verify the issue on a supported version of Node.js and update the form.


Analyzer run

@OrKoN
Copy link
Collaborator

OrKoN commented May 13, 2024

This is not an issue with Puppeteer since you call CDP directly. The error indicates that objectId is undefined.

@OrKoN OrKoN closed this as not planned Won't fix, can't repro, duplicate, stale May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants