all right is operation in firefox 3.5
but in HtmlUnit 2.5
final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_3);
final HtmlPage page = (HtmlPage) webClient
.getPage("http://127.0.0.1:8080/test3.jsp");
final HtmlAnchor anchor = page.getAnchorByName("crtimg");
anchor.click();
error:
2009-7-3 15:41:06 com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify
??: Obsolete content type encountered: 'text/javascript'.
2009-7-3 15:41:07 com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify
??: Obsolete content type encountered: 'text/javascript'.
======= EXCEPTION START ========
EcmaError: lineNumber=[16] column=[0] lineSource=[null] name=[TypeError] sourceName=[script in http://127.0.0.1:8080/test3.jsp from (7, 34) to (21, 20)] message=[TypeError: Cannot find function exportChart in object [object HTMLEmbedElement]. (script in http://127.0.0.1:8080/test3.jsp from (7, 34) to (21, 20)#16)]
com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot find function exportChart in object [object HTMLEmbedElement]. (script in http://127.0.0.1:8080/test3.jsp from (7, 34) to (21, 20)#16)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:513)
at org.mozilla.javascript.Context.call(Context.java:515)
at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:507)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:444)
at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:961)
at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:152)
at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:165)
at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:576)
at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:916)
at org.mozilla.javascript.Context.call(Context.java:515)
at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:507)
at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:921)
at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:136)
at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:107)
at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:76)
at test.MyTest.homePage_Firefox(MyTest.java:37)
at test.MyTest.main(MyTest.java:18)
Caused by: org.mozilla.javascript.EcmaError: TypeError: Cannot find function exportChart in object [object HTMLEmbedElement]. (script in http://127.0.0.1:8080/test3.jsp from (7, 34) to (21, 20)#16)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3654)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3632)
at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3660)
at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3679)
at org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3743)
at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2247)
at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2214)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3143)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2487)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:192)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
at com.gargoylesoftware.htmlunit.javascript.host.EventHandler.call(EventHandler.java:82)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:472)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$6.doRun(JavaScriptEngine.java:437)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:507)
... 16 more
Enclosed exception:
org.mozilla.javascript.EcmaError: TypeError: Cannot find function exportChart in object [object HTMLEmbedElement]. (script in http://127.0.0.1:8080/test3.jsp from (7, 34) to (21, 20)#16)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3654)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3632)
at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3660)
at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3679)
at org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3743)
at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThisHelper(ScriptRuntime.java:2247)
at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:2214)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3143)
at script.ExportMyChart(script in http://127.0.0.1:8080/test3.jsp from (7, 34) to (21, 20):16)
at script(onclick event for HtmlAnchor[] in http://127.0.0.1:8080/test3.jsp)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2487)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:192)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
at com.gargoylesoftware.htmlunit.javascript.host.EventHandler.call(EventHandler.java:82)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:472)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$6.doRun(JavaScriptEngine.java:437)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:507)
at org.mozilla.javascript.Context.call(Context.java:515)
at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:507)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:444)
at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:961)
at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:152)
at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:165)
at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:576)
at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:916)
at org.mozilla.javascript.Context.call(Context.java:515)
at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:507)
at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:921)
at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:136)
at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:107)
at com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableElement.java:76)
at test.MyTest.homePage_Firefox(MyTest.java:37)
at test.MyTest.main(MyTest.java:18)
== CALLING JAVASCRIPT ==
function () {
[native code, arity=0]
}