Hi all,
This is my source file, called "test.jsp":
<html>
<script language="_javascript_">
function getSelectHtml()
{
var str="";
str += "<option value=\"value1\">item1</option>";
str += "<option value=\"value2\">item2</option>";
return str;
}
</script>
<body>
<form id="form1">
<select id="customer" name="customer">
<script>document.write(getSelectHtml());</script>
</select>
<input type="submit" value="go" />
</form>
</body>
</html>
and here is my jwebunit testing code:
public class TestJS extends WebTestCase
{
public TestJS(String name)
{
super(name);
}
public void testNow() throws Exception
{
beginAt("test.jsp");
setWorkingForm("form1");
assertElementPresent("customer");
setFormElement("customer","item1");
return;
}
}
I am getting the following exception on running the testcase:
com.meterware.httpunit.IllegalParameterValueException: May not set parameter 'customer' to 'item1'. Value must be one of: { }
at com.meterware.httpunit.SelectionFormControl$Options.reportNoMatches(FormControl.java:1197)
at com.meterware.httpunit.SelectionFormControl$SingleSelectOptions.claimUniqueValues(FormControl.java:1371)
at com.meterware.httpunit.SelectionFormControl$Options.claimUniqueValues(FormControl.java:1189)
at com.meterware.httpunit.SelectionFormControl.claimUniqueValue(FormControl.java:1070)
at com.meterware.httpunit.FormParameter.setValues (FormParameter.java:90)
at com.meterware.httpunit.WebForm.setParameter(WebForm.java:612)
at com.meterware.httpunit.WebForm.setParameter(WebForm.java:601)
at net.sourceforge.jwebunit.HttpUnitDialog.setFormParameter (HttpUnitDialog.java:299)
at net.sourceforge.jwebunit.WebTester.setFormElement(WebTester.java:789)
at net.sourceforge.jwebunit.WebTestCase.setFormElement(WebTestCase.java:317)
at nuance.mserver.systemanalysis.TestJS.testNow (TestJS.java:18)
What I am not able to understand is that why is the array of allowed options is coming as empty "{ }" ??
Has anyone faced similar issues before ??
This is my source file, called "test.jsp":
<html>
<script language="_javascript_">
function getSelectHtml()
{
var str="";
str += "<option value=\"value1\">item1</option>";
str += "<option value=\"value2\">item2</option>";
return str;
}
</script>
<body>
<form id="form1">
<select id="customer" name="customer">
<script>document.write(getSelectHtml());</script>
</select>
<input type="submit" value="go" />
</form>
</body>
</html>
and here is my jwebunit testing code:
public class TestJS extends WebTestCase
{
public TestJS(String name)
{
super(name);
}
public void testNow() throws Exception
{
beginAt("test.jsp");
setWorkingForm("form1");
assertElementPresent("customer");
setFormElement("customer","item1");
return;
}
}
I am getting the following exception on running the testcase:
com.meterware.httpunit.IllegalParameterValueException: May not set parameter 'customer' to 'item1'. Value must be one of: { }
at com.meterware.httpunit.SelectionFormControl$Options.reportNoMatches(FormControl.java:1197)
at com.meterware.httpunit.SelectionFormControl$SingleSelectOptions.claimUniqueValues(FormControl.java:1371)
at com.meterware.httpunit.SelectionFormControl$Options.claimUniqueValues(FormControl.java:1189)
at com.meterware.httpunit.SelectionFormControl.claimUniqueValue(FormControl.java:1070)
at com.meterware.httpunit.FormParameter.setValues (FormParameter.java:90)
at com.meterware.httpunit.WebForm.setParameter(WebForm.java:612)
at com.meterware.httpunit.WebForm.setParameter(WebForm.java:601)
at net.sourceforge.jwebunit.HttpUnitDialog.setFormParameter (HttpUnitDialog.java:299)
at net.sourceforge.jwebunit.WebTester.setFormElement(WebTester.java:789)
at net.sourceforge.jwebunit.WebTestCase.setFormElement(WebTestCase.java:317)
at nuance.mserver.systemanalysis.TestJS.testNow (TestJS.java:18)
What I am not able to understand is that why is the array of allowed options is coming as empty "{ }" ??
Has anyone faced similar issues before ??
Thanks
Nilesh
