From: Jim X. <jx...@cl...> - 2014-01-23 14:44:41
|
I want to detect all event handlers on some elements using the following code: com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement script = (com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement)(htmlElement).getScriptObject(); ComputedCSSStyleDeclaration style = script.getCurrentStyle(); Function eventHandler = script.getEventHandler("onclick"); System.out.println(eventHandler); Object onclick2 = script.getOnclick(); System.out.println(onclick2); -------------------------------------------------- HtmlElement - htmleElement has a click event handler that is created by a javascript in the end of document </body>. The above code can not detect this click event handler. Thanks in advance. Jim |