Bugs item #1049592, was opened at 2004-10-18 21:27
Message generated for change (Comment added) made by spengie
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=497982&aid=1049592&group_id=61302

Category: None
Group: Release 1.3
Status: Closed
Resolution: Rejected
Priority: 5
Submitted By: Martijn Dashorst (dashorst)
Assigned to: Martijn Dashorst (dashorst)
Summary: Submitting form without submit button gives NPE

Initial Comment:
The following HTML makes JWebUnit choke with a
NullPointerException, when excercising the following
unittest.

public void testFoo() {
       
getTestContext().setBaseUrl("http://localhost:8081/jwebunit/Userlist/RajeshNair";);
        beginAt("report.htm");
        submit(); // gives NullPointerException.
}

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN" 
    "http://www.w3.org/TR/html4/loose.dtd";>
<html>
    <body>
        <form method="post" name="Form0"
action="report.htm">
            <input type="image" name="hiddenImgSubmit"
border="0" 
                src="/test/images/spacer.gif"
onfocus="window.focus()" 
                onclick="return true"
id="submit_View_Report"/>
            <input type="image"
name="hiddenImgSubmit$0" border="0" 
                src="/test/images/spacer.gif"
onfocus="window.focus()" 
                onclick="return true"
id="submit_Archive_Report"/>
        </form>
    </body>
</html>

----------------------------------------------------------------------

Comment By: Judy Spengeman (spengie)
Date: 2004-11-01 19:33

Message:
Logged In: YES 
user_id=1150491

I have the following code in my jsp - very similar to the one 
above:

<FORM method="POST" action="thankyou.do" name="form1">
            <BR>
            <TABLE>
                  <TR>
                <TD width="56"><INPUT type="image" 
src="/Shopping/iagree.gif" id= "agree" name="agree" 
border="0"></TD>
                  </TR>
      </TABLE>
</FORM>

As instructed in this posting, I used the clickButton("agree") 
however am getting the following error:

junit.framework.AssertionFailedError: Button [agree] not found.
        at junit.framework.Assert.fail(Assert.java:47)
        at junit.framework.Assert.assertTrue(Assert.java:20)
        at junit.framework.Assert.assertNotNull
(Assert.java:220)
        at 
net.sourceforge.jwebunit.WebTester.assertButtonPresent
(WebTester.java:580)
        at net.sourceforge.jwebunit.WebTester.clickButton
(WebTester.java:826)
        at 
net.sourceforge.jwebunit.WebTestCase.clickButton
(WebTestCase.java:324)
        at 
org.kp.tests.functional.web.MemberAddOnTest.testCaliforniaAd
dOn(MemberAddOnTest.java:68)
        at java.lang.reflect.Method.invoke(Native Method)
        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.RemoteTestRunner.runTest
s(RemoteTestRunner.java:392)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run
(RemoteTestRunner.java:276)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main
(RemoteTestRunner.java:167)


Please help! Thanks so much!


----------------------------------------------------------------------

Comment By: Martijn Dashorst (dashorst)
Date: 2004-10-18 21:30

Message:
Logged In: YES 
user_id=695103

This was originally posted by Rajesh Nair on the user list.

There is actually something that goes awry in HTTPUnit. This
problem can be worked around by using:

    clickButton("submit_View_Report");

instead of submit();

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=497982&aid=1049592&group_id=61302


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
Jwebunit-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development

Reply via email to