Bugs item #1579638, was opened at 2006-10-18 14:43
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=497982&aid=1579638&group_id=61302
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Bernard de Terwangne (bdt_star)
Assigned to: Nobody/Anonymous (nobody)
Summary: submit(name, value) may fail in ClassCastException
Initial Comment:
If you have multiple elements with the same name it
might be that some of them are not of type
HtmlSubmitInput. In this case you get a
ClassCastException. I have the problem with unnamed
submits and there are other elements with no name
before them. My test case is as follows
tester.assertSubmitButtonPresent("", "Supprimer la
classe d'objets");
tester.submit("", "Supprimer la classe d'objets");
I fixed HtmlUnitDialog like this:
public void submit(String buttonName, String
buttonValue) {
List l = getForm().getInputsByName(buttonName);
for (int i = 0; i < l.size(); i++) {
Object o = l.get(i);
if (o instanceof HtmlSubmitInput)
{
HtmlSubmitInput inpt = (HtmlSubmitInput) o;
try {
if
(inpt.getValueAttribute().equals(buttonValue)) {
inpt.click();
return;
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
}
AND
public HtmlSubmitInput getSubmitButton(String
buttonName, String buttonValue) {
checkFormStateWithButton(buttonName);
List btns = null;
try {
btns = getForm().getInputsByName(buttonName);
} catch (ClassCastException e) {
return null;
}
for (int i = 0; i < btns.size(); i++) {
Object o = btns.get(i);
if (o instanceof HtmlSubmitInput)
{
HtmlSubmitInput btn = (HtmlSubmitInput) o;
if
(btn.getValueAttribute().equals(buttonValue))
return btn;
}
}
return null;
}
Bernard
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=497982&aid=1579638&group_id=61302
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Jwebunit-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development