In Firefox it is possible to see events associated with each element in Inspect Element of developers tools.
I want to have a list of elements and events associated with it, programmatically. preferably using selenium+python.
I know that there is getEventListeners
function that can be used in developer tools of Chrome, but it is not accessible in Selenium.
I went through most of the solutions offered in this question, but found nothing to resolve my problem.
My ultimate goal is to iterate throw html elements of a given page and execute each element's events.
You can do this to a certain extent with python + selenium (chrome only):
body = driver.execute_cdp_cmd("Runtime.evaluate", {"expression": "document.body"})
listeners = driver.execute_cdp_cmd("DOMDebugger.getEventListeners", {"objectId": body["result"]["objectId"]})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With