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.java:58)
at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.performEvent(JavaScript.java:162)
at com.meterware.httpunit.scripting.ScriptableDelegate.doEvent(ScriptableDelegate.java:55)
at com.meterware.httpunit.FormControl.sendOnChangeEvent(FormControl.java:242)
at com.meterware.httpunit.SelectionFormControl.claimUniqueValue(FormControl.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.java: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(MattRaibleTest.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(HttpUnitDialog .java:863)
[junit] at net.sourceforge.jwebunit.HttpUnitDialog.selectOption(HttpUnitDialog.java :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
