public class Graphene extends Object
The Graphene
utility is entry point for concise Graphene syntax of operating with browser.
It contains useful methods not only for waiting on certain browser actions.
It is recommended to import the class members statically:
import static org.jboss.arquillian.graphene.Graphene.*;
or let add the class static members to favorites in your IDE.
Request Guards are coarse-grained and concise way how to declare that given interaction with browser leads to a server request of certain type.
guardHttp(Object)
) / guardAjax(Object)
- guards that given request was donewaitForHttp(Object)
- guards that full page reload was doneguardNoRequest(Object)
- guards that no request was doneThis API serves as a base for defining explicit conditions for which the execution of browser should wait for.
waitGui()
- guards fast GUI actions - very fast interactions without need to reach server or do any time-consumingwaitAjax()
- guards regular AJAX actions - fast interaction with tested serverwaitModel()
- guards heavy computation or network-utilization (typically server-side)goTo(Class)
- navigates the browser into a page given by provided page object class and returns this page instancecreatePageFragment(Class, WebElement)
- creates a page fragments of given type by specifying a root element where given fragments is locatedConstructor and Description |
---|
Graphene() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
createPageFragment(Class<T> type,
org.openqa.selenium.WebElement root)
Creates page fragment of given type with given element as a root.
|
static <T> T |
goTo(Class<T> pageObject)
Requests navigation to a page represented by given page object.
|
static <T> T |
goTo(Class<T> pageObject,
Class<?> browserQualifier)
Requests navigation to a page represented by given page object.
|
static <T> T |
guardAjax(T target)
Returns the guarded object checking whether the Ajax (XHR) request is done during each method invocation.
|
static <T> T |
guardHttp(T target)
Returns the guarded object checking whether the HTTP request is done during each object's method invocation.
|
static <T> T |
guardNoRequest(T target)
Returns the guarded object checking that no request is done during each method invocation.
|
static WebDriverWait<Void> |
waitAjax()
waitAjax() is entry point for fluent waiting API specification, e.g.:
waitAjax().until().element(button).isVisible();
waitAjax() guards regular AJAX actions - fast interaction with tested server. |
static WebDriverWait<Void> |
waitAjax(org.openqa.selenium.WebDriver driver)
waitAjax() is entry point for fluent waiting API specification, e.g.:
waitAjax(browser).until().element(button).isVisible();
waitAjax() guards regular AJAX actions - fast interaction with tested server. |
static <T> T |
waitForHttp(T target)
Returns the guarded object checking that HTTP request has happen after any object's method invocation.
|
static WebDriverWait<Void> |
waitGui()
|
static WebDriverWait<Void> |
waitGui(org.openqa.selenium.WebDriver driver)
waitGui(WebDriver) is entry point for fluent waiting API specification, e.g.:
waitGui(browser).until().element(popupPanel).isVisible();
waitGui(WebDriver) guards fast GUI actions - very fast interactions without need to reach server or do any
time-consuming computations. |
static WebDriverWait<Void> |
waitModel()
waitModel() is entry point for fluent waiting API specification, e.g.:
waitModel().until().element(button).isVisible();
waitModel() guards heavy computation or network-utilization interactions (typically server-side). |
static WebDriverWait<Void> |
waitModel(org.openqa.selenium.WebDriver driver)
waitModel(WebDriver) is entry point for fluent waiting API specification, e.g.:
waitModel(browser).until().element(button).isVisible();
waitModel(WebDriver) guards heavy computation or network-utilization (typically server-side). |
public static <T> T guardHttp(T target)
RequestGuardException
is thrown.T
- type of the given targettarget
- object to be guardedRequestGuardException
- when no HTTP request is observedpublic static <T> T guardAjax(T target)
RequestGuardException
is thrown.T
- type of the given targettarget
- object to be guardedRequestGuardException
- when no AJAX (XHR) request is observedpublic static <T> T guardNoRequest(T target)
RequestGuardException
is thrown.T
- type of the given targettarget
- object to be guardedRequestGuardException
- when HTTP or AJAX request is observedpublic static <T> T waitForHttp(T target)
T
- type of the given targettarget
- object to be guardedRequestGuardException
- when no HTTP request is observedpublic static WebDriverWait<Void> waitAjax()
waitAjax()
is entry point for fluent waiting API specification, e.g.:
waitAjax().until().element(button).isVisible();
waitAjax()
guards regular AJAX actions - fast interaction with tested server.waitAjax(WebDriver)
,
waitGui()
,
waitModel()
public static WebDriverWait<Void> waitAjax(org.openqa.selenium.WebDriver driver)
waitAjax()
is entry point for fluent waiting API specification, e.g.:
waitAjax(browser).until().element(button).isVisible();
waitAjax()
guards regular AJAX actions - fast interaction with tested server.waitAjax()
,
waitGui(WebDriver)
,
waitModel(WebDriver)
public static WebDriverWait<Void> waitGui()
waitGui()
is entry point for fluent waiting API specification, e.g.:
waitGui().until().element(popupPanel).isVisible();
waitGui()
guards fast GUI actions - very fast interactions without need to reach server or do any time-consuming
computations.waitGui(WebDriver)
,
waitAjax()
,
waitModel()
public static WebDriverWait<Void> waitGui(org.openqa.selenium.WebDriver driver)
waitGui(WebDriver)
is entry point for fluent waiting API specification, e.g.:
waitGui(browser).until().element(popupPanel).isVisible();
waitGui(WebDriver)
guards fast GUI actions - very fast interactions without need to reach server or do any
time-consuming computations.waitGui()
,
waitAjax(WebDriver)
,
waitModel(WebDriver)
public static WebDriverWait<Void> waitModel()
waitModel()
is entry point for fluent waiting API specification, e.g.:
waitModel().until().element(button).isVisible();
waitModel()
guards heavy computation or network-utilization interactions (typically server-side).waitGui()
,
waitAjax()
,
waitModel(WebDriver)
public static WebDriverWait<Void> waitModel(org.openqa.selenium.WebDriver driver)
waitModel(WebDriver)
is entry point for fluent waiting API specification, e.g.:
waitModel(browser).until().element(button).isVisible();
waitModel(WebDriver)
guards heavy computation or network-utilization (typically server-side).waitGui()
,
waitAjax()
,
waitModel(WebDriver)
public static <T> T createPageFragment(Class<T> type, org.openqa.selenium.WebElement root)
type
- the page fragment classroot
- the root of a page fragment in a current pageRoot
public static <T> T goTo(Class<T> pageObject)
Requests navigation to a page represented by given page object.
The Page
object can be annotated with Location
annotation in order to support navigation between pages.
See documentation for Page
in order to know how to define Page
objects.
See documentation for InitialPage
in order to know how to define a page which should be used as initial page on a
start of a test.
pageObject
- page object classPage
,
InitialPage
public static <T> T goTo(Class<T> pageObject, Class<?> browserQualifier)
Requests navigation to a page represented by given page object.
The Page
object can be annotated with Location
annotation in order to support navigation between pages.
See documentation for Page
in order to know how to define Page
objects.
See documentation for InitialPage
in order to know how to define a page which should be used as initial page on a
start of a test.
pageObject
- page object classPage
,
InitialPage
Copyright © 2016 JBoss by Red Hat. All rights reserved.