/** * Gets the first {@code <input type="submit">} element in this form. */ public static HtmlElement getSubmitButton(final HtmlForm htmlForm) throws ElementNotFoundException { List<HtmlElement> submitButtons = getSubmitButtons(htmlForm); if (!submitButtons.isEmpty()) { return submitButtons.get(0); } for (HtmlElement element : htmlForm.getElementsByTagName("button")) { if(element instanceof HtmlButton) { return element; } } return null; }