Class WebElementFacadeStub
java.lang.Object
net.thucydides.core.webdriver.stubs.WebElementFacadeStub
- All Implemented Interfaces:
io.appium.java_client.FindsByAccessibilityId
,io.appium.java_client.FindsByAndroidUIAutomator
,io.appium.java_client.FindsByFluentSelector
,WebElementFacade
,WebElementState
,ConfigurableTimeouts
,org.openqa.selenium.interactions.Locatable
,org.openqa.selenium.SearchContext
,org.openqa.selenium.TakesScreenshot
,org.openqa.selenium.WebElement
,org.openqa.selenium.WrapsElement
public class WebElementFacadeStub extends java.lang.Object implements WebElementFacade
-
Constructor Summary
Constructors Constructor Description WebElementFacadeStub()
-
Method Summary
Modifier and Type Method Description WebElementFacade
and()
Convenience method to chain method calls more fluently.void
clear()
void
click()
Wait for an element to be visible and enabled, and then click on it.void
click(ClickStrategy clickStrategy)
boolean
containsElements(java.lang.String xpathOrCssSelector)
boolean
containsElements(org.openqa.selenium.By selector)
boolean
containsOnlyText(java.lang.String value)
Does this element exactly match given text?boolean
containsSelectOption(java.lang.String value)
Does this dropdown contain the specified value.boolean
containsText(java.lang.String value)
Does this element contain a given text?boolean
containsValue(java.lang.String value)
Does this element contain a given value attribute?FluentDropdownDeselect
deselect()
WebElementFacade
deselectAll()
WebElementFacade
deselectByIndex(int indexValue)
WebElementFacade
deselectByValue(java.lang.String value)
WebElementFacade
deselectByVisibleText(java.lang.String label)
WebElementState
expect(java.lang.String errorMessage)
protected WebElementState
expectingErrorMessage(java.lang.String errorMessage)
WebElementFacade
find(org.openqa.selenium.By bySelector)
WebElementFacade
findBy(java.lang.String xpathOrCssSelector)
WebElementFacade
findBy(java.lang.String xpathOrCssSelector, java.lang.Object... arguments)
WebElementFacade
findBy(org.openqa.selenium.By selector)
org.openqa.selenium.WebElement
findElement(java.lang.String by, java.lang.String using)
org.openqa.selenium.WebElement
findElement(org.openqa.selenium.By by)
org.openqa.selenium.WebElement
findElementByAccessibilityId(java.lang.String using)
org.openqa.selenium.WebElement
findElementByAndroidUIAutomator(java.lang.String using)
java.util.List
findElements(java.lang.String by, java.lang.String using)
java.util.List<org.openqa.selenium.WebElement>
findElements(org.openqa.selenium.By by)
java.util.List<org.openqa.selenium.WebElement>
findElementsByAccessibilityId(java.lang.String using)
java.util.List<org.openqa.selenium.WebElement>
findElementsByAndroidUIAutomator(java.lang.String using)
java.lang.String
getAttribute(java.lang.String name)
org.openqa.selenium.interactions.Coordinates
getCoordinates()
java.lang.String
getCssValue(java.lang.String propertyName)
java.time.Duration
getCurrentImplicitTimeout()
org.openqa.selenium.WebElement
getElement()
java.lang.String
getFirstSelectedOptionValue()
java.lang.String
getFirstSelectedOptionVisibleText()
long
getImplicitTimeoutInMilliseconds()
org.openqa.selenium.Point
getLocation()
org.openqa.selenium.Rectangle
getRect()
<X> X
getScreenshotAs(org.openqa.selenium.OutputType<X> target)
java.lang.String
getSelectedValue()
java.util.List<java.lang.String>
getSelectedValues()
java.util.List<java.lang.String>
getSelectedVisibleTexts()
java.lang.String
getSelectedVisibleTextValue()
java.util.List<java.lang.String>
getSelectOptions()
org.openqa.selenium.Dimension
getSize()
java.lang.String
getTagName()
java.lang.String
getText()
java.lang.String
getTextContent()
java.lang.String
getTextValue()
java.lang.String
getValue()
org.openqa.selenium.WebElement
getWrappedElement()
boolean
hasClass(java.lang.String cssClassName)
boolean
hasFocus()
Does this element currently have the focus.boolean
isClickable()
boolean
isCurrentlyEnabled()
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.boolean
isDisabled()
boolean
isDisplayed()
boolean
isEnabled()
boolean
isPresent()
boolean
isSelected()
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.java.time.Duration
resetTimeouts()
FluentDropdownSelect
select()
WebElementFacade
selectByIndex(int indexValue)
WebElementFacade
selectByValue(java.lang.String value)
WebElementFacade
selectByVisibleText(java.lang.String label)
void
sendKeys(java.lang.CharSequence... keysToSend)
void
setImplicitTimeout(java.time.Duration implicitTimeout)
void
setWindowFocus()
void
shouldBeCurrentlyVisible()
Checks whether a web element is visible.void
shouldBeEnabled()
void
shouldBePresent()
void
shouldBeVisible()
Checks whether a web element is visible.void
shouldContainElements(java.lang.String xpathOrCssSelector)
void
shouldContainElements(org.openqa.selenium.By selector)
void
shouldContainOnlyText(java.lang.String textValue)
Check that an element exactly matches a text valuevoid
shouldContainSelectedOption(java.lang.String textValue)
void
shouldContainText(java.lang.String textValue)
Check that an element contains a text valuevoid
shouldNotBeCurrentlyVisible()
Checks whether a web element is not visible straight away.void
shouldNotBeEnabled()
void
shouldNotBePresent()
void
shouldNotBeVisible()
Checks whether a web element is not visible.void
shouldNotContainText(java.lang.String textValue)
Check that an element does not contain a text valuevoid
submit()
WebElementFacade
then()
Convenience method to chain method calls more fluently.WebElementFacade
then(java.lang.String xpathOrCssSelector)
WebElementFacade
then(java.lang.String xpathOrCssSelector, java.lang.Object... arguments)
WebElementFacade
then(org.openqa.selenium.By bySelector)
WebElementFacade
thenFind(java.lang.String xpathOrCssSelector)
WebElementFacade
thenFind(java.lang.String xpathOrCssSelector, java.lang.Object... arguments)
ListOfWebElementFacades
thenFindAll(java.lang.String xpathOrCssSelector)
ListOfWebElementFacades
thenFindAll(java.lang.String xpathOrCssSelector, java.lang.Object... arguments)
ListOfWebElementFacades
thenFindAll(org.openqa.selenium.By selector)
java.lang.String
toString()
WebElementFacade
type(java.lang.CharSequence... keysToSend)
Type a value into a field, making sure that the field is empty first.WebElementFacade
typeAndEnter(java.lang.String value)
Type a value into a field and then press Enter, making sure that the field is empty first.WebElementFacade
typeAndTab(java.lang.String value)
Type a value into a field and then press TAB, making sure that the field is empty first.org.openqa.selenium.support.ui.Wait<org.openqa.selenium.WebDriver>
waitForCondition()
WebElementFacade
waitUntilClickable()
WebElementFacade
waitUntilDisabled()
WebElementFacade
waitUntilEnabled()
WebElementFacade
waitUntilNotVisible()
WebElementFacade
waitUntilPresent()
WebElementFacade
waitUntilVisible()
WebElementFacade
withTimeoutOf(int timeout, java.time.temporal.TemporalUnit unit)
WebElementFacade
withTimeoutOf(int timeout, java.util.concurrent.TimeUnit unit)
WebElementFacade
withTimeoutOf(java.time.Duration duration)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
WebElementFacadeStub
public WebElementFacadeStub()
-
-
Method Details
-
getElement
public org.openqa.selenium.WebElement getElement()- Specified by:
getElement
in interfaceWebElementFacade
-
then
- Specified by:
then
in interfaceWebElementFacade
-
thenFind
- Specified by:
thenFind
in interfaceWebElementFacade
-
thenFind
public WebElementFacade thenFind(java.lang.String xpathOrCssSelector, java.lang.Object... arguments)- Specified by:
thenFind
in interfaceWebElementFacade
-
then
- Specified by:
then
in interfaceWebElementFacade
-
findBy
- Specified by:
findBy
in interfaceWebElementFacade
-
findBy
- Specified by:
findBy
in interfaceWebElementFacade
-
thenFindAll
- Specified by:
thenFindAll
in interfaceWebElementFacade
-
thenFindAll
public ListOfWebElementFacades thenFindAll(java.lang.String xpathOrCssSelector, java.lang.Object... arguments)- Specified by:
thenFindAll
in interfaceWebElementFacade
-
findBy
- Specified by:
findBy
in interfaceWebElementFacade
-
find
- Specified by:
find
in interfaceWebElementFacade
-
then
- Specified by:
then
in interfaceWebElementFacade
-
getAttribute
public java.lang.String getAttribute(java.lang.String name)- Specified by:
getAttribute
in interfaceorg.openqa.selenium.WebElement
- Specified by:
getAttribute
in interfaceWebElementFacade
-
thenFindAll
- Specified by:
thenFindAll
in interfaceWebElementFacade
-
getImplicitTimeoutInMilliseconds
public long getImplicitTimeoutInMilliseconds()- Specified by:
getImplicitTimeoutInMilliseconds
in interfaceWebElementFacade
-
withTimeoutOf
- Specified by:
withTimeoutOf
in interfaceWebElementFacade
-
withTimeoutOf
- Specified by:
withTimeoutOf
in interfaceWebElementFacade
-
withTimeoutOf
- Specified by:
withTimeoutOf
in interfaceWebElementFacade
-
isVisible
public 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.- Specified by:
isVisible
in interfaceWebElementState
-
and
Convenience method to chain method calls more fluently.- Specified by:
and
in interfaceWebElementFacade
-
then
Convenience method to chain method calls more fluently.- Specified by:
then
in interfaceWebElementFacade
-
isCurrentlyVisible
public 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.- Specified by:
isCurrentlyVisible
in interfaceWebElementState
-
isCurrentlyEnabled
public boolean isCurrentlyEnabled()- Specified by:
isCurrentlyEnabled
in interfaceWebElementState
-
shouldBeVisible
public void shouldBeVisible()Checks whether a web element is visible. Throws an AssertionError if the element is not rendered.- Specified by:
shouldBeVisible
in interfaceWebElementState
-
shouldBeCurrentlyVisible
public void shouldBeCurrentlyVisible()Checks whether a web element is visible. Throws an AssertionError if the element is not rendered.- Specified by:
shouldBeCurrentlyVisible
in interfaceWebElementState
-
shouldNotBeVisible
public void shouldNotBeVisible()Checks whether a web element is not visible. Throws an AssertionError if the element is not rendered.- Specified by:
shouldNotBeVisible
in interfaceWebElementState
-
shouldNotBeCurrentlyVisible
public void shouldNotBeCurrentlyVisible()Checks whether a web element is not visible straight away. Throws an AssertionError if the element is not rendered.- Specified by:
shouldNotBeCurrentlyVisible
in interfaceWebElementState
-
hasFocus
public boolean hasFocus()Does this element currently have the focus.- Specified by:
hasFocus
in interfaceWebElementState
-
containsText
public boolean containsText(java.lang.String value)Does this element contain a given text?- Specified by:
containsText
in interfaceWebElementState
-
containsValue
public boolean containsValue(java.lang.String value)Description copied from interface:WebElementState
Does this element contain a given value attribute?- Specified by:
containsValue
in interfaceWebElementState
-
containsOnlyText
public boolean containsOnlyText(java.lang.String value)Does this element exactly match given text?- Specified by:
containsOnlyText
in interfaceWebElementState
-
containsSelectOption
public boolean containsSelectOption(java.lang.String value)Does this dropdown contain the specified value.- Specified by:
containsSelectOption
in interfaceWebElementState
-
getSelectOptions
public java.util.List<java.lang.String> getSelectOptions()- Specified by:
getSelectOptions
in interfaceWebElementFacade
- Specified by:
getSelectOptions
in interfaceWebElementState
-
getFirstSelectedOptionVisibleText
public java.lang.String getFirstSelectedOptionVisibleText()- Specified by:
getFirstSelectedOptionVisibleText
in interfaceWebElementFacade
-
getSelectedVisibleTexts
public java.util.List<java.lang.String> getSelectedVisibleTexts()- Specified by:
getSelectedVisibleTexts
in interfaceWebElementFacade
-
getFirstSelectedOptionValue
public java.lang.String getFirstSelectedOptionValue()- Specified by:
getFirstSelectedOptionValue
in interfaceWebElementFacade
-
getSelectedValues
public java.util.List<java.lang.String> getSelectedValues()- Specified by:
getSelectedValues
in interfaceWebElementFacade
-
shouldContainText
public void shouldContainText(java.lang.String textValue)Check that an element contains a text value- Specified by:
shouldContainText
in interfaceWebElementState
- Parameters:
textValue
-
-
shouldContainOnlyText
public void shouldContainOnlyText(java.lang.String textValue)Check that an element exactly matches a text value- Specified by:
shouldContainOnlyText
in interfaceWebElementState
- Parameters:
textValue
-
-
shouldContainSelectedOption
public void shouldContainSelectedOption(java.lang.String textValue)- Specified by:
shouldContainSelectedOption
in interfaceWebElementState
-
shouldNotContainText
public void shouldNotContainText(java.lang.String textValue)Check that an element does not contain a text value- Specified by:
shouldNotContainText
in interfaceWebElementState
- Parameters:
textValue
-
-
shouldBeEnabled
public void shouldBeEnabled()- Specified by:
shouldBeEnabled
in interfaceWebElementState
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabled
in interfaceorg.openqa.selenium.WebElement
- Specified by:
isEnabled
in interfaceWebElementState
-
shouldNotBeEnabled
public void shouldNotBeEnabled()- Specified by:
shouldNotBeEnabled
in interfaceWebElementState
-
type
Type a value into a field, making sure that the field is empty first.- Specified by:
type
in interfaceWebElementFacade
- Parameters:
keysToSend
-
-
typeAndEnter
Type a value into a field and then press Enter, making sure that the field is empty first.- Specified by:
typeAndEnter
in interfaceWebElementFacade
- Parameters:
value
-
-
typeAndTab
Type a value into a field and then press TAB, making sure that the field is empty first. This currently is not supported by all browsers, notably Firefox.- Specified by:
typeAndTab
in interfaceWebElementFacade
- Parameters:
value
-
-
setWindowFocus
public void setWindowFocus()- Specified by:
setWindowFocus
in interfaceWebElementFacade
-
select
- Specified by:
select
in interfaceWebElementFacade
-
deselect
- Specified by:
deselect
in interfaceWebElementFacade
-
deselectAll
- Specified by:
deselectAll
in interfaceWebElementFacade
-
deselectByVisibleText
- Specified by:
deselectByVisibleText
in interfaceWebElementFacade
-
deselectByValue
- Specified by:
deselectByValue
in interfaceWebElementFacade
-
deselectByIndex
- Specified by:
deselectByIndex
in interfaceWebElementFacade
-
selectByVisibleText
- Specified by:
selectByVisibleText
in interfaceWebElementFacade
-
getSelectedVisibleTextValue
public java.lang.String getSelectedVisibleTextValue()- Specified by:
getSelectedVisibleTextValue
in interfaceWebElementState
-
selectByValue
- Specified by:
selectByValue
in interfaceWebElementFacade
-
getSelectedValue
public java.lang.String getSelectedValue()- Specified by:
getSelectedValue
in interfaceWebElementState
-
selectByIndex
- Specified by:
selectByIndex
in interfaceWebElementFacade
-
isPresent
public boolean isPresent()- Specified by:
isPresent
in interfaceWebElementState
-
shouldBePresent
public void shouldBePresent()- Specified by:
shouldBePresent
in interfaceWebElementState
-
shouldNotBePresent
public void shouldNotBePresent()- Specified by:
shouldNotBePresent
in interfaceWebElementState
-
waitUntilVisible
- Specified by:
waitUntilVisible
in interfaceWebElementFacade
-
waitUntilPresent
- Specified by:
waitUntilPresent
in interfaceWebElementFacade
-
waitForCondition
public org.openqa.selenium.support.ui.Wait<org.openqa.selenium.WebDriver> waitForCondition()- Specified by:
waitForCondition
in interfaceWebElementFacade
-
waitUntilNotVisible
- Specified by:
waitUntilNotVisible
in interfaceWebElementFacade
-
getValue
public java.lang.String getValue()- Specified by:
getValue
in interfaceWebElementFacade
- Specified by:
getValue
in interfaceWebElementState
-
isSelected
public boolean isSelected()- Specified by:
isSelected
in interfaceorg.openqa.selenium.WebElement
- Specified by:
isSelected
in interfaceWebElementState
-
getText
public java.lang.String getText()- Specified by:
getText
in interfaceorg.openqa.selenium.WebElement
- Specified by:
getText
in interfaceWebElementFacade
- Specified by:
getText
in interfaceWebElementState
-
getTextContent
public java.lang.String getTextContent()- Specified by:
getTextContent
in interfaceWebElementFacade
-
isDisabled
public boolean isDisabled()- Specified by:
isDisabled
in interfaceWebElementFacade
- Specified by:
isDisabled
in interfaceWebElementState
-
waitUntilClickable
- Specified by:
waitUntilClickable
in interfaceWebElementFacade
-
waitUntilEnabled
- Specified by:
waitUntilEnabled
in interfaceWebElementFacade
-
waitUntilDisabled
- Specified by:
waitUntilDisabled
in interfaceWebElementFacade
-
getTextValue
public java.lang.String getTextValue()- Specified by:
getTextValue
in interfaceWebElementState
-
expect
- Specified by:
expect
in interfaceWebElementState
-
isClickable
public boolean isClickable()- Specified by:
isClickable
in interfaceWebElementState
-
expectingErrorMessage
-
click
public void click()Wait for an element to be visible and enabled, and then click on it.- Specified by:
click
in interfaceorg.openqa.selenium.WebElement
- Specified by:
click
in interfaceWebElementFacade
-
click
- Specified by:
click
in interfaceWebElementFacade
-
clear
public void clear()- Specified by:
clear
in interfaceorg.openqa.selenium.WebElement
- Specified by:
clear
in interfaceWebElementFacade
-
toString
public java.lang.String toString()- Specified by:
toString
in interfaceWebElementFacade
- Overrides:
toString
in classjava.lang.Object
-
submit
public void submit()- Specified by:
submit
in interfaceorg.openqa.selenium.WebElement
-
sendKeys
public void sendKeys(java.lang.CharSequence... keysToSend)- Specified by:
sendKeys
in interfaceorg.openqa.selenium.WebElement
-
getTagName
public java.lang.String getTagName()- Specified by:
getTagName
in interfaceorg.openqa.selenium.WebElement
-
findElements
public java.util.List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.By by)- Specified by:
findElements
in interfaceorg.openqa.selenium.SearchContext
- Specified by:
findElements
in interfaceorg.openqa.selenium.WebElement
-
findElement
public org.openqa.selenium.WebElement findElement(org.openqa.selenium.By by)- Specified by:
findElement
in interfaceorg.openqa.selenium.SearchContext
- Specified by:
findElement
in interfaceorg.openqa.selenium.WebElement
-
findElement
public org.openqa.selenium.WebElement findElement(java.lang.String by, java.lang.String using)- Specified by:
findElement
in interfaceio.appium.java_client.FindsByFluentSelector
-
findElements
public java.util.List findElements(java.lang.String by, java.lang.String using)- Specified by:
findElements
in interfaceio.appium.java_client.FindsByFluentSelector
-
isDisplayed
public boolean isDisplayed()- Specified by:
isDisplayed
in interfaceorg.openqa.selenium.WebElement
-
getLocation
public org.openqa.selenium.Point getLocation()- Specified by:
getLocation
in interfaceorg.openqa.selenium.WebElement
-
getSize
public org.openqa.selenium.Dimension getSize()- Specified by:
getSize
in interfaceorg.openqa.selenium.WebElement
-
getRect
public org.openqa.selenium.Rectangle getRect()- Specified by:
getRect
in interfaceorg.openqa.selenium.WebElement
-
getCssValue
public java.lang.String getCssValue(java.lang.String propertyName)- Specified by:
getCssValue
in interfaceorg.openqa.selenium.WebElement
-
getWrappedElement
public org.openqa.selenium.WebElement getWrappedElement()- Specified by:
getWrappedElement
in interfaceorg.openqa.selenium.WrapsElement
-
getCoordinates
public org.openqa.selenium.interactions.Coordinates getCoordinates()- Specified by:
getCoordinates
in interfaceorg.openqa.selenium.interactions.Locatable
-
findElementByAccessibilityId
public org.openqa.selenium.WebElement findElementByAccessibilityId(java.lang.String using)- Specified by:
findElementByAccessibilityId
in interfaceio.appium.java_client.FindsByAccessibilityId
-
findElementsByAccessibilityId
public java.util.List<org.openqa.selenium.WebElement> findElementsByAccessibilityId(java.lang.String using)- Specified by:
findElementsByAccessibilityId
in interfaceio.appium.java_client.FindsByAccessibilityId
-
findElementByAndroidUIAutomator
public org.openqa.selenium.WebElement findElementByAndroidUIAutomator(java.lang.String using)- Specified by:
findElementByAndroidUIAutomator
in interfaceio.appium.java_client.FindsByAndroidUIAutomator
-
findElementsByAndroidUIAutomator
public java.util.List<org.openqa.selenium.WebElement> findElementsByAndroidUIAutomator(java.lang.String using)- Specified by:
findElementsByAndroidUIAutomator
in interfaceio.appium.java_client.FindsByAndroidUIAutomator
-
setImplicitTimeout
public void setImplicitTimeout(java.time.Duration implicitTimeout)- Specified by:
setImplicitTimeout
in interfaceConfigurableTimeouts
-
getCurrentImplicitTimeout
public java.time.Duration getCurrentImplicitTimeout()- Specified by:
getCurrentImplicitTimeout
in interfaceConfigurableTimeouts
-
resetTimeouts
public java.time.Duration resetTimeouts()- Specified by:
resetTimeouts
in interfaceConfigurableTimeouts
-
containsElements
public boolean containsElements(org.openqa.selenium.By selector)- Specified by:
containsElements
in interfaceWebElementFacade
-
containsElements
public boolean containsElements(java.lang.String xpathOrCssSelector)- Specified by:
containsElements
in interfaceWebElementFacade
-
shouldContainElements
public void shouldContainElements(org.openqa.selenium.By selector)- Specified by:
shouldContainElements
in interfaceWebElementFacade
-
shouldContainElements
public void shouldContainElements(java.lang.String xpathOrCssSelector)- Specified by:
shouldContainElements
in interfaceWebElementFacade
-
hasClass
public boolean hasClass(java.lang.String cssClassName)- Specified by:
hasClass
in interfaceWebElementFacade
-
getScreenshotAs
public <X> X getScreenshotAs(org.openqa.selenium.OutputType<X> target) throws org.openqa.selenium.WebDriverException- Specified by:
getScreenshotAs
in interfaceorg.openqa.selenium.TakesScreenshot
- Throws:
org.openqa.selenium.WebDriverException
-