public class HtmlFormUtil extends Object
HtmlForm
helper functions.
In many cases, the methods defined here replace methods of the same name that were
added to the HtmlForm
class on the old forked version of HtmlUnit.
Constructor and Description |
---|
HtmlFormUtil() |
Modifier and Type | Method and Description |
---|---|
static com.gargoylesoftware.htmlunit.html.HtmlButton |
getButtonByCaption(com.gargoylesoftware.htmlunit.html.HtmlForm htmlForm,
String caption)
Get the form button having the specified text/caption.
|
static com.gargoylesoftware.htmlunit.html.HtmlElement |
getSubmitButton(com.gargoylesoftware.htmlunit.html.HtmlForm htmlForm)
Gets the first
<input type="submit"> element in this form. |
static List<com.gargoylesoftware.htmlunit.html.HtmlElement> |
getSubmitButtons(com.gargoylesoftware.htmlunit.html.HtmlForm htmlForm)
Returns all the
<input type="submit"> elements in this form. |
static com.gargoylesoftware.htmlunit.Page |
submit(com.gargoylesoftware.htmlunit.html.HtmlForm htmlForm)
Submit the supplied
HtmlForm . |
static com.gargoylesoftware.htmlunit.Page |
submit(com.gargoylesoftware.htmlunit.html.HtmlForm htmlForm,
com.gargoylesoftware.htmlunit.html.HtmlElement submitElement)
Submit the supplied
HtmlForm via the supplied submit element. |
public static com.gargoylesoftware.htmlunit.Page submit(com.gargoylesoftware.htmlunit.html.HtmlForm htmlForm) throws IOException
HtmlForm
.
Locates the submit element/button on the form.
htmlForm
- The HtmlForm
.IOException
- Error performing submit.public static com.gargoylesoftware.htmlunit.Page submit(com.gargoylesoftware.htmlunit.html.HtmlForm htmlForm, com.gargoylesoftware.htmlunit.html.HtmlElement submitElement) throws IOException
HtmlForm
via the supplied submit element.htmlForm
- The HtmlForm
.submitElement
- The element through which the submit should be performed.IOException
- Error performing submit.public static List<com.gargoylesoftware.htmlunit.html.HtmlElement> getSubmitButtons(com.gargoylesoftware.htmlunit.html.HtmlForm htmlForm) throws com.gargoylesoftware.htmlunit.ElementNotFoundException
<input type="submit">
elements in this form.com.gargoylesoftware.htmlunit.ElementNotFoundException
public static com.gargoylesoftware.htmlunit.html.HtmlElement getSubmitButton(com.gargoylesoftware.htmlunit.html.HtmlForm htmlForm) throws com.gargoylesoftware.htmlunit.ElementNotFoundException
<input type="submit">
element in this form.com.gargoylesoftware.htmlunit.ElementNotFoundException
public static com.gargoylesoftware.htmlunit.html.HtmlButton getButtonByCaption(com.gargoylesoftware.htmlunit.html.HtmlForm htmlForm, String caption) throws com.gargoylesoftware.htmlunit.ElementNotFoundException
htmlForm
- The form containing the button.caption
- The button text/caption being searched for.com.gargoylesoftware.htmlunit.ElementNotFoundException
- Failed to find the button on the form.Copyright © 2004–2022. All rights reserved.