public class SeleniumTestBase extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
SeleniumTestBase.Driver |
| Modifier and Type | Field and Description |
|---|---|
protected static int |
CLICK_WAIT4ELEMENT_MILLIS |
protected static int |
CLICK_WAIT4ELEMENT_POLL_MILLIS |
static String |
OUTPUT_DIR |
static String |
SCREENSHOT_EXT |
org.junit.rules.TestRule |
seleniumTestWatcher |
| Constructor and Description |
|---|
SeleniumTestBase() |
| Modifier and Type | Method and Description |
|---|---|
org.openqa.selenium.WebElement |
activeElement() |
org.openqa.selenium.WebElement |
assertElement(String text) |
void |
assertElementDisabled(String text)
Assert that the element in question exists, is displayed, and is disabled.
|
void |
assertElementEnabled(String text)
Assert that the element in question exists, is displayed, but is enabled.
|
void |
assertNotFound(String text) |
void |
assertNotFoundOrNotDisplayed(String text) |
void |
click(String text)
Wait for some element using
waitForElement(java.lang.String, java.lang.Boolean, java.lang.Boolean), then click it. |
static void |
dumpVersion() |
org.openqa.selenium.WebElement |
findElement(String text) |
org.openqa.selenium.WebElement |
getButtonByName(String name) |
static org.openqa.selenium.WebDriver |
getDriver() |
static org.openqa.selenium.WebDriver |
getDriver(SeleniumTestBase.Driver driverType) |
org.openqa.selenium.WebElement |
getElementByName(String elementTag,
String name) |
org.openqa.selenium.WebElement |
getInputByName(String name) |
protected String |
getPageSource() |
protected String |
getPageSource(org.openqa.selenium.WebDriver d) |
protected String |
getPrettyPageSource()
This method uses
JsoupTools.prettyFormatHtml(java.lang.String, boolean), so beware that some
content may get truncated for nicer display. |
String |
getXPath(org.openqa.selenium.WebElement webElement) |
String |
getXPathForActiveElement() |
String |
getXPathSimple(org.openqa.selenium.WebElement webElement) |
void |
scrollAndClick(org.openqa.selenium.WebElement clickable) |
static void |
setDriver(org.openqa.selenium.WebDriver aDriver) |
void |
setInputFieldValue(String inputElementName,
String value) |
void |
setInputFieldValue(org.openqa.selenium.WebElement el,
String value)
Tries to force a key up event even when the {
|
void |
setTestName(String _testName) |
void |
sleep(int secs) |
static void |
stopDriver() |
String |
switchToOtherWindow() |
String |
switchToWindowOtherThan(String windowHandle) |
void |
takeLocalScreenshot(String name)
Local screenshots take a screenshot of the entire desktop.
|
void |
takeScreenshot() |
void |
takeScreenshot(String name)
Take a screenshot of the browser's current page.
|
static void |
tearDown() |
org.openqa.selenium.WebElement |
waitForElement(String text) |
org.openqa.selenium.WebElement |
waitForElement(String text,
Boolean displayed,
Boolean enabled)
Wait until there is some element returned by
findElement(java.lang.String) which is displayed and enabled. |
org.openqa.selenium.WebElement |
waitForElementDisplayedAndDisabled(String text) |
org.openqa.selenium.WebElement |
waitForElementDisplayedAndEnabled(String text) |
void |
waitUntil(com.google.common.base.Predicate<org.openqa.selenium.WebDriver> predicate) |
public static final String OUTPUT_DIR
public static final String SCREENSHOT_EXT
protected static final int CLICK_WAIT4ELEMENT_MILLIS
protected static final int CLICK_WAIT4ELEMENT_POLL_MILLIS
public org.junit.rules.TestRule seleniumTestWatcher
public static void tearDown()
public static void stopDriver()
public void takeLocalScreenshot(String name)
name - public void takeScreenshot(String name)
name - public void takeScreenshot()
public void setTestName(String _testName)
public void setInputFieldValue(org.openqa.selenium.WebElement el,
String value)
el - value - public void setInputFieldValue(String inputElementName, String value) throws WebElementNotFoundException
WebElementNotFoundExceptionpublic void waitUntil(com.google.common.base.Predicate<org.openqa.selenium.WebDriver> predicate)
public String switchToOtherWindow()
public static org.openqa.selenium.WebDriver getDriver()
public static org.openqa.selenium.WebDriver getDriver(SeleniumTestBase.Driver driverType)
public static void dumpVersion()
public static void setDriver(org.openqa.selenium.WebDriver aDriver)
aDriver - the driver to setpublic void assertNotFound(String text)
public void assertNotFoundOrNotDisplayed(String text)
public void assertElementDisabled(String text) throws WebElementNotFoundException
text - the text value of the element to select via findElement(java.lang.String)WebElementNotFoundExceptionpublic void assertElementEnabled(String text) throws WebElementNotFoundException
text - the text value of the element to select via findElement(java.lang.String)WebElementNotFoundExceptionpublic void click(String text) throws WebElementNotFoundException
waitForElement(java.lang.String, java.lang.Boolean, java.lang.Boolean), then click it.text - the text value of the element to selectWebElementNotFoundExceptionpublic void scrollAndClick(org.openqa.selenium.WebElement clickable)
public org.openqa.selenium.WebElement waitForElement(String text, Boolean displayed, Boolean enabled) throws WebElementNotFoundException
findElement(java.lang.String) which is displayed and enabled. The
timeout is given by CLICK_WAIT4ELEMENT_MILLIS.text - the text value of the element to selectWebElementNotFoundExceptionpublic org.openqa.selenium.WebElement waitForElement(String text) throws WebElementNotFoundException
WebElementNotFoundExceptionpublic org.openqa.selenium.WebElement waitForElementDisplayedAndEnabled(String text) throws WebElementNotFoundException
WebElementNotFoundExceptionpublic org.openqa.selenium.WebElement waitForElementDisplayedAndDisabled(String text) throws WebElementNotFoundException
WebElementNotFoundExceptionpublic org.openqa.selenium.WebElement findElement(String text)
public org.openqa.selenium.WebElement getButtonByName(String name) throws WebElementNotFoundException
WebElementNotFoundExceptionpublic org.openqa.selenium.WebElement getInputByName(String name) throws WebElementNotFoundException
WebElementNotFoundExceptionpublic org.openqa.selenium.WebElement getElementByName(String elementTag, String name) throws WebElementNotFoundException
WebElementNotFoundExceptionpublic org.openqa.selenium.WebElement assertElement(String text) throws WebElementNotFoundException
WebElementNotFoundExceptionprotected String getPageSource()
protected String getPageSource(org.openqa.selenium.WebDriver d)
protected String getPrettyPageSource()
JsoupTools.prettyFormatHtml(java.lang.String, boolean), so beware that some
content may get truncated for nicer display.public void sleep(int secs)
public String getXPathForActiveElement()
public String getXPath(org.openqa.selenium.WebElement webElement)
public String getXPathSimple(org.openqa.selenium.WebElement webElement)
public org.openqa.selenium.WebElement activeElement()
Copyright © 2016 Github jjYBdx4IL Projects. All rights reserved.