protected Object scrape() throws IOException, SAXException, ProcessingException {
WebResponse response = goTo(_getURL()+"/servlets/ProjectApproval");
WebTable table = response.getTableStartingWith("Project");
int rows = table.getRowCount();
boolean found = false;
String approveElementName = null;
for (int r = 1; r < rows && !found; r++ ) {
TableCell c1 = table.getTableCell(r, 0);
if (c1.getLinks().length > 0) {
String link = c1.getLinks()[0].getURLString();
if (link.equals(_getURL()+'/')) {
TableCell c2 = table.getTableCell(r, 3);
String[] names = c2.getElementNames();
if (names.length > 0) {
approveElementName = names[0];
found = true;
}
}
}
}
if (!found)
throw new ProcessingException("Unable to find project "+projectName+" in the approval page");
WebForm form = Util.getFormWithAction(response,"ProjectApproval");
form.setParameter(approveElementName, approve ? "Approve" : "Disapprove");
form.setParameter("disapprovalReason",reason);
checkError(form.submit());
return null;
}
}