Downgrading is not necessary. I was hoping that would solve the problem, but it didn't.

Removing the onChange handler solvers the javascript error and makes the test pass. I've upgraded my local version (which is not the official released version) to the following lib versions:
- jwebunit-1.2.jar
- js-1.6R1.jar
- nekohtml-0.9.4.jar
- httpunit-1.6.jar
On my setup (in Eclipse) all unittests pass. Perhaps this will help?


If not, can you send the complete html file that fails the test, and the testcase?

Martijn

Matt Raible wrote:

I'm using HttpUnit 1.6. Do you get the error if you remove the onchange handler? Do I need to downgrade my version of httpunit?

Thanks,

Matt

On Feb 2, 2005, at 12:54 PM, Martijn Dashorst wrote:

Matt,

Which version of httpunit are you using? I'm having trouble reproducing this error, as I get a JavaScript error stating that 'checkCompany' is not available, which is correct as I don't have that javascript function:
ReferenceError: "checkCompany" is not defined.
at org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java: 597)
at org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java: 557)
at org.mozilla.javascript.ScriptRuntime.getBase(ScriptRuntime.java:1110)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2006)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.jav a:58)
at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.performEv ent(JavaScript.java:162)
at com.meterware.httpunit.scripting.ScriptableDelegate.doEvent(ScriptableD elegate.java:55)
at com.meterware.httpunit.FormControl.sendOnChangeEvent(FormControl.java: 242)
at com.meterware.httpunit.SelectionFormControl.claimUniqueValue(FormContro l.java:973)
at com.meterware.httpunit.FormParameter.setValues(FormParameter.java:90)
at com.meterware.httpunit.WebForm.setParameter(WebForm.java:533)
at com.meterware.httpunit.WebForm.setParameter(WebForm.java:526)
at net.sourceforge.jwebunit.HttpUnitDialog.setFormParameter(HttpUnitDialog .java:347)
at net.sourceforge.jwebunit.HttpUnitDialog.selectOption(HttpUnitDialog.jav a:1034)
at net.sourceforge.jwebunit.WebTester.selectOption(WebTester.java:1051)
at net.sourceforge.jwebunit.WebTestCase.selectOption(WebTestCase.java: 368)
at net.sourceforge.jwebunit.userlist.MattRaibleTest.testSubmitForm(MattRai bleTest.java:37)


I've this html document:
<html>
<body>
<form name="outageForm"><select name="outage.companyName"
   onchange="checkCompany(this)" id="outage.companyName">
   <option value=""></option>
   <option value="2">NSPP</option>
   <option value="1">PSCo</option>
   <option value="3">SPS</option>
</select></form>
</body>
</html>

and this unit test:
       assertFormPresent("outageForm");
       assertFormElementPresent("outage.companyName");
             setWorkingForm("outageForm");
       assertOptionPresent("outage.companyName", "NSPP");
       selectOption("outage.companyName", "NSPP");

What am I missing?

Martijn


Matt Raible wrote:

I have the following code in my jWebUnit test:

selectOption("outage.companyName", "NSPP");

And I have the following HTML that's rendered (if I do a view-source in Firefox):

<select name="outage.companyName" onchange="checkCompany(this)" id="outage.companyName">
<option value=""></option>
<option value="2">NSPP</option>
<option value="1">PSCo</option>
<option value="3">SPS</option>
</select>


Any idea why I'm getting the following error:

[junit] Unable to find option NSPP for outage.companyName
[junit] java.lang.RuntimeException: Unable to find option NSPP for outage.companyName
[junit] at net.sourceforge.jwebunit.HttpUnitDialog.getValueForOption(HttpUnitDial og .java:863)
[junit] at net.sourceforge.jwebunit.HttpUnitDialog.selectOption(HttpUnitDialog.ja va :875)
[junit] at net.sourceforge.jwebunit.WebTester.selectOption(WebTester.java:847)
[junit] at net.sourceforge.jwebunit.WebTestCase.selectOption(WebTestCase.java: 341)


Thanks,

Matt



-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Jwebunit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-users





------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ Jwebunit-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jwebunit-users




-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Jwebunit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-users




------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl _______________________________________________ Jwebunit-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jwebunit-users

Reply via email to