public interface InputElement extends FormControlElement
Provides access to the attributes of the input element.
Element.AlignTo
Modifier and Type | Method and Description |
---|---|
void |
check()
Sets the
checked attribute of the input DOM element with the type
'checkbox' or 'radio' to true . |
java.lang.String |
file()
Returns a string that represents an absolute or relative path to a file if the current
input DOM element has the type attribute with the 'file' value. |
void |
file(java.lang.String... filePaths)
Sets one or multiple string values that represent the path to a file.
|
java.util.Collection<java.lang.String> |
files()
Returns an immutable collection of the file paths if the input type is 'file' or an empty
collection if the input does not have a value.
|
boolean |
isCheckbox()
Returns
true if the DOM element's type attribute has the 'checkbox' value. |
boolean |
isChecked()
Returns
true if the input DOM element with the type 'checkbox' or
'radio' is selected. |
boolean |
isEmailField()
Returns
true if the DOM element's type attribute has the 'email' value. |
boolean |
isFile()
Returns
true if the DOM element's type attribute has the 'file' value. |
boolean |
isMultipleFile()
Returns
true if the input DOM element has both the type attribute
with the 'file' value, and the multiple attribute. |
boolean |
isPasswordField()
Returns
true if the DOM element's type attribute has the 'password' value. |
boolean |
isRadioButton()
Returns
true if the DOM element's type attribute has the 'radio' value. |
boolean |
isText()
Returns
true when isTextField() returns true and the type
attribute value of the input HTML element is 'number'. |
boolean |
isTextField()
Returns
true if the DOM element's type attribute has the 'text' value. |
void |
uncheck()
Sets the
checked attribute of the input DOM element with the type
'checkbox' or 'radio' to false . |
form, isEnabled, value, value
attributeNodes, attributes, attributeValue, blur, boundingClientRect, focus, hasAttribute, innerHtml, innerHtml, innerText, innerText, outerHtml, outerHtml, putAttribute, removeAttribute, scrollIntoView
appendChild, children, click, compareDocumentPosition, document, evaluate, evaluate, insertChild, nextSibling, nodeName, nodeValue, nodeValue, parent, previousSibling, removeChild, replaceChild, textContent, textContent, type, xPath
addEventListener, dispatch, eventListeners, removeEventListener
findElementByClassName, findElementByCssSelector, findElementById, findElementByName, findElementByTagName, findElementsByClassName, findElementsByCssSelector, findElementsById, findElementsByName, findElementsByTagName
boolean isText()
true
when isTextField()
returns true
and the type
attribute value of the input
HTML element is 'number'.ObjectClosedException
- when the document this instance belongs to is closedboolean isCheckbox()
true
if the DOM element's type
attribute has the 'checkbox' value.
When the return value is true, the checked state of the DOM element can be retrieved with the
isChecked()
method and changed with the check()
or uncheck()
methods.ObjectClosedException
- when the document this instance belongs to is closedboolean isRadioButton()
true
if the DOM element's type
attribute has the 'radio' value.ObjectClosedException
- when the document this instance belongs to is closedboolean isTextField()
true
if the DOM element's type
attribute has the 'text' value.ObjectClosedException
- when the document this instance belongs to is closedboolean isEmailField()
true
if the DOM element's type
attribute has the 'email' value.ObjectClosedException
- when the document this instance belongs to is closedboolean isPasswordField()
true
if the DOM element's type
attribute has the 'password' value.ObjectClosedException
- when the document this instance belongs to is closedboolean isFile()
true
if the DOM element's type
attribute has the 'file' value.ObjectClosedException
- when the document this instance belongs to is closedboolean isMultipleFile()
true
if the input
DOM element has both the type
attribute
with the 'file' value, and the multiple
attribute. For example: <input
type="file" multiple>
.ObjectClosedException
- when the document this instance belongs to is closedjava.lang.String file()
input
DOM element has the type
attribute with the 'file' value. If this DOM element
has the multiple
attribute, returns string that represents the first of file paths.
Returns an empty string if the element does not have a file selected.java.lang.IllegalStateException
- when the type attribute value of the element is not 'file'ObjectClosedException
- when the document this instance belongs to is closedvoid file(java.lang.String... filePaths)
input
DOM element with the type
has the 'file' value.filePaths
- the list of strings that represent the paths to the filesjava.lang.IllegalArgumentException
- when one or more elements of the filePaths
are empty
or blankjava.lang.IllegalStateException
- when the type attribute value of the element is not 'file'ObjectClosedException
- when the document this instance belongs to is closedjava.util.Collection<java.lang.String> files()
java.lang.IllegalStateException
- when the type attribute value of the element is not 'file'ObjectClosedException
- when the document this instance belongs to is closedboolean isChecked()
true
if the input
DOM element with the type
'checkbox' or
'radio' is selected. Use this method only with input
elements with type
'checkbox' or 'radio'.java.lang.IllegalStateException
- when the type attribute value of the element is not 'checkbox'
or 'radio'ObjectClosedException
- when the document this instance belongs to is closedvoid check()
checked
attribute of the input
DOM element with the type
'checkbox' or 'radio' to true
.java.lang.IllegalStateException
- when the type attribute value of the element is not 'checkbox'
or 'radio'ObjectClosedException
- when the document this instance belongs to is closedvoid uncheck()
checked
attribute of the input
DOM element with the type
'checkbox' or 'radio' to false
.java.lang.IllegalStateException
- when the type attribute value of the element is not 'checkbox'
or 'radio'ObjectClosedException
- when the document this instance belongs to is closed