Here is the Exception
org.mozilla.javascript.EcmaError: TypeError: Cannot find function
createElement. (httpunit#418)
at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3229)
at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3219)
at
org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3235)
at
org.mozilla.javascript.ScriptRuntime.typeError1(ScriptRuntime.java:3247)
at
org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3307)
at
org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:1991)
at
org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:2932)
at script.appInfoUserSelections(httpunit:418)
at script(httpunit)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2251)
at
org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:161)
at
org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:340)
at
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2758)
at
org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:172)
at org.mozilla.javascript.Context.evaluateString(Context.java:1132)
at
com.meterware.httpunit.javascript.ScriptingEngineImpl.runScript(ScriptingEngineImpl.java:92)
at
com.meterware.httpunit.scripting.ScriptableDelegate.runScript(ScriptableDelegate.java:88)
at
com.meterware.httpunit.parsing.NekoDOMParser.runScript(NekoDOMParser.java:151)
at
com.meterware.httpunit.parsing.ScriptFilter.getTranslatedScript(ScriptFilter.java:150)
at
com.meterware.httpunit.parsing.ScriptFilter.endElement(ScriptFilter.java:131)
at
org.cyberneko.html.filters.DefaultFilter.endElement(DefaultFilter.java:249)
at
org.cyberneko.html.filters.NamespaceBinder.endElement(NamespaceBinder.java:367)
at
org.cyberneko.html.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1015)
at
org.cyberneko.html.HTMLTagBalancer.endElement(HTMLTagBalancer.java:888)
at
org.cyberneko.html.HTMLScanner$SpecialScanner.scan(HTMLScanner.java:2831)
at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:809)
at
org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:478)
at
org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:431)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at
com.meterware.httpunit.parsing.NekoHTMLParser.parse(NekoHTMLParser.java:48)
at com.meterware.httpunit.HTMLPage.parse(HTMLPage.java:271)
at
com.meterware.httpunit.WebResponse.getReceivedPage(WebResponse.java:1301)
at com.meterware.httpunit.WebResponse.getFrames(WebResponse.java:1285)
at
com.meterware.httpunit.WebResponse.getFrameRequests(WebResponse.java:1024)
at com.meterware.httpunit.FrameHolder.updateFrames(FrameHolder.java:179)
at
com.meterware.httpunit.WebWindow.updateFrameContents(WebWindow.java:315)
at
com.meterware.httpunit.WebClient.updateFrameContents(WebClient.java:526)
at com.meterware.httpunit.WebWindow.updateWindow(WebWindow.java:201)
at
com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindow.java:183)
at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:158)
at com.meterware.httpunit.WebWindow.sendRequest(WebWindow.java:134)
at
com.meterware.httpunit.WebRequestSource.submitRequest(WebRequestSource.java:297)
at
com.meterware.httpunit.WebRequestSource.submitRequest(WebRequestSource.java:253)
at com.meterware.httpunit.WebForm.submitRequest(WebForm.java:127)
at com.meterware.httpunit.WebForm.doFormSubmit(WebForm.java:143)
at
com.meterware.httpunit.SubmitButton.doButtonAction(SubmitButton.java:69)
at com.meterware.httpunit.Button.doOnClickSequence(Button.java:91)
at com.meterware.httpunit.WebForm.submit(WebForm.java:107)
at com.meterware.httpunit.WebForm.submit(WebForm.java:93)
at com.meterware.httpunit.WebForm.submit(WebForm.java:82)
at
test.applicant.ApplicantCreateTest.testApplicantCreate(ApplicantCreateTest.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
com.meterware.httpunit.ScriptException: Script 'appInfoUserSelections()'
failed: org.mozilla.javascript.EcmaError: TypeError: Cannot find
function createElement. (httpunit#418)
Our JSPs have pretty good bunch of java scripts. In this particular
case, I have a JSP including another jsp. This included JSP has few
scripts, some of them are triggered on body onload event.
Now, when I get to this page response through HttpUnit Request/Respnses,
I am getting this exception.
The script extract:
function appInfoUserSelections()
{
------
var element = document.*createElement*("option");
-----
}
This line is throwing this exception.
I have seen somewhere Rhino supports Javascript Standards... I do not
see this _createElement _method in any of these Javascript (ECMA)
standards. However, this method is introduced into DOM level1. Does
Rhino supports DOM-flavored Javascripts?
If it supports, then can anyone help me pass through this Exception?
If not, any suggestions is appreciated. Since I am stuck here for about
couple days besides doing some other work.
Testing/Dev Environment:
Downloaded HttpUnit a month ago, using Eclipse 3.2 IDE, created
TestCases through this; I have the following jars in the testing project
library: junit3.8.1.jar, httpunit.jar, js-1.6R5.jar,
nekhohtml-0.9.5.jar, xercesImpl-2.6.1.jar, xmlParserAPIs-2.6.1.jar. Out
of which junit3.8.1.jar comes with Eclipse testing plugins itself I believe.
Thanks for your time.
Rhino doesn't implement any of the browser DOM. You might look at
HtmlUnit for what you are doing.
--N