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.TestCase
Base 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 void
assertNotSelected(Finder<org.openqa.selenium.WebElement,org.openqa.selenium.WebDriver> finder)
protected void
assertPresenceOf(org.hamcrest.Matcher<java.lang.Integer> cardinalityConstraint, Finder<org.openqa.selenium.WebElement,org.openqa.selenium.WebDriver> finder)
protected void
assertPresenceOf(Finder<org.openqa.selenium.WebElement,org.openqa.selenium.WebDriver> finder)
protected void
assertSelected(Finder<org.openqa.selenium.WebElement,org.openqa.selenium.WebDriver> finder)
protected void
clickOn(Finder<org.openqa.selenium.WebElement,org.openqa.selenium.WebDriver> finder)
protected abstract org.openqa.selenium.WebDriver
createDriver()
java.lang.String
getCurrentUrl()
java.lang.String
getPageSource()
java.lang.String
getTitle()
protected org.openqa.selenium.WebDriver
getWebDriver()
protected void
goTo(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 void
setUp()
protected void
tearDown()
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 fieldprotected void
waitFor(Finder<org.openqa.selenium.WebElement,org.openqa.selenium.WebDriver> finder)
protected void
waitFor(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:
setUp
in classjunit.framework.TestCase
- Throws:
java.lang.Exception
-
tearDown
protected void tearDown() throws java.lang.Exception
- Overrides:
tearDown
in 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)
-
-