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 Object implements WebElementFacade
-
-
Constructor Summary
Constructors Constructor Description WebElementFacadeStub()
-
Method Summary
All Methods Instance Methods Concrete Methods 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(String xpathOrCssSelector)
boolean
containsElements(org.openqa.selenium.By selector)
boolean
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?FluentDropdownDeselect
deselect()
WebElementFacade
deselectAll()
WebElementFacade
deselectByIndex(int indexValue)
WebElementFacade
deselectByValue(String value)
WebElementFacade
deselectByVisibleText(String label)
WebElementState
expect(String errorMessage)
protected WebElementState
expectingErrorMessage(String errorMessage)
WebElementFacade
find(org.openqa.selenium.By bySelector)
WebElementFacade
findBy(String xpathOrCssSelector)
WebElementFacade
findBy(String xpathOrCssSelector, Object... arguments)
WebElementFacade
findBy(org.openqa.selenium.By selector)
org.openqa.selenium.WebElement
findElement(String by, String using)
org.openqa.selenium.WebElement
findElement(org.openqa.selenium.By by)
org.openqa.selenium.WebElement
findElementByAccessibilityId(String using)
org.openqa.selenium.WebElement
findElementByAndroidUIAutomator(String using)
List
findElements(String by, String using)
List<org.openqa.selenium.WebElement>
findElements(org.openqa.selenium.By by)
List<org.openqa.selenium.WebElement>
findElementsByAccessibilityId(String using)
List<org.openqa.selenium.WebElement>
findElementsByAndroidUIAutomator(String using)
String
getAttribute(String name)
org.openqa.selenium.interactions.Coordinates
getCoordinates()
String
getCssValue(String propertyName)
Duration
getCurrentImplicitTimeout()
org.openqa.selenium.WebElement
getElement()
String
getFirstSelectedOptionValue()
String
getFirstSelectedOptionVisibleText()
long
getImplicitTimeoutInMilliseconds()
org.openqa.selenium.Point
getLocation()
org.openqa.selenium.Rectangle
getRect()
<X> X
getScreenshotAs(org.openqa.selenium.OutputType<X> target)
String
getSelectedValue()
List<String>
getSelectedValues()
List<String>
getSelectedVisibleTexts()
String
getSelectedVisibleTextValue()
List<String>
getSelectOptions()
org.openqa.selenium.Dimension
getSize()
String
getTagName()
String
getText()
String
getTextContent()
String
getTextValue()
String
getValue()
org.openqa.selenium.WebElement
getWrappedElement()
boolean
hasClass(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.Duration
resetTimeouts()
FluentDropdownSelect
select()
WebElementFacade
selectByIndex(int indexValue)
WebElementFacade
selectByValue(String value)
WebElementFacade
selectByVisibleText(String label)
void
sendKeys(CharSequence... keysToSend)
void
setImplicitTimeout(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(String xpathOrCssSelector)
void
shouldContainElements(org.openqa.selenium.By selector)
void
shouldContainOnlyText(String textValue)
Check that an element exactly matches a text valuevoid
shouldContainSelectedOption(String textValue)
void
shouldContainText(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(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(String xpathOrCssSelector)
WebElementFacade
then(String xpathOrCssSelector, Object... arguments)
WebElementFacade
then(org.openqa.selenium.By bySelector)
WebElementFacade
thenFind(String xpathOrCssSelector)
WebElementFacade
thenFind(String xpathOrCssSelector, Object... arguments)
ListOfWebElementFacades
thenFindAll(String xpathOrCssSelector)
ListOfWebElementFacades
thenFindAll(String xpathOrCssSelector, Object... arguments)
ListOfWebElementFacades
thenFindAll(org.openqa.selenium.By selector)
String
toString()
WebElementFacade
type(CharSequence... keysToSend)
Type a value into a field, making sure that the field is empty first.WebElementFacade
typeAndEnter(String value)
Type a value into a field and then press Enter, making sure that the field is empty first.WebElementFacade
typeAndTab(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, TemporalUnit unit)
WebElementFacade
withTimeoutOf(int timeout, TimeUnit unit)
WebElementFacade
withTimeoutOf(Duration duration)
-
-
-
Method Detail
-
getElement
public org.openqa.selenium.WebElement getElement()
- Specified by:
getElement
in interfaceWebElementFacade
-
then
public WebElementFacade then(String xpathOrCssSelector)
- Specified by:
then
in interfaceWebElementFacade
-
thenFind
public WebElementFacade thenFind(String xpathOrCssSelector)
- Specified by:
thenFind
in interfaceWebElementFacade
-
thenFind
public WebElementFacade thenFind(String xpathOrCssSelector, Object... arguments)
- Specified by:
thenFind
in interfaceWebElementFacade
-
then
public WebElementFacade then(String xpathOrCssSelector, Object... arguments)
- Specified by:
then
in interfaceWebElementFacade
-
findBy
public WebElementFacade findBy(String xpathOrCssSelector)
- Specified by:
findBy
in interfaceWebElementFacade
-
findBy
public WebElementFacade findBy(String xpathOrCssSelector, Object... arguments)
- Specified by:
findBy
in interfaceWebElementFacade
-
thenFindAll
public ListOfWebElementFacades thenFindAll(String xpathOrCssSelector)
- Specified by:
thenFindAll
in interfaceWebElementFacade
-
thenFindAll
public ListOfWebElementFacades thenFindAll(String xpathOrCssSelector, Object... arguments)
- Specified by:
thenFindAll
in interfaceWebElementFacade
-
findBy
public WebElementFacade findBy(org.openqa.selenium.By selector)
- Specified by:
findBy
in interfaceWebElementFacade
-
find
public WebElementFacade find(org.openqa.selenium.By bySelector)
- Specified by:
find
in interfaceWebElementFacade
-
then
public WebElementFacade then(org.openqa.selenium.By bySelector)
- Specified by:
then
in interfaceWebElementFacade
-
getAttribute
public String getAttribute(String name)
- Specified by:
getAttribute
in interfaceorg.openqa.selenium.WebElement
- Specified by:
getAttribute
in interfaceWebElementFacade
-
thenFindAll
public ListOfWebElementFacades thenFindAll(org.openqa.selenium.By selector)
- Specified by:
thenFindAll
in interfaceWebElementFacade
-
getImplicitTimeoutInMilliseconds
public long getImplicitTimeoutInMilliseconds()
- Specified by:
getImplicitTimeoutInMilliseconds
in interfaceWebElementFacade
-
withTimeoutOf
public WebElementFacade withTimeoutOf(int timeout, TimeUnit unit)
- Specified by:
withTimeoutOf
in interfaceWebElementFacade
-
withTimeoutOf
public WebElementFacade withTimeoutOf(int timeout, TemporalUnit unit)
- Specified by:
withTimeoutOf
in interfaceWebElementFacade
-
withTimeoutOf
public WebElementFacade withTimeoutOf(Duration duration)
- 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
public WebElementFacade and()
Convenience method to chain method calls more fluently.- Specified by:
and
in interfaceWebElementFacade
-
then
public WebElementFacade 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(String value)
Does this element contain a given text?- Specified by:
containsText
in interfaceWebElementState
-
containsValue
public boolean containsValue(String value)
Description copied from interface:WebElementState
Does this element contain a given value attribute?- Specified by:
containsValue
in interfaceWebElementState
-
containsOnlyText
public boolean containsOnlyText(String value)
Does this element exactly match given text?- Specified by:
containsOnlyText
in interfaceWebElementState
-
containsSelectOption
public boolean containsSelectOption(String value)
Does this dropdown contain the specified value.- Specified by:
containsSelectOption
in interfaceWebElementState
-
getSelectOptions
public List<String> getSelectOptions()
- Specified by:
getSelectOptions
in interfaceWebElementFacade
- Specified by:
getSelectOptions
in interfaceWebElementState
-
getFirstSelectedOptionVisibleText
public String getFirstSelectedOptionVisibleText()
- Specified by:
getFirstSelectedOptionVisibleText
in interfaceWebElementFacade
-
getSelectedVisibleTexts
public List<String> getSelectedVisibleTexts()
- Specified by:
getSelectedVisibleTexts
in interfaceWebElementFacade
-
getFirstSelectedOptionValue
public String getFirstSelectedOptionValue()
- Specified by:
getFirstSelectedOptionValue
in interfaceWebElementFacade
-
getSelectedValues
public List<String> getSelectedValues()
- Specified by:
getSelectedValues
in interfaceWebElementFacade
-
shouldContainText
public void shouldContainText(String textValue)
Check that an element contains a text value- Specified by:
shouldContainText
in interfaceWebElementState
- Parameters:
textValue
-
-
shouldContainOnlyText
public void shouldContainOnlyText(String textValue)
Check that an element exactly matches a text value- Specified by:
shouldContainOnlyText
in interfaceWebElementState
- Parameters:
textValue
-
-
shouldContainSelectedOption
public void shouldContainSelectedOption(String textValue)
- Specified by:
shouldContainSelectedOption
in interfaceWebElementState
-
shouldNotContainText
public void shouldNotContainText(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
public WebElementFacade type(CharSequence... keysToSend)
Type a value into a field, making sure that the field is empty first.- Specified by:
type
in interfaceWebElementFacade
- Parameters:
keysToSend
-
-
typeAndEnter
public WebElementFacade typeAndEnter(String value)
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
public WebElementFacade typeAndTab(String value)
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
public FluentDropdownSelect select()
- Specified by:
select
in interfaceWebElementFacade
-
deselect
public FluentDropdownDeselect deselect()
- Specified by:
deselect
in interfaceWebElementFacade
-
deselectAll
public WebElementFacade deselectAll()
- Specified by:
deselectAll
in interfaceWebElementFacade
-
deselectByVisibleText
public WebElementFacade deselectByVisibleText(String label)
- Specified by:
deselectByVisibleText
in interfaceWebElementFacade
-
deselectByValue
public WebElementFacade deselectByValue(String value)
- Specified by:
deselectByValue
in interfaceWebElementFacade
-
deselectByIndex
public WebElementFacade deselectByIndex(int indexValue)
- Specified by:
deselectByIndex
in interfaceWebElementFacade
-
selectByVisibleText
public WebElementFacade selectByVisibleText(String label)
- Specified by:
selectByVisibleText
in interfaceWebElementFacade
-
getSelectedVisibleTextValue
public String getSelectedVisibleTextValue()
- Specified by:
getSelectedVisibleTextValue
in interfaceWebElementState
-
selectByValue
public WebElementFacade selectByValue(String value)
- Specified by:
selectByValue
in interfaceWebElementFacade
-
getSelectedValue
public String getSelectedValue()
- Specified by:
getSelectedValue
in interfaceWebElementState
-
selectByIndex
public WebElementFacade selectByIndex(int indexValue)
- 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
public WebElementFacade waitUntilVisible()
- Specified by:
waitUntilVisible
in interfaceWebElementFacade
-
waitUntilPresent
public WebElementFacade 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
public WebElementFacade waitUntilNotVisible()
- Specified by:
waitUntilNotVisible
in interfaceWebElementFacade
-
getValue
public 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 String getText()
- Specified by:
getText
in interfaceorg.openqa.selenium.WebElement
- Specified by:
getText
in interfaceWebElementFacade
- Specified by:
getText
in interfaceWebElementState
-
getTextContent
public String getTextContent()
- Specified by:
getTextContent
in interfaceWebElementFacade
-
isDisabled
public boolean isDisabled()
- Specified by:
isDisabled
in interfaceWebElementFacade
- Specified by:
isDisabled
in interfaceWebElementState
-
waitUntilClickable
public WebElementFacade waitUntilClickable()
- Specified by:
waitUntilClickable
in interfaceWebElementFacade
-
waitUntilEnabled
public WebElementFacade waitUntilEnabled()
- Specified by:
waitUntilEnabled
in interfaceWebElementFacade
-
waitUntilDisabled
public WebElementFacade waitUntilDisabled()
- Specified by:
waitUntilDisabled
in interfaceWebElementFacade
-
getTextValue
public String getTextValue()
- Specified by:
getTextValue
in interfaceWebElementState
-
expect
public WebElementState expect(String errorMessage)
- Specified by:
expect
in interfaceWebElementState
-
isClickable
public boolean isClickable()
- Specified by:
isClickable
in interfaceWebElementState
-
expectingErrorMessage
protected WebElementState expectingErrorMessage(String errorMessage)
-
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
public void click(ClickStrategy clickStrategy)
- Specified by:
click
in interfaceWebElementFacade
-
clear
public void clear()
- Specified by:
clear
in interfaceorg.openqa.selenium.WebElement
- Specified by:
clear
in interfaceWebElementFacade
-
toString
public String toString()
- Specified by:
toString
in interfaceWebElementFacade
- Overrides:
toString
in classObject
-
submit
public void submit()
- Specified by:
submit
in interfaceorg.openqa.selenium.WebElement
-
sendKeys
public void sendKeys(CharSequence... keysToSend)
- Specified by:
sendKeys
in interfaceorg.openqa.selenium.WebElement
-
getTagName
public String getTagName()
- Specified by:
getTagName
in interfaceorg.openqa.selenium.WebElement
-
findElements
public 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(String by, String using)
- Specified by:
findElement
in interfaceio.appium.java_client.FindsByFluentSelector
-
findElements
public List findElements(String by, 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 String getCssValue(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(String using)
- Specified by:
findElementByAccessibilityId
in interfaceio.appium.java_client.FindsByAccessibilityId
-
findElementsByAccessibilityId
public List<org.openqa.selenium.WebElement> findElementsByAccessibilityId(String using)
- Specified by:
findElementsByAccessibilityId
in interfaceio.appium.java_client.FindsByAccessibilityId
-
findElementByAndroidUIAutomator
public org.openqa.selenium.WebElement findElementByAndroidUIAutomator(String using)
- Specified by:
findElementByAndroidUIAutomator
in interfaceio.appium.java_client.FindsByAndroidUIAutomator
-
findElementsByAndroidUIAutomator
public List<org.openqa.selenium.WebElement> findElementsByAndroidUIAutomator(String using)
- Specified by:
findElementsByAndroidUIAutomator
in interfaceio.appium.java_client.FindsByAndroidUIAutomator
-
setImplicitTimeout
public void setImplicitTimeout(Duration implicitTimeout)
- Specified by:
setImplicitTimeout
in interfaceConfigurableTimeouts
-
getCurrentImplicitTimeout
public Duration getCurrentImplicitTimeout()
- Specified by:
getCurrentImplicitTimeout
in interfaceConfigurableTimeouts
-
resetTimeouts
public 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(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(String xpathOrCssSelector)
- Specified by:
shouldContainElements
in interfaceWebElementFacade
-
hasClass
public boolean hasClass(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
-
-