NAME
Weasel::Session - Connection to an encapsulated test driver
VERSION
0.01
SYNOPSIS
use Weasel;
use Weasel::Session;
use Weasel::Driver::Selenium2;
my $weasel = Weasel->new(
default_session => 'default',
sessions => {
default => Weasel::Session->new(
driver => Weasel::Driver::Selenium2->new(%opts),
),
});
$weasel->session->get('http://localhost/index');
DESCRIPTION
ATTRIBUTES
- driver
-
Holds a reference to the sessions's driver.
- widget_groups
-
Contains the list of widget groups to be
- base_url
-
Holds the prefix that will be prepended to every URL passed to this API.
- page
-
Holds the root element of the target HTML page (the 'html' tag).
- page_class
-
Upon instantiation can be set to an alternative class name for the
page
attribute. - retry_timeout
-
The number of seconds to poll for a condition to become true. Global setting for the
wait_for
function. - poll_delay
-
The number of seconds to wait between state polling attempts. Global setting for the
wait_for
function.
METHODS
- clear($element)
-
Clears any input entered into elements supporting it. Generally applies to textarea elements and input elements of type text and password.
- click([$element])
-
Simulates a single mouse click. If an element argument is provided, that element is clicked. Otherwise, the browser window is clicked at the current mouse location.
- find($element, $locator [, scheme => $scheme] [, %locator_args])
-
Finds the first child of
$element
matching$locator
.See Weasel::Element's
find
function for more documentation. - find_all($element, $locator, [, scheme => $scheme] [, %locator_args ])
-
Finds all child elements of
$element
matching$locator
. Returns, depending on scalar or list context, an arrayref or a list with matching elements.See Weasel::Element's
find_all
function for more documentation. - get($url)
-
Loads
$url
into the active browser window of the driver connection, after prefixing withbase_url
. - get_attribute($element, $attribute)
-
Returns the value of the attribute named by
$attribute
of the element identified by$element
, orundef
if the attribute isn't defined. - get_text($element)
-
Returns the 'innerHTML' of the element identified by
$element
. - is_displayed($element)
-
Returns a boolean value indicating if the element identified by
$element
is visible on the page, i.e. that it can be scrolled into the viewport for interaction. - screenshot($fh)
-
Writes a screenshot of the browser's window to the filehandle
$fh
.Note: this version assumes pictures of type PNG will be written; later versions may provide a means to query the exact image type of screenshots being generated.
- send_keys($element, @keys)
-
Send the characters specified in the strings in
@keys
to$element
, simulating keyboard input. - tag_name($element)
-
Returns the tag name of the element identified by
$element
. - wait_for($callback, [ retry_timeout => $number,] [poll_delay => $number])
-
Polls $callback->() until it returns true, or
wait_timeout
expires -- whichever comes first.The arguments retry_timeout and poll_delay can be used to override the session-global settings.
- _wrap_widget($_id)
-
Finds all matching widget selectors to wrap the driver element in.
In case of multiple matches, selects the most specific match (the one with the highest number of requirements).
SEE ALSO
COPYRIGHT
(C) 2016 Erik Huelsmann
Licensed under the same terms as Perl.