public class Form extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Form.LabelSide
Represents whether a label is on the left or right side of a checkbox/radiobutton/etc.
|
Modifier and Type | Method and Description |
---|---|
Form |
apply(Object... args)
Applies the specified parameters in succession to the form's editable (ie, visible and non-disabled) inputs, starting from the input after the most recently edited input, or starting from the first input, if the form has not yet been edited.
|
boolean |
checkBoxIsChosen(String label,
Form.LabelSide labelSide)
Examines the checkbox with the specified text label and returns true if it is checked, otherwise returns false.
|
Form |
chooseCheckBox(String label)
Selects the checkbox that has the specified text label on the right side.
|
Form |
chooseCheckBox(String label,
Form.LabelSide labelSide)
Selects the checkbox with the specified text label.
|
Form |
chooseMenuItem(String label,
String menuItemText)
Locates the dropdown menu that has the specified text label and selects the menuItem that matches the specified menuItemText.
|
Form |
chooseRadioButton(String label)
Selects the radiobutton that has the specified text label on the right side.
|
Form |
chooseRadioButton(String label,
Form.LabelSide labelSide)
Selects the radiobutton with the specified text label.
|
String |
getChosenMenuItem(String label)
Locates the dropdown menu that has the specified text label and returns the text of the selected menu item.
|
String |
getFieldValue(String label)
Returns the value of the textfield, password field, or textarea field that has the specified text label.
|
boolean |
menuItemIsChosen(String label,
String menuItemText)
Locates the dropdown menu that has the specified text label and determines whether the menuitem that matches the specified text is selected, returning true/false correspondingly.
|
boolean |
radioButtonIsChosen(String label,
Form.LabelSide labelSide)
Examines the radiobutton with the specified text label and returns true if it is checked, otherwise returns false.
|
Form |
setFieldValue(String label,
String value)
Locates the textfield, password field, or textarea field that has the specified text label and fills the field with the specified text value.
|
Document |
submit()
Submits the the form without clicking on any particular submit button.
|
Document |
submit(String buttonText)
Submits the the form by clicking the first submit button who's value (ie, text label) matches the specified (case-insensitive) buttonText and throws a NotFound Exception if it does not exist.
|
String |
toString()
Returns the outerHTML of the form element.
|
Form |
unchooseCheckBox(String label)
Deselects the checkbox that has the specified text label on the right side.
|
Form |
unchooseCheckBox(String label,
Form.LabelSide labelSide)
Deselects the checkbox with the specified text label.
|
Form |
unchooseRadioButton(String label)
Deselects the radiobutton that has the specified text label on the right side.
|
Form |
unchooseRadioButton(String label,
Form.LabelSide labelSide)
Deselects the radiobutton with the specified text label.
|
public Element element
public Form setFieldValue(String label, String value) throws JauntiumException
label
- the text label to the immediate left side of the field (including colon or any other punctuation), matched in a case-insensitive, whitespace-insensitive manner.value
- the value with which to fillout the field.JauntiumException
public String getFieldValue(String label) throws JauntiumException
label
- the text label to the immediate left side of the field (including colon or any other punctuation), matched in a case-insensitive, whitespace-insensitive manner.JauntiumException
public Form chooseMenuItem(String label, String menuItemText) throws JauntiumException
label
- the text label to the immediate left side of the dropdown menu (including colon or any other punctuation), matched in a case-insensitive, whitespace-insensitive manner.menuItemText
- the text of the menuItem to be selected, matched in a case-insensitive, whitespace-insensitive manner.JauntiumException
public boolean menuItemIsChosen(String label, String menuItemText) throws JauntiumException
label
- the text label to the immediate left side of the dropdown menu (including colon or any other punctuation), matched in a case-insensitive, whitespace-insensitive manner.menuItemText
- the text of the menuItem, matched in a case-insensitive, whitespace-insensitive manner.JauntiumException
public String getChosenMenuItem(String label) throws JauntiumException
label
- the text label to the immediate left side of the dropdown menu (including colon or any other punctuation), matched in a case-insensitive, whitespace-insensitive manner.JauntiumException
public Form chooseRadioButton(String label, Form.LabelSide labelSide) throws JauntiumException
label
- the text label to the immediate side of the radiobutton (including colon or any other punctuation), matched in a case-insensitive, whitespace-insensitive manner.labelSide
- whether the label is on the left of right side of the radiobutton.JauntiumException
public Form chooseCheckBox(String label, Form.LabelSide labelSide) throws JauntiumException
label
- the text label to the immediate side of the checkbox (including colon or any other punctuation), matched in a case-insensitive, whitespace-insensitive manner.labelSide
- whether the label is on the left of right side of the checkbox.JauntiumException
public Form chooseRadioButton(String label) throws JauntiumException
label
- the text label to the immediate left side of the radiobutton (including colon or any other punctuation), matched in a case-insensitive, whitespace-insensitive manner.JauntiumException
public Form chooseCheckBox(String label) throws JauntiumException
label
- the text label to the immediate left side of the checkbox (including colon or any other punctuation), matched in a case-insensitive, whitespace-insensitive manner.JauntiumException
public Form unchooseRadioButton(String label, Form.LabelSide labelSide) throws JauntiumException
label
- the text label to the immediate side of the radiobutton (including colon or any other punctuation), matched in a case-insensitive, whitespace-insensitive manner.labelSide
- whether the label is on the left of right side of the radiobutton.JauntiumException
public Form unchooseCheckBox(String label, Form.LabelSide labelSide) throws JauntiumException
label
- the text label to the immediate side of the checkbox (including colon or any other punctuation), matched in a case-insensitive, whitespace-insensitive manner.labelSide
- whether the label is on the left of right side of the checkbox.JauntiumException
public Form unchooseRadioButton(String label) throws JauntiumException
label
- the text label to the immediate side of the radiobutton (including colon or any other punctuation), matched in a case-insensitive, whitespace-insensitive manner.JauntiumException
public Form unchooseCheckBox(String label) throws JauntiumException
label
- the text label to the immediate side of the checkbox (including colon or any other punctuation), matched in a case-insensitive, whitespace-insensitive manner.JauntiumException
public boolean radioButtonIsChosen(String label, Form.LabelSide labelSide) throws JauntiumException
label
- the text label to the immediate side of the radiobutton (including colon or any other punctuation), matched in a case-insensitive, whitespace-insensitive manner.labelSide
- whether the label is on the left of right side of the radioButtonJauntiumException
public boolean checkBoxIsChosen(String label, Form.LabelSide labelSide) throws JauntiumException
label
- the text label to the immediate side of the checkbox (including colon or any other punctuation), matched in a case-insensitive, whitespace-insensitive manner.labelSide
- whether the label is on the left of right side of the checkbox.JauntiumException
public Form apply(Object... args) throws JauntiumException
args
- an arg of type String will populate a textfield/textarea/passwordField OR select the matching menuItem in a dropdown menu OR select the matching right-side label of a radiobutton (unless the string is "\t", in which case it will skip to the next form component); a Boolean param will check/uncheck a checkbox; any other type of param will be treated as a String by calling its toString()
method; If number of args exceeds the number of form controls, the extra arguments are ignored.JauntiumException
public Document submit(String buttonText) throws NotFound
NotFound
public Document submit()