/**
* Builds an exception with helpfull information
* @return the exception
*/
private StepFailedException buildNoButtonFoundException() {
final StepFailedException e = new StepFailedException("No button found", this);
final HtmlForm currentForm = getContext().getCurrentForm();
final StringBuffer msg = new StringBuffer();
if (currentForm != null) {
msg.append("In current form:\n");
msg.append(getButtonsDescription(currentForm));
}
final Iterator formsIterator = getContext().getCurrentHtmlResponse(this).getForms().iterator();
while (formsIterator.hasNext()) {
final HtmlForm form = (HtmlForm) formsIterator.next();
if (form != currentForm)
{
if (msg.length() != 0)
msg.append("\n\n");
msg.append("In " + form + ":\n");
msg.append(getButtonsDescription(form));
}
}
e.addDetail("available buttons", msg.toString());
return e;
}