public interface WebElementChecker extends TimeoutRelated<WebElementChecker>
The methods of this interface are checking a single WebElement instance. Each checker method returns with a boolean value.
The result is true, if the element fulfills some condition, and false if not.
Each checker method blocks the current thread until the element is accessible. (The only exception is the isPresent() method.)
This waiting has a timeout which can be specified with the TimeoutRelated.withTimeout(Enum) or TimeoutRelated.withTimeout(String)
method. If no timeout is specified then the default timeout will be used.
| Modifier and Type | Method and Description |
|---|---|
boolean |
hasAttribute(String name)
Does the element have a non-empty attribute with the given name?
|
boolean |
hasClassName()
Does the element have any class name?
|
boolean |
hasClassName(String className)
Does the element have the given class name?
|
boolean |
hasCssValue(String propertyName)
Does the element have CSS value with the given name?
|
boolean |
hasId()
Does the element have a non-empty "id" attribute?
|
boolean |
hasText()
Does the element have text?
|
boolean |
hasValue()
Does the element have value?
|
boolean |
isClickable()
Is the element clickable?
|
boolean |
isDisplayed()
Is the element displayed on the page?
|
boolean |
isEnabled()
Is the element enabled?
|
boolean |
isPresent()
Is the element attached to the DOM structure of the page?
|
boolean |
isReadonly()
Is the element read only?
|
boolean |
isSelected()
Is the element selected?
|
withTimeout, withTimeoutboolean isDisplayed()
Is the element displayed on the page?
This methods blocks the thread until the element is accessible or the time runs out.
true if the element is displayedboolean isEnabled()
Is the element enabled?
This methods blocks the thread until the element is accessible or the time runs out.
true if the element is enabledboolean isReadonly()
Is the element read only? Disabled elements are counted as read-only.
This methods blocks the thread until the element is accessible or the time runs out.
true if the element is read onlyboolean isClickable()
Is the element clickable? It means that the element should be displayed and enabled.
This methods blocks the thread until the element is accessible or the time runs out.
true if the element is clickableboolean isSelected()
Is the element selected? Only checkboxes, options in a select tag and radio buttons can be selected.
This methods blocks the thread until the element is accessible or the time runs out.
true if the element is selectedboolean isPresent()
Is the element attached to the DOM structure of the page?
true if the element is present in the DOMboolean hasId()
Does the element have a non-empty "id" attribute?
If the element's id contains only whitespaces, this method returns false.
This methods blocks the thread until the element is accessible or the time runs out.
true if the element has an idboolean hasText()
Does the element have text?
If the element's text is empty or contains only whitespaces, this method returns false.
This methods blocks the thread until the element is accessible or the time runs out.
true if the element has textboolean hasValue()
Does the element have value?
If the element's value is empty or contains only whitespaces, this method returns false.
This methods blocks the thread until the element is accessible or the time runs out.
true if the element has valueboolean hasAttribute(String name)
Does the element have a non-empty attribute with the given name?
If the element's attribute contains only whitespaces, this method returns false.
This methods blocks the thread until the element is accessible or the time runs out.
name - the name of the attributetrue if the element has the attributeboolean hasClassName()
Does the element have any class name?
This methods blocks the thread until the element is accessible or the time runs out.
true if the element has class nameboolean hasClassName(String className)
Does the element have the given class name?
This methods blocks the thread until the element is accessible or the time runs out.
className - the class nametrue if the element has the class nameboolean hasCssValue(String propertyName)
Does the element have CSS value with the given name?
If the CSS value is empty or contains only whitespaces, this method returns false.
This methods blocks the thread until the element is accessible or the time runs out.
propertyName - the name of the CSS propertytrue if the element has the CSS propertyCreated by Kornél Simon, 2022