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 Type Method Description booleancontainsOnlyText(java.lang.String value)Does this element exactly match given text?booleancontainsSelectOption(java.lang.String value)Does this dropdown contain the specified value.booleancontainsText(java.lang.String value)Does this element contain a given text?booleancontainsValue(java.lang.String value)Does this element contain a given value attribute?WebElementStateexpect(java.lang.String errorMessage)java.lang.StringgetSelectedValue()java.lang.StringgetSelectedVisibleTextValue()java.util.List<java.lang.String>getSelectOptions()java.lang.StringgetText()java.lang.StringgetTextValue()java.lang.StringgetValue()booleanhasFocus()Does this element currently have the focus.booleanisClickable()booleanisCurrentlyEnabled()booleanisCurrentlyVisible()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.booleanisDisabled()booleanisEnabled()booleanisPresent()booleanisSelected()booleanisVisible()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.voidshouldBeCurrentlyVisible()Checks whether a web element is visible.voidshouldBeEnabled()voidshouldBePresent()voidshouldBeVisible()Checks whether a web element is visible.voidshouldContainOnlyText(java.lang.String textValue)Check that an element exactly matches a text valuevoidshouldContainSelectedOption(java.lang.String textValue)voidshouldContainText(java.lang.String textValue)Check that an element contains a text valuevoidshouldNotBeCurrentlyVisible()Checks whether a web element is not visible straight away.voidshouldNotBeEnabled()voidshouldNotBePresent()voidshouldNotBeVisible()Checks whether a web element is not visible.voidshouldNotContainText(java.lang.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
void shouldBeVisible()Checks whether a web element is visible. Throws an AssertionError if the element is not rendered. -
shouldBeCurrentlyVisible
void shouldBeCurrentlyVisible()Checks whether a web element is visible. Throws an AssertionError if the element is not rendered. -
shouldNotBeVisible
void shouldNotBeVisible()Checks whether a web element is not visible. Throws an AssertionError if the element is not rendered. -
shouldNotBeCurrentlyVisible
void 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
boolean containsText(java.lang.String value)Does this element contain a given text? -
containsValue
boolean containsValue(java.lang.String value)Does this element contain a given value attribute? -
containsOnlyText
boolean containsOnlyText(java.lang.String value)Does this element exactly match given text? -
containsSelectOption
boolean containsSelectOption(java.lang.String value)Does this dropdown contain the specified value. -
shouldContainText
void shouldContainText(java.lang.String textValue)Check that an element contains a text value- Parameters:
textValue-
-
shouldContainOnlyText
void shouldContainOnlyText(java.lang.String textValue)Check that an element exactly matches a text value- Parameters:
textValue-
-
shouldContainSelectedOption
void shouldContainSelectedOption(java.lang.String textValue) -
shouldNotContainText
void shouldNotContainText(java.lang.String textValue)Check that an element does not contain a text value- Parameters:
textValue-
-
shouldBeEnabled
void shouldBeEnabled() -
isEnabled
boolean isEnabled() -
isDisabled
boolean isDisabled() -
shouldNotBeEnabled
void shouldNotBeEnabled() -
getSelectedVisibleTextValue
java.lang.String getSelectedVisibleTextValue() -
getSelectedValue
java.lang.String getSelectedValue() -
getSelectOptions
java.util.List<java.lang.String> getSelectOptions() -
isPresent
boolean isPresent() -
shouldBePresent
void shouldBePresent() -
shouldNotBePresent
void shouldNotBePresent() -
isSelected
boolean isSelected() -
getTextValue
java.lang.String getTextValue() -
getValue
java.lang.String getValue() -
getText
java.lang.String getText() -
expect
-
isClickable
boolean isClickable()
-