Class GrapheneContext

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

public abstract class GrapheneContext extends Object

Allows to access current browser instance and configuration.

One needs to know the qualifier of a browser injected via @Drone annotation. The injection point can have qualifier. If no qualifier is specified, Default qualifier be used.

Author:
Jan Papousek
  • Constructor Details

    • GrapheneContext

      public GrapheneContext()
  • Method Details

    • getQualifier

      public abstract Class<?> getQualifier()
      Returns:
      qualifier identifying the context.
    • getWebDriver

      public abstract org.openqa.selenium.WebDriver getWebDriver(Class<?>... interfaces)
      If the WebDriver instance is not available yet, the returned proxy just implements WebDriver interface. If the WebDriver instance is available, its class is used to create a proxy, so the proxy extends it.
      Parameters:
      interfaces - interfaces which should be implemented by the returned WebDriver
      Returns:
      proxy for the WebDriver held in the context
    • getConfiguration

      public abstract GrapheneConfiguration getConfiguration()
      Returns configuration for the context
    • lastContext

      public static GrapheneContext lastContext()
      Returns last known context which has been access by a test
    • getContextFor

      public static GrapheneContext getContextFor(Class<?> qualifier)
      Get context associated to the given qualifier. If the Default qualifier is given, the returned context tries to resolves the active context before each method invocation. If the active context is available, the returned context behaves like the active one.
    • setContextFor

      public static GrapheneContext setContextFor(GrapheneConfiguration configuration, org.openqa.selenium.WebDriver driver, Class<?> qualifier)
      Creates a new context for the given webdriver, configuration and qualifier. When you create the context, you are responsible to invoke removeContextFor(java.lang.Class) after the context is no longer valid.
      Returns:
      created context
      See Also:
    • removeContextFor

      public static void removeContextFor(Class<?> qualifier)
      Removes the context associated to the given qualifier.
      Parameters:
      qualifier -
      See Also: