Two things:

1) Put a breakpoint in HttpUnitDialog.getSelectedOption(String selectName) 
Iterate over each value and inspect the values.

2) You may have a CR LF problem between the begin and end tag of </option>

This CFLF problem with not allow two object to equal.

3) Are you using an object based html rendering engine.... ie.  some have a
Pretty Print option.

4) Some browsers when using "view-source" will give a pretty view of the
content and thus "hiding" a CFLF.

Good Luck!!! HTH...

Nick


-----Original Message-----
From: Matt Raible [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 17, 2005 1:03 PM
To: jwebunit-users@lists.sourceforge.net
Subject: [Jwebunit-users] Asserting option selected in form


I'm using the following code to assert the proper option is selected in  
a name="companyName" <select>:

         assertFormElementEquals("startDate",  
formatter.format(startDate));
         assertFormElementEquals("endDate", formatter.format(endDate));
         assertFormElementPresent("companyName");
         assertOptionEquals("companyName", "NSPP");

However, I'm getting:

     [junit] expected:<NSPP> but was:<null>
     [junit] junit.framework.ComparisonFailure: expected:<NSPP> but  
was:<null>
     [junit]     at  
net.sourceforge.jwebunit.WebTester.assertOptionEquals(WebTester.java: 
538)
     [junit]     at  
net.sourceforge.jwebunit.WebTestCase.assertOptionEquals(WebTestCase.java 
:212)

If I do a view-source of this form in my browser - it all looks right:

<select name="companyName" id="companyName"><option  
value="">All</option>

                 <option value="NSPP"  
selected="selected">NSPP</option></select>

Thanks,

Matt



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Jwebunit-users mailing list
Jwebunit-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jwebunit-users


- - - - - - 
This e-mail message is intended only for the use of the individual or entity
identified in the alias address of this message and may contain confidential
and privileged information. Any unauthorized review, use, disclosure or
distribution of this e-mail message is strictly prohibited. If you have
received this e-mail message in error, please notify the sender immediately
by reply e-mail and delete this message from your system. Thank you.


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Jwebunit-users mailing list
Jwebunit-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jwebunit-users

Reply via email to