net.thucydides.core.pages
Class WebElementFacade

Package class diagram package WebElementFacade
java.lang.Object
  extended by net.thucydides.core.pages.WebElementFacade

public class WebElementFacade
extends Object

A proxy class for a web element, providing some more methods.


Constructor Summary
WebElementFacade(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement webElement, long timeoutInMilliseconds)
           
 
Method Summary
 WebElementFacade and()
          Convenience method to chain method calls more fluently.
 void clear()
           
 WebElementFacade click()
          Wait for an element to be visible and enabled, and then click on it.
 boolean containsSelectOption(String value)
          Does this dropdown contain the specified value.
 boolean containsText(String value)
          Does this element contain a given text?
protected  InternalSystemClock getClock()
           
protected  JavascriptExecutorFacade getJavascriptExecutorFacade()
           
 String getSelectedValue()
           
 String getSelectedVisibleTextValue()
           
 List<String> getSelectOptions()
           
 String getText()
           
 String getTextValue()
           
 long getTimeoutInMilliseconds()
           
 String getValue()
           
 boolean hasFocus()
          Does this element currently have the focus.
 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 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.
 WebElementFacade selectByIndex(int indexValue)
           
 WebElementFacade selectByValue(String value)
           
 WebElementFacade selectByVisibleText(String label)
           
 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 shouldContainSelectedOption(String textValue)
           
 void shouldContainText(String textValue)
          Check that an element contains a text value
 void 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 value
 WebElementFacade then()
          Convenience method to chain method calls more fluently.
 WebElementFacade then(org.openqa.selenium.By selector)
           
 WebElementFacade then(String xpathOrCssSelector)
           
 String toString()
           
 WebElementFacade type(String value)
          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 waitUntilDisabled()
           
 WebElementFacade waitUntilEnabled()
           
 WebElementFacade waitUntilNotVisible()
           
 WebElementFacade waitUntilPresent()
           
 WebElementFacade waitUntilVisible()
           
 WebElementFacade withTimeoutOf(int timeout, TimeUnit unit)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WebElementFacade

public WebElementFacade(org.openqa.selenium.WebDriver driver,
                        org.openqa.selenium.WebElement webElement,
                        long timeoutInMilliseconds)
Method Detail

getJavascriptExecutorFacade

protected JavascriptExecutorFacade getJavascriptExecutorFacade()

getClock

protected InternalSystemClock getClock()

then

public WebElementFacade then(String xpathOrCssSelector)

then

public WebElementFacade then(org.openqa.selenium.By selector)

getTimeoutInMilliseconds

public long getTimeoutInMilliseconds()

withTimeoutOf

public WebElementFacade withTimeoutOf(int timeout,
                                      TimeUnit unit)

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.


and

public WebElementFacade and()
Convenience method to chain method calls more fluently.


then

public WebElementFacade then()
Convenience method to chain method calls more fluently.


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.


isCurrentlyEnabled

public boolean isCurrentlyEnabled()

shouldBeVisible

public void shouldBeVisible()
Checks whether a web element is visible. Throws an AssertionError if the element is not rendered.


shouldBeCurrentlyVisible

public void shouldBeCurrentlyVisible()
Checks whether a web element is visible. Throws an AssertionError if the element is not rendered.


shouldNotBeVisible

public void shouldNotBeVisible()
Checks whether a web element is not visible. Throws an AssertionError if the element is not rendered.


shouldNotBeCurrentlyVisible

public void shouldNotBeCurrentlyVisible()
Checks whether a web element is not visible straight away. Throws an AssertionError if the element is not rendered.


hasFocus

public boolean hasFocus()
Does this element currently have the focus.


containsText

public boolean containsText(String value)
Does this element contain a given text?


containsSelectOption

public boolean containsSelectOption(String value)
Does this dropdown contain the specified value.


getSelectOptions

public List<String> getSelectOptions()

shouldContainText

public void shouldContainText(String textValue)
Check that an element contains a text value

Parameters:
textValue -

shouldContainSelectedOption

public void shouldContainSelectedOption(String textValue)

shouldNotContainText

public void shouldNotContainText(String textValue)
Check that an element does not contain a text value

Parameters:
textValue -

shouldBeEnabled

public void shouldBeEnabled()

isEnabled

public boolean isEnabled()

shouldNotBeEnabled

public void shouldNotBeEnabled()

type

public WebElementFacade type(String value)
Type a value into a field, making sure that the field is empty first.

Parameters:
value -

typeAndEnter

public WebElementFacade typeAndEnter(String value)
Type a value into a field and then press Enter, making sure that the field is empty first.

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.

Parameters:
value -

setWindowFocus

public void setWindowFocus()

selectByVisibleText

public WebElementFacade selectByVisibleText(String label)

getSelectedVisibleTextValue

public String getSelectedVisibleTextValue()

selectByValue

public WebElementFacade selectByValue(String value)

getSelectedValue

public String getSelectedValue()

selectByIndex

public WebElementFacade selectByIndex(int indexValue)

isPresent

public boolean isPresent()

shouldBePresent

public void shouldBePresent()

shouldNotBePresent

public void shouldNotBePresent()

waitUntilVisible

public WebElementFacade waitUntilVisible()

waitUntilPresent

public WebElementFacade waitUntilPresent()

waitForCondition

public org.openqa.selenium.support.ui.Wait<org.openqa.selenium.WebDriver> waitForCondition()

waitUntilNotVisible

public WebElementFacade waitUntilNotVisible()

getValue

public String getValue()

isSelected

public boolean isSelected()

getText

public String getText()

waitUntilEnabled

public WebElementFacade waitUntilEnabled()

waitUntilDisabled

public WebElementFacade waitUntilDisabled()

getTextValue

public String getTextValue()

click

public WebElementFacade click()
Wait for an element to be visible and enabled, and then click on it.


clear

public void clear()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011-2012 Wakaleo Consulting. All Rights Reserved.