Package org.openqa.selenium.lift
Class HamcrestWebDriverTestCase
- java.lang.Object
-
- junit.framework.Assert
-
- junit.framework.TestCase
-
- org.openqa.selenium.lift.HamcrestWebDriverTestCase
-
- All Implemented Interfaces:
junit.framework.Test
public abstract class HamcrestWebDriverTestCase extends junit.framework.TestCaseBase class for tests using the LiFT style API to driver WebDriver.
-
-
Constructor Summary
Constructors Constructor Description HamcrestWebDriverTestCase()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidassertNotSelected(Finder<org.openqa.selenium.WebElement,org.openqa.selenium.WebDriver> finder)protected voidassertPresenceOf(org.hamcrest.Matcher<java.lang.Integer> cardinalityConstraint, Finder<org.openqa.selenium.WebElement,org.openqa.selenium.WebDriver> finder)protected voidassertPresenceOf(Finder<org.openqa.selenium.WebElement,org.openqa.selenium.WebDriver> finder)protected voidassertSelected(Finder<org.openqa.selenium.WebElement,org.openqa.selenium.WebDriver> finder)protected voidclickOn(Finder<org.openqa.selenium.WebElement,org.openqa.selenium.WebDriver> finder)protected abstract org.openqa.selenium.WebDrivercreateDriver()java.lang.StringgetCurrentUrl()java.lang.StringgetPageSource()java.lang.StringgetTitle()protected org.openqa.selenium.WebDrivergetWebDriver()protected voidgoTo(java.lang.String url)Cause the browser to navigate to the given URLprotected Finder<org.openqa.selenium.WebElement,org.openqa.selenium.WebDriver>into(Finder<org.openqa.selenium.WebElement,org.openqa.selenium.WebDriver> input)Syntactic sugar to use withHamcrestWebDriverTestCase, e.g.protected voidsetUp()protected voidtearDown()protected voidtype(java.lang.String text, Finder<org.openqa.selenium.WebElement,org.openqa.selenium.WebDriver> inputFinder)Type characters into an element of the page, typically an input fieldprotected voidwaitFor(Finder<org.openqa.selenium.WebElement,org.openqa.selenium.WebDriver> finder)protected voidwaitFor(Finder<org.openqa.selenium.WebElement,org.openqa.selenium.WebDriver> finder, long timeout)-
Methods inherited from class junit.framework.TestCase
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runBare, runTest, setName, toString
-
-
-
-
Method Detail
-
createDriver
protected abstract org.openqa.selenium.WebDriver createDriver()
-
setUp
protected void setUp() throws java.lang.Exception- Overrides:
setUpin classjunit.framework.TestCase- Throws:
java.lang.Exception
-
tearDown
protected void tearDown() throws java.lang.Exception- Overrides:
tearDownin classjunit.framework.TestCase- Throws:
java.lang.Exception
-
getWebDriver
protected org.openqa.selenium.WebDriver getWebDriver()
-
clickOn
protected void clickOn(Finder<org.openqa.selenium.WebElement,org.openqa.selenium.WebDriver> finder)
-
assertPresenceOf
protected void assertPresenceOf(Finder<org.openqa.selenium.WebElement,org.openqa.selenium.WebDriver> finder)
-
assertPresenceOf
protected void assertPresenceOf(org.hamcrest.Matcher<java.lang.Integer> cardinalityConstraint, Finder<org.openqa.selenium.WebElement,org.openqa.selenium.WebDriver> finder)
-
waitFor
protected void waitFor(Finder<org.openqa.selenium.WebElement,org.openqa.selenium.WebDriver> finder)
-
waitFor
protected void waitFor(Finder<org.openqa.selenium.WebElement,org.openqa.selenium.WebDriver> finder, long timeout)
-
goTo
protected void goTo(java.lang.String url)
Cause the browser to navigate to the given URL- Parameters:
url- URL
-
type
protected void type(java.lang.String text, Finder<org.openqa.selenium.WebElement,org.openqa.selenium.WebDriver> inputFinder)Type characters into an element of the page, typically an input field- Parameters:
text- - characters to typeinputFinder- - specification for the page element
-
into
protected Finder<org.openqa.selenium.WebElement,org.openqa.selenium.WebDriver> into(Finder<org.openqa.selenium.WebElement,org.openqa.selenium.WebDriver> input)
Syntactic sugar to use withHamcrestWebDriverTestCase, e.g. type("cheese", into(textbox())); The into() method simply returns its argument.- Parameters:
input- finder input- Returns:
- the finder
-
getPageSource
public java.lang.String getPageSource()
- Returns:
- the current page source
-
getTitle
public java.lang.String getTitle()
- Returns:
- the current page title
-
getCurrentUrl
public java.lang.String getCurrentUrl()
- Returns:
- the current URL
-
assertSelected
protected void assertSelected(Finder<org.openqa.selenium.WebElement,org.openqa.selenium.WebDriver> finder)
-
assertNotSelected
protected void assertNotSelected(Finder<org.openqa.selenium.WebElement,org.openqa.selenium.WebDriver> finder)
-
-