/** * Finds the form in the html document that performs the provided action. * * @param action the action to search for. * @param forms the html forms in the document. * @return the form, or null of there is none. */ public static HtmlForm getFormWithAction(String action, List<HtmlForm> forms) { for (HtmlForm f : forms) { if (f.getActionAttribute().equalsIgnoreCase(action)) { return f; } } return null; }
/** * @param forms * @param action * @return */ public static HtmlForm getFormByAction(final List<HtmlForm> forms, final String action) { for (final HtmlForm form : forms) { if (action.equalsIgnoreCase(form.getActionAttribute())) { return form; } } return null; }
private HtmlForm findForm(HtmlPage page, String action) { for (HtmlForm form : page.getForms()) { if (action.equals(form.getActionAttribute())) { return form; } } fail("no form found"); return null; }