public abstract class TestBenchTestCase extends Object implements HasDriver, HasTestBenchCommandExecutor, HasElementQuery
Modifier and Type | Field and Description |
---|---|
protected org.openqa.selenium.WebDriver |
driver |
RetryRule |
maxAttempts
Specifies retry count, which is used to run same test several times.
|
static String |
testbenchVersion |
Constructor and Description |
---|
TestBenchTestCase() |
Modifier and Type | Method and Description |
---|---|
protected String |
concatUrl(String baseUrl,
String uri)
Combines a base URL with an URI to create a final URL.
|
protected Object |
executeScript(String script,
Object... args)
Executes the given JavaScript in the context of the currently selected
frame or window.
|
org.openqa.selenium.WebElement |
findElement(org.openqa.selenium.By by) |
List<org.openqa.selenium.WebElement> |
findElements(org.openqa.selenium.By by) |
TestBenchCommandExecutor |
getCommandExecutor()
Return a reference to the related
TestBenchCommandExecutor
instance. |
org.openqa.selenium.SearchContext |
getContext()
Get a reference or a new instance of the SearchContext applicable to this
class
|
org.openqa.selenium.WebDriver |
getDriver()
Returns the
WebDriver instance previously specified by
setDriver(org.openqa.selenium.WebDriver) , or (if the previously
provided WebDriver instance was not already a
TestBenchDriverProxy instance) a TestBenchDriverProxy
that wraps that driver. |
void |
setDriver(org.openqa.selenium.WebDriver driver)
Sets the active
WebDriver that is used by this this case |
TestBenchCommands |
testBench()
Convenience method the return
TestBenchCommands for the default
WebDriver instance. |
protected <T> T |
waitUntil(org.openqa.selenium.support.ui.ExpectedCondition<T> condition)
Waits up to 10 seconds for the given condition to become neither null nor
false.
|
protected <T> T |
waitUntil(org.openqa.selenium.support.ui.ExpectedCondition<T> condition,
long timeoutInSeconds)
Waits the given number of seconds for the given condition to become
neither null nor false.
|
<T extends TestBenchElement> |
wrap(Class<T> elementType,
org.openqa.selenium.WebElement element)
Decorates the element with the specified Element type, making it possible
to use component-specific API on elements found using standard Selenium
API.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
$, $
public static final String testbenchVersion
public RetryRule maxAttempts
protected org.openqa.selenium.WebDriver driver
public TestBenchCommands testBench()
TestBenchCommands
for the default
WebDriver
instance.protected String concatUrl(String baseUrl, String uri)
baseUrl
- the base URLuri
- the URIpublic org.openqa.selenium.WebDriver getDriver()
WebDriver
instance previously specified by
setDriver(org.openqa.selenium.WebDriver)
, or (if the previously
provided WebDriver instance was not already a
TestBenchDriverProxy
instance) a TestBenchDriverProxy
that wraps that driver.public void setDriver(org.openqa.selenium.WebDriver driver)
WebDriver
that is used by this this casedriver
- The WebDriver instance to set.public org.openqa.selenium.SearchContext getContext()
HasSearchContext
getContext
in interface HasSearchContext
SearchContext
instancepublic TestBenchCommandExecutor getCommandExecutor()
HasTestBenchCommandExecutor
TestBenchCommandExecutor
instance.getCommandExecutor
in interface HasTestBenchCommandExecutor
public org.openqa.selenium.WebElement findElement(org.openqa.selenium.By by)
public List<org.openqa.selenium.WebElement> findElements(org.openqa.selenium.By by)
public <T extends TestBenchElement> T wrap(Class<T> elementType, org.openqa.selenium.WebElement element)
elementType
- The type (class) containing the API to decorate withelement
- The element instance to decorateprotected Object executeScript(String script, Object... args)
This method wraps any returned WebElement
as
TestBenchElement
.
script
- the script to executeargs
- the arguments, available in the script as
arguments[0]...arguments[N]
JavascriptExecutor.executeScript(String, Object...)
returnsUnsupportedOperationException
- if the underlying driver does not support JavaScript
executionJavascriptExecutor.executeScript(String, Object...)
protected <T> T waitUntil(org.openqa.selenium.support.ui.ExpectedCondition<T> condition, long timeoutInSeconds)
NotFoundException
s are ignored by
default.
Use e.g. as
waitUntil(ExpectedConditions.presenceOfElementLocated(by), 10);
condition
- Models a condition that might reasonably be expected to
eventually evaluate to something that is neither null nor
false.timeoutInSeconds
- The timeout in seconds for the wait.org.openqa.selenium.TimeoutException
- If the timeout expires.FluentWait.until(java.util.function.Function<? super T, V>)
,
ExpectedCondition
protected <T> T waitUntil(org.openqa.selenium.support.ui.ExpectedCondition<T> condition)
NotFoundException
s are ignored by default.
Use e.g. as
waitUntil(ExpectedConditions.presenceOfElementLocated(by));
condition
- Models a condition that might reasonably be expected to
eventually evaluate to something that is neither null nor
false.org.openqa.selenium.TimeoutException
- If 10 seconds passed.FluentWait.until(java.util.function.Function<? super T, V>)
,
ExpectedCondition
Copyright © 2018. All rights reserved.