DOKK / manpages / debian 10 / libweasel-perl / Weasel::Session.3pm.en
Weasel::Session(3pm) User Contributed Perl Documentation Weasel::Session(3pm)

Weasel::Session - Connection to an encapsulated test driver

0.08

  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');

Holds a reference to the sessions's driver.
Contains the list of widget groups to be used with the session, or uses all groups when undefined.

Note: this functionality allows one to load multiple groups into the running perl instance, while using different groups in various sessions.

Holds the prefix that will be prepended to every URL passed to this API. The prefix can be an environment variable, e.g. ${VARIABLE}. It will be expanded and default to hppt://localhost:5000 if not defined. If it is not an environment variable, it will be used as is.
Holds the root element of the target HTML page (the 'html' tag).
Upon instantiation can be set to log consumer; a function of 3 arguments:
1. the name of the event
2. the text to be logged (or a coderef to be called without arguments returning such)
Upon instantiation can be set to an alternative class name for the "page" attribute.
The number of seconds to poll for a condition to become true. Global setting for the "wait_for" function.
The number of seconds to wait between state polling attempts. Global setting for the "wait_for" function.

Clears any input entered into elements supporting it. Generally applies to textarea elements and input elements of type text and password.
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.
Finds the first child of $element matching $locator.

See Weasel::Element's "find" function for more documentation.

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.

Loads $url into the active browser window of the driver connection, after prefixing with "base_url".
Returns the value of the attribute named by $attribute of the element identified by $element, or "undef" if the attribute isn't defined.
Returns the 'innerHTML' of the element identified by $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.
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.

Writes a get_page_source of the browser's window to the filehandle $fh.
Send the characters specified in the strings in @keys to $element, simulating keyboard input.
Returns the tag name of the element identified by $element.
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.

_logged($wrapped_fn, $event, $log_item, $log_item_pre)
Invokes "log_hook" when it's defined, before and after calling $wrapped_fn with no arguments, with the 'pre_' and 'post_' prefixes to the event name.

$log_item can be a fixed string or a function of one argument returning the string to be logged. The argument passed into the function is the value returned by the $wrapped_fn.

In case there is no $log_item_pre to be called on the 'pre_' event, $log_item will be used instead, with no arguments.

For performance reasons, the $log_item and $log_item_pre - when coderefs - aren't called; instead they are passed as-is to the $log_hook for lazy evaluation.

_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).

Weasel

Erik Huelsmann

Erik Huelsmann Yves Lavoie

Erik Huelsmann

Bugs can be filed in the GitHub issue tracker for the Weasel project:
https://github.com/perl-weasel/weasel/issues

The source code repository for Weasel is at
https://github.com/perl-weasel/weasel

Community support is available through perl-weasel@googlegroups.com <mailto:perl-weasel@googlegroups.com>.

 (C) 2016-2019  Erik Huelsmann

Licensed under the same terms as Perl.

2019-02-21 perl v5.28.1