public class PageHelper extends Object
Modifier and Type | Class and Description |
---|---|
static class |
PageHelper.Form
Static class providing some helper functions that solve
common problems concerning forms.
|
static class |
PageHelper.Navigation
Helper methods about navigating the web app, e.g.
|
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_EXPLICIT_WAIT_TIMEOUT_SECONDS
The default timeout in seconds used by
waitUntil(ExpectedCondition, WebDriver) . |
Constructor and Description |
---|
PageHelper() |
Modifier and Type | Method and Description |
---|---|
static void |
assertElementIsNotDisplayed(org.openqa.selenium.By locator,
org.openqa.selenium.WebDriver driver)
Explicitly wait until the given element is visible.
|
static <T> T |
assertExpectedCondition(org.openqa.selenium.support.ui.ExpectedCondition<T> condition,
org.openqa.selenium.WebDriver driver)
Explicitly wait until the given expected condition is met.
|
static org.openqa.selenium.WebElement |
findOrRefresh(org.openqa.selenium.By locator,
org.openqa.selenium.WebDriver driver)
Implicitly wait for an element.
|
static void |
hitKeys(org.openqa.selenium.WebDriver driver,
CharSequence keys)
Typical use is to simulate hitting ESCAPE or ENTER.
|
static void |
hoverMouseOver(org.openqa.selenium.WebElement element,
org.openqa.selenium.WebDriver driver) |
static org.openqa.selenium.WebElement |
loopFindOrRefresh(int maxRefreshes,
org.openqa.selenium.By locator,
org.openqa.selenium.WebDriver driver)
Implicitly wait for an element.
|
static <T> T |
waitUntil(org.openqa.selenium.support.ui.ExpectedCondition<T> expectedCondition,
org.openqa.selenium.WebDriver driver)
Generic explicit wait, taking an
ExpectedCondition as a parameter. |
static <T> T |
waitUntil(org.openqa.selenium.support.ui.ExpectedCondition<T> expectedCondition,
org.openqa.selenium.WebDriver driver,
long timeOutInSeconds)
Generic explicit wait, taking an
ExpectedCondition as a parameter. |
public static final int DEFAULT_EXPLICIT_WAIT_TIMEOUT_SECONDS
waitUntil(ExpectedCondition, WebDriver)
.Config.getExplicitWait()
public static <T> T waitUntil(org.openqa.selenium.support.ui.ExpectedCondition<T> expectedCondition, org.openqa.selenium.WebDriver driver)
ExpectedCondition
as a parameter.
Times out after DEFAULT_EXPLICIT_WAIT_TIMEOUT_SECONDS
seconds.expectedCondition
- driver
- waitUntil(ExpectedCondition, WebDriver, long)
public static <T> T waitUntil(org.openqa.selenium.support.ui.ExpectedCondition<T> expectedCondition, org.openqa.selenium.WebDriver driver, long timeOutInSeconds)
ExpectedCondition
as a parameter.
Times out after the given number of seconds.expectedCondition
- driver
- timeOutInSeconds
- org.openqa.selenium.TimeoutException
- if the timeout expiresFluentWait.until(com.google.common.base.Function)
public static <T> T assertExpectedCondition(org.openqa.selenium.support.ui.ExpectedCondition<T> condition, org.openqa.selenium.WebDriver driver)
AssertionError
if the wait times out.condition
- driver
- AssertionError
- if the condition is not metpublic static void assertElementIsNotDisplayed(org.openqa.selenium.By locator, org.openqa.selenium.WebDriver driver)
AssertionError
; else, do nothing.locator
- driver
- AssertionError
- if element is visiblepublic static org.openqa.selenium.WebElement findOrRefresh(org.openqa.selenium.By locator, org.openqa.selenium.WebDriver driver)
loopFindOrRefresh(int, By, WebDriver)
public static org.openqa.selenium.WebElement loopFindOrRefresh(int maxRefreshes, org.openqa.selenium.By locator, org.openqa.selenium.WebDriver driver)
maxRefreshes
- max num of iterations of the looplocator
- the locator for the element we want to finddriver
- public static void hoverMouseOver(org.openqa.selenium.WebElement element, org.openqa.selenium.WebDriver driver)
public static void hitKeys(org.openqa.selenium.WebDriver driver, CharSequence keys)
driver
- keys
- Actions.sendKeys(CharSequence...)
Copyright © 2015. All rights reserved.