Hi All,
 
    I'm currently using jwebunit 1.4.1 to develop unit test cases for a
struts application. The application uses the JavaScript to submit the
forms [onClick attribute is used to trigger the JavaScript in the page].
 
    When I try to submit the form I'm getting an error saying that the
JavaScript function specified in the onClick attribute of the button is
null. However the viewsouce of the page has the javascript function
[Even this javascript function is displayed in the console when I do a
SOP(getPageSource() ) ].
 
    The stack trace is as follows :
 
java.lang.RuntimeException:
com.gargoylesoftware.htmlunit.ScriptException: TypeError: onVlanEdit is
not a function, it is null. (event for HtmlButtonInput[<input
value="Edit" type="BUTTON" onclick=" return onVlanEdit()" name="Edit"
id="Edit">]#1)
 at
net.sourceforge.jwebunit.htmlunit.HtmlUnitDialog.clickButton(HtmlUnitDia
log.java:1706)
 at
net.sourceforge.jwebunit.junit.WebTester.clickButton(WebTester.java:1992
)
 at
net.sourceforge.jwebunit.junit.WebTestCase.clickButton(WebTestCase.java:
1541)
 at unittesting.SampleWebTest.testVLANSearch(SampleWebTest.java:185)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
 at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at junit.framework.TestCase.runTest(TestCase.java:164)
 at junit.framework.TestCase.runBare(TestCase.java:130)
 at
net.sourceforge.jwebunit.junit.WebTestCase.runBare(WebTestCase.java:58)
 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:120)
 at junit.framework.TestSuite.runTest(TestSuite.java:230)
 at junit.framework.TestSuite.run(TestSuite.java:225)
 at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUn
it3TestReference.java:128)
 at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.ja
va:38)
 at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
stRunner.java:460)
 at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
stRunner.java:673)
 at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun
ner.java:386)
 at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu
nner.java:196)
Caused by: com.gargoylesoftware.htmlunit.ScriptException: TypeError:
onVlanEdit is not a function, it is null. (event for
HtmlButtonInput[<input value="Edit" type="BUTTON" onclick=" return
onVlanEdit()" name="Edit" id="Edit">]#1)
 at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(J
avaScriptEngine.java:322)
 at
com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfP
ossible(HtmlPage.java:736)
 at
com.gargoylesoftware.htmlunit.html.HtmlPage.runEventHandler(HtmlPage.jav
a:1489)
 at
com.gargoylesoftware.htmlunit.html.HtmlPage.runEventHandler(HtmlPage.jav
a:1465)
 at
com.gargoylesoftware.htmlunit.html.ClickableElement.click(ClickableEleme
nt.java:44)
 at
net.sourceforge.jwebunit.htmlunit.HtmlUnitDialog.clickButton(HtmlUnitDia
log.java:1704)
 ... 22 more
Caused by: org.mozilla.javascript.EcmaError: TypeError: onVlanEdit is
not a function, it is null. (event for HtmlButtonInput[<input
value="Edit" type="BUTTON" onclick=" return onVlanEdit()" name="Edit"
id="Edit">]#1)
 at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3
229)
 at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3
219)
 at
org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3235)
 at
org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3254)
 at
org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java
:3309)
 at
org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1
652)
 at
org.mozilla.javascript.ScriptRuntime.getNameFunctionAndThis(ScriptRuntim
e.java:1906)
 at
org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:2923)
 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
com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCal
l(HtmlUnitContextFactory.java:151)
 at
org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2758)
 at
org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java
:159)
 at
com.gargoylesoftware.htmlunit.javascript.host.EventHandler.call(EventHan
dler.java:95)
 at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(J
avaScriptEngine.java:363)
 at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(J
avaScriptEngine.java:318)
 ... 27 more
 
Thanks in advance for any help extended.
 
Cheers !


This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly 
prohibited and may be unlawful.  If you have received this communication 
in error, please immediately notify the sender by reply e-mail and destroy 
all copies of the communication and any attachments.
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
JWebUnit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-users

Reply via email to