public final class GrapheneContext extends Object
Class for keeping thread local context of WebDriver.
Provides getProxy() method for accessing that context in model of your tests.
Proxy specifically handles the situations when no context is set - in this situation, runtime exception with NullPointerException cause is thrown.
| Modifier and Type | Method and Description |
|---|---|
static org.openqa.selenium.WebDriver |
getProxy()
Returns the instance of proxy to thread local context of WebDriver
|
static <T extends org.openqa.selenium.WebDriver> |
getProxyForDriver(Class<T> webDriverImplClass)
Returns the instance of proxy to thread local context of WebDriver, the proxy handles the same interfaces which
implements provided class.
|
static <T> T |
getProxyForInterfaces(Class<?>... interfaces)
Returns the instance of proxy to thread local context of WebDriver, the proxy handles all the interfaces provided as
parameter.
|
static boolean |
holdsInstanceOf(Class<?> clazz)
Returns true when the current context is the instance of provided class.
|
static boolean |
isInitialized()
Returns true if the context is initialized
|
static void |
reset()
Resets the WebDriver context for current thread
|
static void |
set(org.openqa.selenium.WebDriver driver)
Sets the WebDriver context for current thread
|
public static void set(org.openqa.selenium.WebDriver driver)
driver - the WebDriver instanceIllegalArgumentException - when provided WebDriver instance is nullpublic static void reset()
public static boolean isInitialized()
public static org.openqa.selenium.WebDriver getProxy()
public static <T extends org.openqa.selenium.WebDriver> T getProxyForDriver(Class<T> webDriverImplClass)
public static <T> T getProxyForInterfaces(Class<?>... interfaces)
public static boolean holdsInstanceOf(Class<?> clazz)
clazz - the class used to check current contextCopyright © 2012 JBoss by Red Hat. All Rights Reserved.