Graphene WebDriver: Implementation 2.0.0.Alpha1

org.jboss.arquillian.graphene.context
Class GrapheneContext

java.lang.Object
  extended by org.jboss.arquillian.graphene.context.GrapheneContext

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.

Author:
Lukas Fryc

Method Summary
static org.openqa.selenium.WebDriver getProxy()
          Returns the instance of proxy to thread local context of WebDriver
static
<T extends org.openqa.selenium.WebDriver>
T
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 extends org.openqa.selenium.WebDriver>
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 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

set

public static void set(org.openqa.selenium.WebDriver driver)
Sets the WebDriver context for current thread

Parameters:
driver - the WebDriver instance
Throws:
IllegalArgumentException - when provided WebDriver instance is null

reset

public static void reset()
Resets the WebDriver context for current thread


isInitialized

public static boolean isInitialized()
Returns true if the context is initialized

Returns:
true if the context is initialized

getProxy

public static org.openqa.selenium.WebDriver getProxy()
Returns the instance of proxy to thread local context of WebDriver

Returns:
the instance of proxy to thread local context of WebDriver

getProxyForDriver

public static <T extends org.openqa.selenium.WebDriver> T 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.

Returns:
the instance of proxy to thread local context of WebDriver

getProxyForInterfaces

public static <T extends org.openqa.selenium.WebDriver> T getProxyForInterfaces(Class<?>... interfaces)
Returns the instance of proxy to thread local context of WebDriver, the proxy handles all the interfaces provided as parameter.

Returns:
the instance of proxy to thread local context of WebDriver

Graphene WebDriver: Implementation 2.0.0.Alpha1

Copyright © 2012 JBoss by Red Hat. All Rights Reserved.