Package org.htmlunit.html
Class HtmlFormUtil
java.lang.Object
org.htmlunit.html.HtmlFormUtil
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.
- Author:
- tom.fennelly@gmail.com
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.htmlunit.html.HtmlButton
getButtonByCaption
(org.htmlunit.html.HtmlForm htmlForm, String caption) Get the form button having the specified text/caption.static org.htmlunit.html.HtmlElement
getSubmitButton
(org.htmlunit.html.HtmlForm htmlForm) Gets the first<button class="jenkins-submit-button">
element in this form.static List<org.htmlunit.html.HtmlElement>
getSubmitButtons
(org.htmlunit.html.HtmlForm htmlForm) Returns all the<input type="submit">
elements in this form.static org.htmlunit.Page
submit
(org.htmlunit.html.HtmlForm htmlForm) Submit the suppliedHtmlForm
.static org.htmlunit.Page
submit
(org.htmlunit.html.HtmlForm htmlForm, org.htmlunit.html.HtmlElement submitElement) Submit the suppliedHtmlForm
via the supplied submit element.
-
Method Details
-
submit
Submit the suppliedHtmlForm
.Locates the submit element/button on the form.
- Parameters:
htmlForm
- TheHtmlForm
.- Returns:
- The submit result page.
- Throws:
IOException
- Error performing submit.
-
submit
public static org.htmlunit.Page submit(org.htmlunit.html.HtmlForm htmlForm, org.htmlunit.html.HtmlElement submitElement) throws IOException Submit the suppliedHtmlForm
via the supplied submit element.- Parameters:
htmlForm
- TheHtmlForm
.submitElement
- The element through which the submit should be performed.- Returns:
- The submit result page.
- Throws:
IOException
- Error performing submit.
-
getSubmitButtons
public static List<org.htmlunit.html.HtmlElement> getSubmitButtons(org.htmlunit.html.HtmlForm htmlForm) throws org.htmlunit.ElementNotFoundException Returns all the<input type="submit">
elements in this form.- Throws:
org.htmlunit.ElementNotFoundException
-
getSubmitButton
public static org.htmlunit.html.HtmlElement getSubmitButton(org.htmlunit.html.HtmlForm htmlForm) throws org.htmlunit.ElementNotFoundException Gets the first<button class="jenkins-submit-button">
element in this form. If not found, then it looks for the first<input type="submit">
or<button name="Submit">
or<button>
(in that order).- Throws:
org.htmlunit.ElementNotFoundException
-
getButtonByCaption
public static org.htmlunit.html.HtmlButton getButtonByCaption(org.htmlunit.html.HtmlForm htmlForm, String caption) throws org.htmlunit.ElementNotFoundException Get the form button having the specified text/caption.- Parameters:
htmlForm
- The form containing the button.caption
- The button text/caption being searched for.- Returns:
- The button if found.
- Throws:
org.htmlunit.ElementNotFoundException
- Failed to find the button on the form.
-