-
Notifications
You must be signed in to change notification settings - Fork 9k
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
[Feature]: Support DOMDebugger.getEventListeners on ElementHandle #8798
Comments
I believe that the objectId is session-specific. Since you are using a new session, you need to get the element handle through that session or use the ElementHandle's session to call getEventListeners. |
thanks for your reply. so how to get the session without create a new one? or how to use the ElementHandle's session? I did not see the related API. |
@chenstrace this is no officially supported API, as re-using the internal Puppeteer session might break Puppeteer. What's your use case? do you only want to use getEventListeners and for what purpose? We could see if it'd make sense to create an API for the getEventListeners. Alternatively, you can use Runtime.evaluate in your custom session (expression would be |
@OrKoN thanks for your reply again. My use case is, get each element's event listeners, and then trigger the event, for example, click or drag. The steps I wanted may like below:
I know the approach you mentioned above can work well, but in my case, I did not know the selector of the element. I mean when I got a ElementHandle or JSHandle, there is no API to get its selector. |
In the meantime you can use |
OK, many thanks. |
Bug description
Steps to reproduce the problem:
Complete Code to reproduce the problem
Expect:
in step 3, response the returned normally
Actually:
there was a error.
Puppeteer version
puppeteer@16.1.0
Node.js version
v18.7.0
npm version
8.15.0
What operating system are you seeing the problem on?
macOS
Relevant log output
The text was updated successfully, but these errors were encountered: