Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#57 Exception while changing a form's target through javascript

closed
Wolfgang Fahl
None
5
2007-12-30
2005-12-29
Nilesh Trivedi
No

I am using httpunit 1.6.1 along with jwebunit to test
my webapp.
I have this JSP page:

<html>
<body>
<!-- JavaScript
------------------------------------------------------>
<script language="JavaScript">

function openReport()
{
var myform = document.forms['report-input'];
myform.target = "newt";
return false;
}
</script>
<!-- End of JavaScript
----------------------------------------------->
<form id="form1" name="report-input" target=""
method="POST" action="nothing.jsp"
onSubmit="openReport()" >
<input type="submit" value="go" />
</form>
hi
</body>
</html>

And I am using the following test case to access this page:

public void testNow() throws Exception
{
beginAt("/mserver/jsp/test.jsp");
setWorkingForm("form1");
submit();
return;
}

When I run the test, I get the following exception:

org.mozilla.javascript.EvaluatorException: The
undefined value has no properties. (httpunit; line 3)
at
org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:76)
at
org.mozilla.javascript.Context.reportRuntimeError(Context.java:591)
at
org.mozilla.javascript.Context.reportRuntimeError
(Context.java:630)
at
org.mozilla.javascript.Context.reportRuntimeError0(Context.java:600)
at
org.mozilla.javascript.Undefined.reportError(Undefined.java:138)

Can anyone help me with this issue ??

Thanks a lot.

Discussion

  • Nilesh Trivedi
    Nilesh Trivedi
    2005-12-29

    Logged In: YES
    user_id=1226446

    This is the stackTrace printed:

    java.lang.RuntimeException:
    com.meterware.httpunit.ScriptException: Event 'openReport()'
    failed: org.mozilla.javascript.EvaluatorException: The
    undefined value has no properties. (httpunit; line 3)
    at
    com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.handleScriptException(JavaScript.java:202)
    at
    com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.performEvent(JavaScript.java:175)
    at
    com.meterware.httpunit.scripting.ScriptableDelegate.doEvent(ScriptableDelegate.java:56)
    at
    com.meterware.httpunit.WebRequestSource.submitRequest(WebRequestSource.java:232)
    at
    com.meterware.httpunit.WebForm.submitRequest(WebForm.java:96)
    at
    com.meterware.httpunit.WebForm.doFormSubmit(WebForm.java:107)
    at com.meterware.httpunit.WebForm.submit(WebForm.java:69)

     
  • Wolfgang Fahl
    Wolfgang Fahl
    2007-12-30

    • assigned_to: nobody --> wolfgang_fahl
    • status: open --> closed
     
  • Wolfgang Fahl
    Wolfgang Fahl
    2007-12-30

    Logged In: YES
    user_id=1220573
    Originator: NO

    Thank you for your Support Request for the httpunit project.
    httpunit is an open source project with very limited developer resources. The support of the project depends fully on it's community.

    Support Requests should therefore be directed to the httpunit mailing list. You can subscribe to that list via
    http://sourceforge.net/mail/?group_id=6550
    and be part of the community.

    If after some discussion you find that there is a bug in httpunit please try to prove so by checking out the latest trunk revision from svn. You might want to add a testcase in form of a JUnit Java source code that shows the problem and then suggest a modification with a patch. There are currently already around 700 JUnit Testcases so chances are you'll find a comparable testcase to start from.

    We'll happily add your modifications then to the svn repository.

    We are looking forward to your cooperation!

     
  • Wolfgang Fahl
    Wolfgang Fahl
    2007-12-30

    Logged In: YES
    user_id=1220573
    Originator: NO

    This might have been fixed in the meantime - I worked on a similar issue regarding changing "action" today