Groovy Documentation

geb
[Groovy] Class Page

java.lang.Object
  geb.Page
All Implemented Interfaces:
Navigable, PageContentContainer

class Page

The Page type is the basis of the Page Object pattern in Geb.

This implementation is a generic model of every page. Subclasses add methods and content definitions that model specific pages.

This class (or subclasses) should not be instantiated directly.

The following classes are also mixed in to this class:

See the chapter in the Geb manual on pages for more information on writing subclasses.


Property Summary
static def at

The "at checker" for this page.

static def url

Defines the url for this page to be used when navigating directly to this page.

 
Method Summary
Navigator $()

Navigator $(int index)

Navigator $(Range range)

Navigator $(String selector)

Navigator $(String selector, int index)

Navigator $(String selector, Range range)

Navigator $(Map attributes)

Navigator $(Map attributes, int index)

Navigator $(Map attributes, Range range)

Navigator $(Map attributes, String selector)

Navigator $(Map attributes, String selector, int index)

Navigator $(Map attributes, String selector, Range range)

Navigator $(Navigator[] navigators)

Navigator $(WebElement[] elements)

String convertToPath(Object[] args)

Converts the arguments to a path to be appended to this page's url.

Navigator find()

Navigator find(int index)

Navigator find(Range range)

Navigator find(String selector)

Navigator find(String selector, int index)

Navigator find(String selector, Range range)

Navigator find(Map attributes)

Navigator find(Map attributes, int index)

Navigator find(Map attributes, Range range)

Navigator find(Map attributes, String selector)

Navigator find(Map attributes, String selector, int index)

Navigator find(Map attributes, String selector, Range range)

Browser getBrowser()

The browser that the page is connected to.

WebDriver getDriver()

The driver of the browser that the page is connected to.

JavascriptInterface getJs()

Provides access to the browser object's JavaScript interface.

String getPageUrl()

Returns the constant part of the url to this page.

String getPageUrl(String path)

Returns the url to this page, with path appended to it.

String getTitle()

Returns the title of the current browser window.

Page init(Browser browser)

Initialises this page instance, connecting it to the browser.

void onLoad(Page previousPage)

Lifecycle method called when the page is connected to the browser.

void onUnload(Page nextPage)

Lifecycle method called when this page is being replaced as the browser's page instance.

void to(Map params, Object[] args)

Sends the browser to this page's url.

String toString()

Returns the simple name of this class.

boolean verifyAt()

Checks if the browser is not at an unexpected page and then executes this page's "at checker".

boolean verifyAtSafely(boolean allowAtCheckWaiting = true)

Executes this page's "at checker", suppressing any AssertionError that is thrown and returning false.

 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Property Detail

at

static def at
The "at checker" for this page.

Subclasses should define a closure here that verifies that the browser is at this page.

This implementation does not have an at checker (i.e. this property is null)


url

static def url
Defines the url for this page to be used when navigating directly to this page.

Subclasses can specify either an absolute url, or one relative to the browser's base url.

This implementation returns an empty string.

See Also:
to(Map, Object [])


 
Method Detail

$

Navigator $()


$

Navigator $(int index)


$

Navigator $(Range range)


$

Navigator $(String selector)


$

Navigator $(String selector, int index)


$

Navigator $(String selector, Range range)


$

Navigator $(Map attributes)


$

Navigator $(Map attributes, int index)


$

Navigator $(Map attributes, Range range)


$

Navigator $(Map attributes, String selector)


$

Navigator $(Map attributes, String selector, int index)


$

Navigator $(Map attributes, String selector, Range range)


$

Navigator $(Navigator[] navigators)


$

Navigator $(WebElement[] elements)


convertToPath

String convertToPath(Object[] args)
Converts the arguments to a path to be appended to this page's url.

This is called by the to(Map, Object []) method and can be used for accessing variants of the page.

This implementation returns the string value of each argument, separated by "/"


find

Navigator find()


find

Navigator find(int index)


find

Navigator find(Range range)


find

Navigator find(String selector)


find

Navigator find(String selector, int index)


find

Navigator find(String selector, Range range)


find

Navigator find(Map attributes)


find

Navigator find(Map attributes, int index)


find

Navigator find(Map attributes, Range range)


find

Navigator find(Map attributes, String selector)


find

Navigator find(Map attributes, String selector, int index)


find

Navigator find(Map attributes, String selector, Range range)


getBrowser

Browser getBrowser()
The browser that the page is connected to.


getDriver

WebDriver getDriver()
The driver of the browser that the page is connected to.


getJs

JavascriptInterface getJs()
Provides access to the browser object's JavaScript interface.
See Also:
Browser.getJs


getPageUrl

String getPageUrl()
Returns the constant part of the url to this page.

This implementation returns the static url property of the class.


getPageUrl

String getPageUrl(String path)
Returns the url to this page, with path appended to it.
See Also:
getPageUrl()


getTitle

String getTitle()
Returns the title of the current browser window.
See Also:
WebDriver.getTitle


init

@SuppressWarnings('SpaceBeforeOpeningBrace')
Page init(Browser browser)
Initialises this page instance, connecting it to the browser.

This method is called internally, and should not be called by users of Geb.


onLoad

void onLoad(Page previousPage)
Lifecycle method called when the page is connected to the browser.

This implementation does nothing.

Parameters:
previousPage - The page that was active before this one


onUnload

void onUnload(Page nextPage)
Lifecycle method called when this page is being replaced as the browser's page instance.

This implementation does nothing.

Parameters:
nextPage - The page that will be active after this one


to

void to(Map params, Object[] args)
Sends the browser to this page's url.
Parameters:
params - request parameters to be appended to the url
args - "things" that can be used to generate an extra path to append to this page's url
See Also:
convertToPath(Object [])
getPageUrl(String)


toString

String toString()
Returns the simple name of this class.
See Also:
Class.getSimpleName


verifyAt

boolean verifyAt()
Checks if the browser is not at an unexpected page and then executes this page's "at checker".
throws:
AssertionError if this page's "at checker" doesn't pass (with implicit assertions enabled)
throws:
UnexpectedPageException when at an unexpected page
Returns:
whether the at checker succeeded or not.
See Also:
verifyAtSafely()


verifyAtSafely

boolean verifyAtSafely(boolean allowAtCheckWaiting = true)
Executes this page's "at checker", suppressing any AssertionError that is thrown and returning false.
Returns:
whether the at checker succeeded or not.
See Also:
verifyAt()


 

Groovy API Documentation for Geb 0.9.3 - Licensed under the Apache License, Version 2.0 - http://www.gebish.org