Package net.serenitybdd.core.pages
Interface WebElementState
- All Known Subinterfaces:
WebElementFacade
,WebElementFacade
,WebElementState
,WidgetObject
- All Known Implementing Classes:
WebElementFacadeImpl
,WebElementFacadeImpl
,WebElementFacadeStub
,WidgetObjectImpl
,WrappedWebElementFacadeImpl
public interface WebElementState
This interface is a way of presenting state information about a web element without exposing (too much) of the
WebDriver API.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
containsOnlyText
(String value) Does this element exactly match given text?boolean
containsSelectOption
(String value) Does this dropdown contain the specified value.boolean
containsText
(String value) Does this element contain a given text?boolean
containsValue
(String value) Does this element contain a given value attribute?getAttribute
(String name) getText()
getValue()
boolean
hasFocus()
Does this element currently have the focus.boolean
boolean
boolean
Is this web element present and visible on the screen This method will not throw an exception if the element is not on the screen at all.boolean
boolean
boolean
boolean
boolean
Is this web element present and visible on the screen This method will not throw an exception if the element is not on the screen at all.Checks whether a web element is visible.Checks whether a web element is visible.shouldContainOnlyText
(String textValue) Check that an element exactly matches a text valueshouldContainSelectedOption
(String textValue) shouldContainText
(String textValue) Check that an element contains a text valueChecks whether a web element is not visible straight away.Checks whether a web element is not visible.shouldNotContainText
(String textValue) Check that an element does not contain a text value
-
Method Details
-
isVisible
boolean isVisible()Is this web element present and visible on the screen This method will not throw an exception if the element is not on the screen at all. If the element is not visible, the method will wait a bit to see if it appears later on. -
isCurrentlyVisible
boolean isCurrentlyVisible()Is this web element present and visible on the screen This method will not throw an exception if the element is not on the screen at all. The method will fail immediately if the element is not visible on the screen. There is a little black magic going on here - the web element class will detect if it is being called by a method called "isCurrently*" and, if so, fail immediately without waiting as it would normally do. -
isCurrentlyEnabled
boolean isCurrentlyEnabled() -
shouldBeVisible
WebElementState shouldBeVisible()Checks whether a web element is visible. Throws an AssertionError if the element is not rendered. -
shouldBeCurrentlyVisible
WebElementState shouldBeCurrentlyVisible()Checks whether a web element is visible. Throws an AssertionError if the element is not rendered. -
shouldNotBeVisible
WebElementState shouldNotBeVisible()Checks whether a web element is not visible. Throws an AssertionError if the element is not rendered. -
shouldNotBeCurrentlyVisible
WebElementState shouldNotBeCurrentlyVisible()Checks whether a web element is not visible straight away. Throws an AssertionError if the element is not rendered. -
hasFocus
boolean hasFocus()Does this element currently have the focus. -
containsText
Does this element contain a given text? -
containsValue
Does this element contain a given value attribute? -
containsOnlyText
Does this element exactly match given text? -
containsSelectOption
Does this dropdown contain the specified value. -
shouldContainText
Check that an element contains a text value- Parameters:
textValue
-
-
shouldContainOnlyText
Check that an element exactly matches a text value- Parameters:
textValue
-
-
shouldContainSelectedOption
-
shouldNotContainText
Check that an element does not contain a text value- Parameters:
textValue
-
-
shouldBeEnabled
WebElementState shouldBeEnabled() -
isEnabled
boolean isEnabled() -
isDisabled
boolean isDisabled() -
shouldNotBeEnabled
WebElementState shouldNotBeEnabled() -
getSelectedVisibleTextValue
String getSelectedVisibleTextValue() -
getSelectedVisibleTexts
-
getSelectedValue
String getSelectedValue() -
getSelectedValues
-
getSelectOptions
-
isPresent
boolean isPresent() -
shouldBePresent
WebElementState shouldBePresent() -
shouldNotBePresent
WebElementState shouldNotBePresent() -
isSelected
boolean isSelected() -
getTextValue
String getTextValue() -
getValue
String getValue() -
getText
String getText() -
getAttribute
-
expect
-
isClickable
boolean isClickable()
-