A Query to execute to extract the Element
implicit reference to the parent PageObject or PageModule
Finds and returns the first DOM Element selected by the specified Query
,
calls TestHelper.failTest
if element not found or more then one element was found.
Finds and returns the first DOM Element selected by the specified Query
,
calls TestHelper.failTest
if element not found or more then one element was found.
the Query
with which to search
the Untyped
element selected by this query
This value supports switching to the currently active element in PageObject DSL.
This value supports switching to the currently active element in PageObject DSL.
This class is enables the following syntax:
switch to activeElement ^
Add cookie in the web browser.
Add cookie in the web browser.
If the cookie's domain name is left blank (default), it is assumed that the cookie is meant for the domain of the current document.
cookie's name
cookie's value
cookie's path
cookie's expiry data
cookie's domain name
whether this cookie is secured.
the WebDriver
with which to drive the browser
This value supports switching to the alert box in PageObject DSL.
This value supports switching to the alert box in PageObject DSL.
This class is enables the following syntax:
switch to alertBox ^
Finds and returns the first button
or input type="button"
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a button.
Finds and returns the first button
or input type="button"
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a button.
the Query
with which to search
the TextField
selected by this query
Finds and returns the first Checkbox
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a Checkbox
.
Finds and returns the first Checkbox
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a Checkbox
.
the Query
with which to search
the Checkbox
selected by this query
Returns a class name query.
Returns a class name query.
This method enables syntax such as the following:
private val foo = $(className("foo"))
className("class") will select the same elements like cssSelector(".class"). See also the example in documentation of trait QueryDsl.
the query string for this query.
Finds and returns the first ColorField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a ColorField
.
Finds and returns the first ColorField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a ColorField
.
the Query
with which to search
the ColorField
selected by this query
Get a saved cookie from web browser, throws TestFailedException if the cookie does not exist.
Get a saved cookie from web browser, throws TestFailedException if the cookie does not exist.
cookie's name
a WrappedCookie instance
Returns a CSS selector query.
Returns a CSS selector query.
This method enables syntax such as the following:
private val foo = $(cssSelector("foo"))
See also the example in documentation of trait QueryDsl.
the query string for this query.
Finds and returns the first DateField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a DateField
.
Finds and returns the first DateField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a DateField
.
the Query
with which to search
the DateField
selected by this query
Finds and returns the first DateTimeField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a DateTimeField
.
Finds and returns the first DateTimeField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a DateTimeField
.
the Query
with which to search
the DateTimeField
selected by this query
Finds and returns the first DateTimeLocalField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a DateTimeLocalField
.
Finds and returns the first DateTimeLocalField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a DateTimeLocalField
.
the Query
with which to search
the DateTimeLocalField
selected by this query
This value supports switching to the default content in PageObject DSL.
This value supports switching to the default content in PageObject DSL.
This class is enables the following syntax:
switch to defaultContent ^
Delete all cookies in the current domain from web browser.
Delete all cookies in the current domain from web browser.
the WebDriver
with which to drive the browser
Delete cookie with the specified name from web browser, throws TestFailedException if the specified cookie does not exists.
Delete cookie with the specified name from web browser, throws TestFailedException if the specified cookie does not exists.
cookie's name
the WebDriver
with which to drive the browser
The Element this PageModule was chained to.
The Element this PageModule was chained to.
Finds and returns the first EmailField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a EmailField
.
Finds and returns the first EmailField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a EmailField
.
the Query
with which to search
the EmailField
selected by this query
Clears the current active TextField
or TextArea
, and presses the passed keys.
Clears the current active TextField
or TextArea
, and presses the passed keys.
Throws TestFailedException
if current active is not TextField
or TextArea
.
keys to press in current active TextField
or TextArea
Executes an asynchronous piece of JavaScript in the context of the currently selected frame or window.
Executes an asynchronous piece of JavaScript in the context of the currently selected frame or window.
Unlike executing synchronous JavaScript, scripts executed with this method must explicitly signal they are finished by invoking the provided callback. This callback is always injected into the executed function as the last argument.
The first argument passed to the callback function will be used as the script's result. This value will be handled as follows:
Script arguments must be a number, boolean, String, WebElement, or a List of any combination of these.
An exception will be thrown if the arguments do not meet these criteria.
The arguments will be made available to the JavaScript via the "arguments" variable. (Note that although this
behavior is specified by
Selenium's JavascriptExecutor Javadoc, it may still be possible for the underlying
JavascriptExecutor
implementation to return an objects of other types. For example,
HtmlUnit
has been observed to return a java.util.Map
for a Javascript object.)
the JavaScript to execute
the arguments to the script, may be empty
One of Boolean, Long, String, List, WebElement, or null (following Selenium's JavascriptExecutor Javadoc)
Executes JavaScript in the context of the currently selected frame or window.
Executes JavaScript in the context of the currently selected frame or window. The script fragment provided will be executed as the body of an anonymous function.
Within the script, you can use document
to refer to the current document.
Local variables will not be available once the script has finished executing, but global variables will.
To return a value (e.g. if the script contains a return statement), then the following steps will be taken:
Script arguments must be a number, boolean, String, WebElement, or a List of any combination of these.
An exception will be thrown if the arguments do not meet these criteria. The arguments will be made available
to the JavaScript via the "arguments" variable. (Note that although this behavior is specified by
Selenium's JavascriptExecutor Javadoc, it may still be possible for the underlying
JavascriptExecutor
implementation to return an objects of other types. For example,
HtmlUnit
has been observed to return a java.util.Map
for a Javascript object.)
the JavaScript to execute
the arguments to the script, may be empty
One of Boolean, Long, String, List or WebElement. Or null (following Selenium's JavascriptExecutor Javadoc)
Returns an ID query.
Returns an ID query.
This method enables syntax such as the following:
private val foo = $(id("foo"))
id("someid") will select the same elements like cssSelector("#someid"). See also the example in documentation of trait QueryDsl.
the query string for this query.
Returns a link text query.
Returns a link text query.
This method enables syntax such as the following:
private val foo = $(linkText("foo"))
See also the example in documentation of trait QueryDsl.
the query string for this query.
Creates a Seq of ElementPageModules, one module for each Element returned by Query.
Creates a Seq of ElementPageModules, one module for each Element returned by Query.
Example:
def todos = modules(xpath("li"), TodoEntryModule(_))
the Type of the ElementPageModule
the query to execute
A function returning a ElementPageModule for the given Element.
A Seq of created ElementPageModules, can be empty.
Finds and returns the first MonthField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a MonthField
.
Finds and returns the first MonthField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a MonthField
.
the Query
with which to search
the MonthField
selected by this query
Finds and returns the first MultiSel
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a MultiSel
.
Finds and returns the first MultiSel
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a MultiSel
.
the Query
with which to search
the MultiSel
selected by this query
Returns a name query.
Returns a name query.
This method enables syntax such as the following:
private val foo = $(name("foo"))
See also the example in documentation of trait QueryDsl.
the query string for this query.
Finds and returns the first NumberField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a NumberField
.
Finds and returns the first NumberField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a NumberField
.
the Query
with which to search
the NumberField
selected by this query
A Query to execute to extract the Element
Returns the source of the current page.
Returns the source of the current page.
This method invokes getPageSource
on the passed WebDriver
and returns the result.
the WebDriver
with which to drive the browser
the source of the current page
Returns the title of the current page, or the empty string if the current page has no title.
Returns the title of the current page, or the empty string if the current page has no title.
the WebDriver
with which to drive the browser
the current page's title, or the empty string if the current page has no title
The parent PageModule or PageObject
Returns a partial link text query.
Returns a partial link text query.
This method enables syntax such as the following:
private val foo = $(partialLinkText("foo"))
See also the example in documentation of trait QueryDsl.
the query string for this query.
Finds and returns the first PasswordField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a PasswordField
.
Finds and returns the first PasswordField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a PasswordField
.
the Query
with which to search
the PasswordField
selected by this query
Press the passed keys to current active element.
Press the passed keys to current active element.
keys to press in current active element
Finds and returns the first RadioButton
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a RadioButton
.
Finds and returns the first RadioButton
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a RadioButton
.
the Query
with which to search
the RadioButton
selected by this query
Finds and returns RadioButtonGroup
selected by the specified group name,
calls TestHelper.failTest
if no element with the specified group name is found,
or found any element with the specified group name but not a RadioButton
Finds and returns RadioButtonGroup
selected by the specified group name,
calls TestHelper.failTest
if no element with the specified group name is found,
or found any element with the specified group name but not a RadioButton
the group name with which to search
the WebDriver
with which to drive the browser
the RadioButtonGroup
selected by this query
Finds and returns the first RangeField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a RangeField
.
Finds and returns the first RangeField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a RangeField
.
the Query
with which to search
the RangeField
selected by this query
If you use a Locator in this PageModule, the Locator will only find child elements of this element.
If you use a Locator in this PageModule, the Locator will only find child elements of this element.
Element containg the PageModule
Finds and returns the first SearchField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a SearchField
.
Finds and returns the first SearchField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a SearchField
.
the Query
with which to search
the SearchField
selected by this query
Sets the amount of time to wait for an asynchronous script to finish execution before throwing an exception.
Sets the amount of time to wait for an asynchronous script to finish execution before throwing an exception.
the amount of time to wait for an asynchronous script to finish execution before throwing exception
Finds and returns the first SingleSel
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a SingleSel
.
Finds and returns the first SingleSel
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a SingleSel
.
the Query
with which to search
the SingleSel
selected by this query
Submit the form where current active element belongs to, and throws TestFailedException if current active element is not in a form or underlying WebDriver encounters problem when submitting the form.
Submit the form where current active element belongs to, and throws TestFailedException if current active element is not in a form or underlying WebDriver encounters problem when submitting the form.
If this causes the current page to change, this call will block until the new page is loaded.
the WebDriver
with which to drive the browser
Switch to the specified SwitchTarget
Switch to the specified SwitchTarget
the SwitchTarget
to switch to
the WebDriver
with which to drive the browser
instance of specified SwitchTarget
's type parameter
Returns a tag name query.
Returns a tag name query.
This method enables syntax such as the following:
private val foo = $(tagName("foo"))
tagName("div") will select the same elements like cssSelector("div"). See also the example in documentation of trait QueryDsl.
the query string for this query.
Finds and returns the first TelField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a TelField
.
Finds and returns the first TelField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a TelField
.
the Query
with which to search
the TelField
selected by this query
Finds and returns the first TextArea
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a TextArea
.
Finds and returns the first TextArea
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a TextArea
.
the Query
with which to search
the TextArea
selected by this query
Finds and returns the first TextField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a TextField
.
Finds and returns the first TextField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a TextField
.
the Query
with which to search
the TextField
selected by this query
Finds and returns the first TimeField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a TimeField
.
Finds and returns the first TimeField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a TimeField
.
the Query
with which to search
the TimeField
selected by this query
Finds and returns the first UrlField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a UrlField
.
Finds and returns the first UrlField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a UrlField
.
the Query
with which to search
the UrlField
selected by this query
Finds and returns the first WeekField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a WeekField
.
Finds and returns the first WeekField
selected by the specified Query
,
calls TestHelper.failTest
if element not found or the found element is not a WeekField
.
the Query
with which to search
the WeekField
selected by this query
Returns an XPath query.
Returns an XPath query.
This method enables syntax such as the following:
private val foo = $(xpath("foo"))
See also the example in documentation of trait QueryDsl.
the query string for this query.
Use this class if you want to create a PageModule chained to a Query.
It is required that the given Query will only return one Element, otherwise an Exception will be thrown.
If you want to create a list of PageModules, for every Element returned by Query, use PageBase.modules, implemented by PageObject and PageModule.
This class will requery the element every time it is accessed. Also see FixedQueryPageModule.
Example:
class FooterModule(implicit parent: ParentPageReference) extends DynamicQueryPageModule(IdQuery("footer"))