com.meterware.httpunit
public class WebForm extends WebRequestSource
Nested Class Summary | |
---|---|
class | WebForm.Scriptable |
Field Summary | |
---|---|
static HTMLElementPredicate | MATCH_NAME Predicate to match a link's name. |
Method Summary | |
---|---|
protected void | addPresetParameter(String name, String value)
Records a parameter defined by including it in the destination URL. |
String | getAction()
Returns the action defined for this form.
|
Button | getButton(HTMLElementPredicate predicate, Object criteria) |
Button[] | getButtons()
Returns an array containing all of the buttons defined for this form.
|
Button | getButtonWithID(String buttonID)
Convenience method which returns the button with the specified ID. |
String | getCharacterSet()
Returns the character set encoding for this form.
|
protected String | getEmptyParameterValue() |
String | getMethod()
Returns the method defined for this form.
|
int | getNumTextParameters(String name)
Returns the number of text parameters in this form with the specified name.
|
String[] | getOptions(String name)
Returns the displayed options defined for the specified parameter name.
|
String[] | getOptionValues(String name)
Returns the option values defined for the specified parameter name.
|
String[] | getParameterNames()
Returns an array containing the names of the parameters defined for this form.
|
String | getParameterValue(String name)
Returns the default value of the named parameter. |
String[] | getParameterValues(String name)
Returns the multiple default values of the named parameter.
|
WebRequest | getRequest(String submitButtonName, String submitButtonValue)
Creates and returns a web request which will simulate the submission of this form with a button with the specified name and value.
|
WebRequest | getRequest(String submitButtonName)
Creates and returns a web request which will simulate the submission of this form with a button with the specified name.
|
WebRequest | getRequest(SubmitButton button)
Creates and returns a web request which will simulate the submission of this form by pressing the specified button.
|
WebRequest | getRequest(SubmitButton button, int x, int y)
Creates and returns a web request which will simulate the submission of this form by pressing the specified button.
|
WebRequest | getRequest()
Creates and returns a web request which will simulate the submission of this form with an unnamed submit button.
|
ScriptableDelegate | getScriptableDelegate()
Returns the scriptable delegate. |
WebForm.Scriptable | getScriptableObject()
Returns an object which provides scripting access to this form.
|
SubmitButton | getSubmitButton(String name)
Returns the submit button defined in this form with the specified name.
|
SubmitButton | getSubmitButton(String name, String value)
Returns the submit button defined in this form with the specified name and value.
|
SubmitButton[] | getSubmitButtons()
Returns an array containing the submit buttons defined for this form.
|
SubmitButton | getSubmitButtonWithID(String ID)
Returns the submit button defined in this form with the specified ID.
|
boolean | hasParameterNamed(String soughtName)
Returns true if a parameter with given name exists in this form.
|
boolean | hasParameterStartingWithPrefix(String prefix)
Returns true if a parameter starting with a given name exists,
|
boolean | isDisabledParameter(String name)
Returns true if the named parameter is disabled. |
boolean | isFileParameter(String name)
Returns true if the named parameter accepts files for upload.
|
boolean | isHiddenParameter(String name)
Returns true if the named parameter is hidden. |
boolean | isMultiValuedParameter(String name)
Returns true if the named parameter accepts multiple values.
|
boolean | isReadOnlyParameter(String name)
Returns true if the named parameter is read-only. |
boolean | isSubmitAsMime()
Returns true if this form is to be submitted using mime encoding (the default is URL encoding).
|
boolean | isTextParameter(String name)
Returns true if the named parameter accepts free-form text.
|
WebRequest | newUnvalidatedRequest(SubmitButton button)
Creates and returns a web request which includes the specified button. |
WebRequest | newUnvalidatedRequest(SubmitButton button, int x, int y)
Creates and returns a web request which includes the specified button and position. |
WebRequest | newUnvalidatedRequest()
Creates and returns a web request based on the current state of this form. |
void | removeParameter(String name)
Removes a parameter name from this collection.
|
void | reset()
Resets all parameters to their initial values. |
void | setCheckbox(String name, boolean state)
Sets the value of the specified checkbox parameter. |
void | setCheckbox(String name, String value, boolean state)
Sets the value of the specified checkbox parameter. |
void | setParameter(String name, String value)
Sets the value of a parameter in this form.
|
void | setParameter(String name, String[] values)
Sets the multiple values of a parameter in this form. |
void | setParameter(String name, UploadFileSpec[] files)
Sets the multiple values of a file upload parameter in a web request.
|
void | setParameter(String name, File file)
Sets the single value of a file upload parameter in this form.
|
WebResponse | submit()
Submits this form using the web client from which it was originally obtained.
|
WebResponse | submit(SubmitButton button)
Submits this form using the web client from which it was originally obtained.
|
WebResponse | submit(SubmitButton button, int x, int y)
Submits this form using the web client from which it was originally obtained.
|
WebResponse | submitNoButton()
Submits this form using the web client from which it was originally obtained, ignoring any buttons defined for the form. |
protected WebResponse | submitRequest(String event, WebRequest request) |
void | toggleCheckbox(String name)
Toggles the value of the specified checkbox parameter. |
void | toggleCheckbox(String name, String value)
Toggles the value of the specified checkbox parameter. |
Parameters: name the name of the checkbox parameter state the new state of the checkbox
Throws: IllegalArgumentException if the specified parameter is not a checkbox or there is more than one control with that name.
Since: 1.5.4
Parameters: name the name of the checkbox parameter value of the checkbox parameter state the new state of the checkbox
Throws: IllegalArgumentException if the specified parameter is not a checkbox or if there is no checkbox with the specified name and value.
Since: 1.6
(String,UploadFileSpec[])
Since: 1.6
Since: 1.6
Since: 1.6
Parameters: name the name of the checkbox parameter
Throws: IllegalArgumentException if the specified parameter is not a checkbox or there is more than one control with that name.
Since: 1.5.4
Parameters: name the name of the checkbox parameter value of the checkbox parameter
Throws: IllegalArgumentException if the specified parameter is not a checkbox or if there is no checkbox with the specified name and value.
Since: 1.6