|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.meterware.httpunit.ParameterHolder
com.meterware.httpunit.WebRequestSource
com.meterware.httpunit.WebForm
This class represents a form in an HTML page. Users of this class may examine the parameters
defined for the form, the structure of the form (as a DOM), or the text of the form. They
may also create a WebRequest
to simulate the submission of the form.
Nested Class Summary | |
class |
WebForm.Scriptable
|
Field Summary | |
static HTMLElementPredicate |
MATCH_NAME
Predicate to match a link's name. |
Method Summary | |
protected void |
addPresetParameter(java.lang.String name,
java.lang.String value)
Records a parameter defined by including it in the destination URL. |
java.lang.String |
getAction()
Returns the action defined for this form. |
Button |
getButton(HTMLElementPredicate predicate,
java.lang.Object criteria)
|
Button[] |
getButtons()
Returns an array containing all of the buttons defined for this form. |
Button |
getButtonWithID(java.lang.String buttonID)
Convenience method which returns the button with the specified ID. |
java.lang.String |
getCharacterSet()
Returns the character set encoding for this form. |
protected java.lang.String |
getEmptyParameterValue()
|
java.lang.String |
getMethod()
Returns the method defined for this form. |
int |
getNumTextParameters(java.lang.String name)
Returns the number of text parameters in this form with the specified name. |
java.lang.String[] |
getOptions(java.lang.String name)
Returns the displayed options defined for the specified parameter name. |
java.lang.String[] |
getOptionValues(java.lang.String name)
Returns the option values defined for the specified parameter name. |
java.lang.String[] |
getParameterNames()
Returns an array containing the names of the parameters defined for this form. |
java.lang.String |
getParameterValue(java.lang.String name)
Returns the default value of the named parameter. |
java.lang.String[] |
getParameterValues(java.lang.String name)
Returns the multiple default values of the named parameter. |
WebRequest |
getRequest()
Creates and returns a web request which will simulate the submission of this form with an unnamed submit button. |
WebRequest |
getRequest(java.lang.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(java.lang.String submitButtonName,
java.lang.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(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. |
com.meterware.httpunit.scripting.ScriptableDelegate |
getScriptableDelegate()
Returns the scriptable delegate. |
WebForm.Scriptable |
getScriptableObject()
Returns an object which provides scripting access to this form. |
SubmitButton |
getSubmitButton(java.lang.String name)
Returns the submit button defined in this form with the specified name. |
SubmitButton |
getSubmitButton(java.lang.String name,
java.lang.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(java.lang.String ID)
Returns the submit button defined in this form with the specified ID. |
boolean |
hasParameterNamed(java.lang.String soughtName)
Returns true if a parameter with given name exists in this form. |
boolean |
hasParameterStartingWithPrefix(java.lang.String prefix)
Returns true if a parameter starting with a given name exists, |
boolean |
isDisabledParameter(java.lang.String name)
Returns true if the named parameter is disabled. |
boolean |
isFileParameter(java.lang.String name)
Returns true if the named parameter accepts files for upload. |
boolean |
isHiddenParameter(java.lang.String name)
Returns true if the named parameter is hidden. |
boolean |
isMultiValuedParameter(java.lang.String name)
Returns true if the named parameter accepts multiple values. |
boolean |
isReadOnlyParameter(java.lang.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(java.lang.String name)
Returns true if the named parameter accepts free-form text. |
void |
removeParameter(java.lang.String name)
Removes a parameter name from this collection. |
void |
reset()
Resets all parameters to their initial values. |
void |
selectImageButtonPosition(SubmitButton imageButton,
int x,
int y)
Specifies the position at which an image button (if any) was clicked. |
void |
setCheckbox(java.lang.String name,
boolean state)
Sets the value of the specified checkbox parameter. |
void |
setParameter(java.lang.String name,
java.lang.String value)
Sets the value of a parameter in this form. |
void |
setParameter(java.lang.String name,
java.lang.String[] values)
|
void |
setParameter(java.lang.String name,
UploadFileSpec[] files)
Sets the multiple values of a file upload parameter in a web request. |
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. |
void |
toggleCheckbox(java.lang.String name)
Toggles the value of the specified checkbox parameter. |
Methods inherited from class com.meterware.httpunit.WebRequestSource |
getBaseResponse, getBaseURL, getClassName, getCurrentFrameContents, getDestination, getDOMSubtree, getFragmentIdentifier, getHTMLPage, getID, getName, getNode, getPageFrame, getRelativeURL, getTarget, getTitle, loadDestinationParameters, setDestination, setTargetAttribute, submitRequest, submitRequest |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final HTMLElementPredicate MATCH_NAME
Method Detail |
public WebResponse submit() throws java.io.IOException, org.xml.sax.SAXException
java.io.IOException
org.xml.sax.SAXException
public WebResponse submit(SubmitButton button) throws java.io.IOException, org.xml.sax.SAXException
java.io.IOException
org.xml.sax.SAXException
public java.lang.String getMethod()
public java.lang.String getAction()
public boolean hasParameterNamed(java.lang.String soughtName)
public boolean hasParameterStartingWithPrefix(java.lang.String prefix)
public Button[] getButtons()
public Button getButton(HTMLElementPredicate predicate, java.lang.Object criteria)
public Button getButtonWithID(java.lang.String buttonID)
public SubmitButton[] getSubmitButtons()
public SubmitButton getSubmitButton(java.lang.String name)
public SubmitButton getSubmitButton(java.lang.String name, java.lang.String value)
public SubmitButton getSubmitButtonWithID(java.lang.String ID)
public WebRequest getRequest(java.lang.String submitButtonName, java.lang.String submitButtonValue)
public WebRequest getRequest(java.lang.String submitButtonName)
public WebRequest getRequest(SubmitButton button)
public WebRequest getRequest(SubmitButton button, int x, int y)
public java.lang.String getParameterValue(java.lang.String name)
public java.lang.String[] getOptions(java.lang.String name)
public java.lang.String[] getOptionValues(java.lang.String name)
public boolean isMultiValuedParameter(java.lang.String name)
public int getNumTextParameters(java.lang.String name)
public boolean isTextParameter(java.lang.String name)
public boolean isSubmitAsMime()
public void reset()
public WebForm.Scriptable getScriptableObject()
public java.lang.String getCharacterSet()
public boolean isFileParameter(java.lang.String name)
public java.lang.String[] getParameterNames()
getParameterNames
in class WebRequestSource
public java.lang.String[] getParameterValues(java.lang.String name)
getParameterValues
in class WebRequestSource
public boolean isReadOnlyParameter(java.lang.String name)
public boolean isDisabledParameter(java.lang.String name)
public boolean isHiddenParameter(java.lang.String name)
public WebRequest getRequest()
getRequest
in class WebRequestSource
public com.meterware.httpunit.scripting.ScriptableDelegate getScriptableDelegate()
protected void addPresetParameter(java.lang.String name, java.lang.String value)
addPresetParameter
in class WebRequestSource
protected java.lang.String getEmptyParameterValue()
getEmptyParameterValue
in class WebRequestSource
public void selectImageButtonPosition(SubmitButton imageButton, int x, int y)
public void removeParameter(java.lang.String name)
public void setParameter(java.lang.String name, UploadFileSpec[] files)
public void setParameter(java.lang.String name, java.lang.String value)
public void setParameter(java.lang.String name, java.lang.String[] values)
public void toggleCheckbox(java.lang.String name)
name
- the name of the checkbox parameter
java.lang.IllegalArgumentException
- if the specified parameter is not a checkbox or there is more than one
control with that name.public void setCheckbox(java.lang.String name, boolean state)
name
- the name of the checkbox parameterstate
- the new state of the checkbox
java.lang.IllegalArgumentException
- if the specified parameter is not a checkbox or there is more than one
control with that name.
|
Copyright © 2000-2003 Russell Gold. See license agreement for rights granted. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |