Hi!
I've had errors before due to improperly formed HTML (for example, I was
working with portlets, and dubiously had multiple <html> declarations). Are
you sure that the generated html/js is valid? You can check here:
http://validator.w3.org/. This validator usually finds more problems than I
care to fix, but among them you can sometimes find a cause...
I might also be able to help more if you send your page source.
All the best,
-- Dan
On 7/16/07, P, Vijeeth <[EMAIL PROTECTED]> wrote:
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(
HtmlUnitDialog.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.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.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(
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)
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
(JavaScriptEngine.java:322)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible
(HtmlPage.java:736)
at com.gargoylesoftware.htmlunit.html.HtmlPage.runEventHandler(
HtmlPage.java:1489)
at com.gargoylesoftware.htmlunit.html.HtmlPage.runEventHandler(
HtmlPage.java:1465)
at com.gargoylesoftware.htmlunit.html.ClickableElement.click(
ClickableElement.java:44)
at net.sourceforge.jwebunit.htmlunit.HtmlUnitDialog.clickButton(
HtmlUnitDialog.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
:3229)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java
:3219)
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
:1652)
at org.mozilla.javascript.ScriptRuntime.getNameFunctionAndThis(
ScriptRuntime.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.doTopCall(
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(
EventHandler.java:95)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction
(JavaScriptEngine.java:363)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction
(JavaScriptEngine.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
-------------------------------------------------------------------------
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