public class HtmlForm extends ClickableElement
HtmlElement.ChildElementsIterator, HtmlElement.MapEntryWrappingIterator
DomNode.ChildIterator, DomNode.DescendantElementsIterator
Modifier and Type | Field and Description |
---|---|
static String |
TAG_NAME
the HTML tag represented by this element
|
ATTRIBUTE_NOT_DEFINED, ATTRIBUTE_VALUE_EMPTY, TAB_INDEX_OUT_OF_BOUNDS
ATTRIBUTE_NODE, COMMENT_NODE, DOCUMENT_NODE, ELEMENT_NODE, PROPERTY_ELEMENT, READY_STATE_COMPLETE, READY_STATE_INTERACTIVE, READY_STATE_LOADED, READY_STATE_LOADING, READY_STATE_UNINITIALIZED, TEXT_NODE
Constructor and Description |
---|
HtmlForm(HtmlPage htmlPage,
Map attributes)
Deprecated.
You should not directly construct HtmlForm.
|
Modifier and Type | Method and Description |
---|---|
void |
fakeCheckedRadioButton(String name,
String value)
Deprecated.
after 1.11
|
String |
getAcceptAttribute()
Return the value of the attribute "accept".
|
String |
getAcceptCharsetAttribute()
Return the value of the attribute "accept-charset".
|
String |
getActionAttribute()
Return the value of the attribute "action".
|
HtmlButton |
getButtonByName(String name)
Find the first button element with the specified name.
|
List |
getButtonsByName(String name)
Return all the HtmlButtons that match the specified name
|
HtmlRadioButtonInput |
getCheckedRadioButton(String name)
Return the first checked radio button with the specified name.
|
String |
getEnctypeAttribute()
Return the value of the attribute "enctype".
|
HtmlInput |
getInputByName(String name)
Return the first input with the specified name
|
HtmlInput |
getInputByValue(String value)
Return the first input with the specified value.
|
List |
getInputsByName(String name)
Return the input tags that have the specified name
|
List |
getInputsByValue(String value)
Return all the inputs with the specified value.
|
String |
getMethodAttribute()
Return the value of the attribute "method".
|
String |
getNameAttribute()
Return the value of the attribute "name".
|
String |
getOnResetAttribute()
Return the value of the attribute "onreset".
|
String |
getOnSubmitAttribute()
Return the value of the attribute "onsubmit".
|
List |
getParameterListForSubmit(SubmittableElement submitElement)
Return a list of
KeyValuePair s that represent the data that will be
sent to the server on a form submit. |
HtmlRadioButtonInput |
getRadioButtonInput(String name,
String value)
Deprecated.
Deprecated because 'name' and 'value' are sometimes not unique to select a single
HtmlRadioButtonInput, it should not be called,
you can use
DomNode.getByXPath(String) instead. |
List |
getRadioButtonsByName(String name)
Return a list of HtmlInputs that are of type radio and match the specified name
|
HtmlSelect |
getSelectByName(String name)
Find the first select element with the specified name
|
List |
getSelectsByName(String name)
Return all the HtmlSelect that match the specified name
|
Collection |
getSubmittableElements(SubmittableElement submitElement)
Return a collection of elements that represent all the "submittable" elements in this form
|
String |
getTargetAttribute()
Return the value of the attribute "target".
|
HtmlTextArea |
getTextAreaByName(String name)
Find the first textarea element with the specified name.
|
List |
getTextAreasByName(String name)
Return all the HtmlTextAreas that match the specified name
|
Page |
reset()
Reset this form to its initial values.
|
void |
setActionAttribute(String action)
Set the value of the attribute "action".
|
void |
setCheckedRadioButton(String name,
String value)
Deprecated.
Deprecated because 'name' and 'value' are sometimes not unique to select a single
HtmlRadioButtonInput, it should not be called,
you can use
DomNode.getByXPath(String) instead. |
void |
setEnctypeAttribute(String encoding)
Set the value of the attribute "enctype".
|
void |
setMethodAttribute(String method)
Set the value of the attribute "method".
|
void |
setNameAttribute(String name)
Set the value of the attribute "name".
|
void |
setTargetAttribute(String target)
Set the value of the attribute "target".
|
Page |
submit()
Deprecated.
after 1.11, click on a specific
SubmittableElement instead. |
Page |
submit(String buttonName)
Deprecated.
after 1.11, click on the specific
SubmittableElement instead. |
Page |
submit(SubmittableElement submitElement)
INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
Submit this form to the appropriate server. |
click, click, click, dblClick, dblClick, doClickAction, getLangAttribute, getOnClickAttribute, getOnDblClickAttribute, getOnKeyDownAttribute, getOnKeyPressAttribute, getOnKeyUpAttribute, getOnMouseDownAttribute, getOnMouseMoveAttribute, getOnMouseOutAttribute, getOnMouseOverAttribute, getOnMouseUpAttribute, getTextDirectionAttribute, getXmlLangAttribute, isStateUpdateFirst
getClassAttribute, getIdAttribute, getStyleAttribute, getTitleAttribute, isRenderedVisible
addHtmlAttributeChangeListener, appendChildIfNoneExists, assertNotEmpty, blur, cloneDomNode, cloneNode, fireEvent, fireEvent, fireHtmlAttributeAdded, fireHtmlAttributeRemoved, fireHtmlAttributeReplaced, focus, getAttribute, getAttributeEntriesIterator, getAttributeNS, getAttributeValue, getChildElementsIterator, getEnclosingElement, getEnclosingForm, getEnclosingFormOrDie, getEventHandler, getHtmlElementById, getHtmlElementsByAttribute, getHtmlElementsByTagName, getHtmlElementsByTagNames, getId, getNodeName, getNodeType, getOneHtmlElementByAttribute, getTabIndex, getTagName, hasAttribute, hasAttributeNS, hasAttributes, hasHtmlElementWithId, isAttributeDefined, isEmptyXmlTagExpanded, isSubmittableByEnter, keyDown, keyDown, mouseDown, mouseDown, mouseMove, mouseMove, mouseOut, mouseOut, mouseOver, mouseOver, mouseUp, mouseUp, notImplemented, preventDefault, printOpeningTagContentAsXml, printXml, removeAttribute, removeAttributeNS, removeChild, removeEventHandler, removeHtmlAttributeChangeListener, rightClick, rightClick, setAttribute, setAttributeNS, setAttributeValue, setAttributeValue, setEventHandler, setEventHandler, setId, toString, type, type, type, type
getLocalName, getNamespaceURI, getPrefix, getQualifiedName, setPrefix
addDomChangeListener, addPropertyChangeListener, appendChild, appendDomChild, asText, asXml, fireNodeAdded, fireNodeDeleted, firePropertyChange, getAllHtmlChildElements, getByXPath, getChildIterator, getChildrenAsText, getEndColumnNumber, getEndLineNumber, getFirstByXPath, getFirstChild, getFirstDomChild, getLastChild, getLastDomChild, getLog, getNativePage, getNextDomSibling, getNextSibling, getNodeValue, getPage, getParentDomNode, getParentNode, getPreviousDomSibling, getPreviousSibling, getReadyState, getScriptObject, getStartColumnNumber, getStartLineNumber, insertBefore, isAncestorOf, isTrimmedText, notifyIncorrectness, onAddedToPage, onAllChildrenAddedToPage, printChildrenAsXml, reduceWhitespace, remove, removeAllChildren, removeDomChangeListener, removePropertyChangeListener, replace, setNextSibling, setNodeValue, setParentNode, setPreviousSibling, setReadyState, setScriptObject
public static final String TAG_NAME
public Page submit(String buttonName) throws IOException, ElementNotFoundException
SubmittableElement
instead.buttonName
- The name of a submit input element or a button element
which will be sent back up with the responseIOException
- If an IO error occursElementNotFoundException
- If a button with the specified name cannot be found.public Page submit() throws IOException
SubmittableElement
instead.IOException
- If an IO error occurspublic Page submit(SubmittableElement submitElement) throws IOException
submitElement
- The element that caused the submit to occurIOException
- If an IO error occurspublic final List getParameterListForSubmit(SubmittableElement submitElement)
KeyValuePair
s that represent the data that will be
sent to the server on a form submit. This is primarily intended to aid
debugging.submitElement
- The element that would have been pressed to submit the
form or null if the form was submitted by javascript.KeyValuePair
s.public Page reset()
public Collection getSubmittableElements(SubmittableElement submitElement)
submitElement
- The element that would have been pressed to submit the
form or null if the form was submitted by javascript.public List getInputsByName(String name)
name
- The name of the inputpublic final HtmlInput getInputByName(String name) throws ElementNotFoundException
name
- The name of the inputElementNotFoundException
- If no inputs could be found with the specified name.public HtmlRadioButtonInput getRadioButtonInput(String name, String value) throws ElementNotFoundException
DomNode.getByXPath(String)
instead.name
- The name of the HtmlInputvalue
- The value of the HtmlInputElementNotFoundException
- If the field could not be foundpublic List getSelectsByName(String name)
name
- The namepublic HtmlSelect getSelectByName(String name) throws ElementNotFoundException
name
- The name of the select elementElementNotFoundException
- If the select cannot be found.public List getButtonsByName(String name) throws ElementNotFoundException
name
- The nameElementNotFoundException
- If no matching buttons were foundpublic HtmlButton getButtonByName(String name) throws ElementNotFoundException
name
- The name of the button element.ElementNotFoundException
- If the button cannot be found.public List getTextAreasByName(String name)
name
- The namepublic HtmlTextArea getTextAreaByName(String name) throws ElementNotFoundException
name
- The name of the textarea element.ElementNotFoundException
- If the textarea cannot be found.public List getRadioButtonsByName(String name)
name
- The namepublic void setCheckedRadioButton(String name, String value) throws ElementNotFoundException
DomNode.getByXPath(String)
instead.fakeCheckedRadioButton(String,String)
insteadname
- The name of the radio buttonsvalue
- The value to matchElementNotFoundException
- If the specified element could not be foundpublic final void fakeCheckedRadioButton(String name, String value) throws ElementNotFoundException
name
- The name of the radio buttonsvalue
- The value to matchElementNotFoundException
- If a particular xml element could not be found in the dom modelpublic HtmlRadioButtonInput getCheckedRadioButton(String name)
name
- The name of the radio buttonpublic final String getActionAttribute()
public final void setActionAttribute(String action)
action
- The value of the attribute "action"public final String getMethodAttribute()
public final void setMethodAttribute(String method)
method
- The value of the attribute "method" or an empty string if that attribute isn't defined.public final String getNameAttribute()
public final void setNameAttribute(String name)
name
- the new valuepublic final String getEnctypeAttribute()
Enctype is the encoding type used when submitting a form back to the server
public final void setEnctypeAttribute(String encoding)
Enctype is the encoding type used when submitting a form back to the server
encoding
- The value of the attribute "enctype" or an empty string if that attribute isn't defined.public final String getOnSubmitAttribute()
public final String getOnResetAttribute()
public final String getAcceptAttribute()
public final String getAcceptCharsetAttribute()
public final String getTargetAttribute()
public final void setTargetAttribute(String target)
target
- The value of the attribute "target" or an empty string if that attribute isn't defined.public HtmlInput getInputByValue(String value) throws ElementNotFoundException
value
- The valueElementNotFoundException
- If no elements can be found with the specified value.Copyright © 2002-2012 Gargoyle Software Inc.. All Rights Reserved.