[python-win32] Please help! How to get the event handler with IE Dom interfaces?
Tim Roberts
timr at probo.com
Thu May 27 19:18:32 CEST 2010
Xin Zhao wrote:
>
> I am using pywin32 code get all event handlers defined in a HTML page
> in IE. I used pythoncom to start IE, then get document, and finally
> reached IHTMLElement object. If the html page defines "onclick=xxx",
> element.onclick returns the click handler. However, if an event
> handler is defined in javascript, element.onclick simply returns NULL.
> What's the right way to get the event handler then?
>
> Note: I don't have to know detail about the event handler. It's good
> enough to know that an event handler is associated with an element.
The code below adds the "click" event on the fly, in a callback event
that happens after the page has loaded. It's quite possible that you
are querying the document before the "ready" callback has completed.
You might try delaying for a bit before you check for the handler.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the python-win32
mailing list