.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Weasel::DriverRole 3pm" .TH Weasel::DriverRole 3pm "2019-11-10" "perl v5.30.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Weasel::DriverRole \- API definition for driver wrappers .SH "VERSION" .IX Header "VERSION" 0.03 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use Moose; \& use Weasel::DriverRole; \& \& with \*(AqWeasel::DriverRole\*(Aq; \& \& ... # (re)implement the functions in Weasel::DriverRole .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module defines the \s-1API\s0 for all Weasel drivers to be implemented. .PP By using this role in the driver implementation module, an abstract method is implemented \fBcroak()\fRing if it's called. .SH "DEPENDENCIES" .IX Header "DEPENDENCIES" .SH "ATTRIBUTES" .IX Header "ATTRIBUTES" .IP "started" 4 .IX Item "started" Every session is associated with a driver instance. The \f(CW\*(C`started\*(C'\fR attribute holds a boolean value indicating whether or not the driver is ready to receive driver commands. .Sp The value managed by the \f(CW\*(C`start\*(C'\fR and \f(CW\*(C`stop\*(C'\fR methods. .SH "SUBROUTINES/METHODS" .IX Header "SUBROUTINES/METHODS" .IP "implements" 4 .IX Item "implements" This method returns the version number of the \s-1API\s0 which it fully implements. .Sp Weasel::Session may carp (warn) the user about mismatching \s-1API\s0 levels in case a driver is coded against an earlier version than \&\f(CW$Weasel::DriverRole::VERSION\fR. .IP "start" 4 .IX Item "start" This method allows setup of the driver. It is invoked before any web driver methods as per the Web driver methods section below. .IP "stop" 4 .IX Item "stop" This method allows tear-down of the driver. After tear-down, the \f(CW\*(C`start\*(C'\fR method may be called again, so the this function should leave the driver in a restartable state. .IP "restart" 4 .IX Item "restart" This function stops (if started) and starts the driver. .SS "Web driver methods" .IX Subsection "Web driver methods" \fITerms\fR .IX Subsection "Terms" .IP "element_id / parent_id" 4 .IX Item "element_id / parent_id" These are opaque values used by the driver to identify \s-1DOM\s0 elements. .Sp Note: The driver should always accept an xpath locator as an id value as well as id values returned from earlier driver calls .PP \fI\s-1API\s0\fR .IX Subsection "API" .ie n .IP "find_all( $parent_id, $locator, $scheme )" 4 .el .IP "find_all( \f(CW$parent_id\fR, \f(CW$locator\fR, \f(CW$scheme\fR )" 4 .IX Item "find_all( $parent_id, $locator, $scheme )" Returns the _id values for the elements to be instantiated, matching the \f(CW$locator\fR using \f(CW\*(C`scheme\*(C'\fR. .Sp Depending on array or scalar context, the return value is a list or an arrayref. .Sp Note: there's no function to find a single element. That function is implemented on the \f(CW\*(C`Weasel::Session\*(C'\fR level. .ie n .IP "get( $url )" 4 .el .IP "get( \f(CW$url\fR )" 4 .IX Item "get( $url )" Loads the page at \f(CW$url\fR into the driver's browser (browser emulator). .Sp The \f(CW$url\fR passed in has been expanded by \f(CW\*(C`Weasel::Session\*(C'\fR, prepending a registered prefix. .IP "is_displayed($element_id)" 4 .IX Item "is_displayed($element_id)" Returns a boolean value indicating whether the element indicated by \&\f(CW$element_id\fR is interactable (can be selected, clicked on, etc) .ie n .IP "wait_for( $callback, retry_timeout => $num, poll_delay => $num, on_timeout => \e&cb )" 4 .el .IP "wait_for( \f(CW$callback\fR, retry_timeout => \f(CW$num\fR, poll_delay => \f(CW$num\fR, on_timeout => \e&cb )" 4 .IX Item "wait_for( $callback, retry_timeout => $num, poll_delay => $num, on_timeout => &cb )" The driver may interpret the 'poll_delay' in one of two ways: 1. The 'poll_delay' equals the number of seconds between the start of successive poll requests 2. The 'poll_delay' equals the number of seconds to wait between the end of one poll request and the start of the next .Sp \&\fISince 0.03:\fR Unless an \f(CW\*(C`on_timeout\*(C'\fR callback is provided, will \f(CW\*(C`die\*(C'\fR when the timeout has exceeded. Otherwise, call the provided callback. .Sp Note: The user should catch inside the callback any exceptions that are thrown inside the callback, unless such exceptions are allowed to terminate further polling attempts. I.e. this function doesn't guard against early termination by catching exceptions. .IP "clear($element_id)" 4 .IX Item "clear($element_id)" Clicks on an element if an element id is provided, or on the current mouse location otherwise. .ie n .IP "click( [ $element_id ] )" 4 .el .IP "click( [ \f(CW$element_id\fR ] )" 4 .IX Item "click( [ $element_id ] )" Clicks on an element if an element id is provided, or on the current mouse location otherwise. .IP "\fBdblclick()\fR" 4 .IX Item "dblclick()" Double clicks on the current mouse location. .ie n .IP "get_attribute($element_id, $attribute_name)" 4 .el .IP "get_attribute($element_id, \f(CW$attribute_name\fR)" 4 .IX Item "get_attribute($element_id, $attribute_name)" Returns the value of the attribute named by \f(CW$attribute_name\fR of the element indicated by \f(CW$element_id\fR. .IP "get_page_source($fh)" 4 .IX Item "get_page_source($fh)" Writes a get_page_source of the browser's window to the filehandle \f(CW$fh\fR. .IP "get_text($element_id)" 4 .IX Item "get_text($element_id)" Returns the \s-1HTML\s0 content of the element identified by \f(CW$element_id\fR, the so-called 'innerHTML'. .ie n .IP "set_attribute($element_id, $attribute_name, $value)" 4 .el .IP "set_attribute($element_id, \f(CW$attribute_name\fR, \f(CW$value\fR)" 4 .IX Item "set_attribute($element_id, $attribute_name, $value)" \&\s-1DEPRECATED\s0 .Sp Changes the value of the attribute named by \f(CW$attribute_name\fR to \f(CW$value\fR for the element identified by \f(CW$element_id\fR. .IP "get_selected($element_id)" 4 .IX Item "get_selected($element_id)" \&\s-1DEPRECATED\s0 .Sp Please use \f(CW\*(C`$self\-\*(C'\fRget_attribute('selected')> instead. .ie n .IP "set_selected($element_id, $value)" 4 .el .IP "set_selected($element_id, \f(CW$value\fR)" 4 .IX Item "set_selected($element_id, $value)" \&\s-1DEPRECATED\s0 .Sp Please use \f(CW\*(C`$self\-\*(C'\fRset_attribute('selected', \f(CW$value\fR)> instead. .IP "screenshot($fh)" 4 .IX Item "screenshot($fh)" Takes a screenshot and writes the image to the file handle \f(CW$fh\fR. .Sp Note: In the current version of the driver, it's assumed the driver writes a \s-1PNG\s0 image. Later versions may add APIs to get/set the type of image generated. .ie n .IP "send_keys($element_id, @keys)" 4 .el .IP "send_keys($element_id, \f(CW@keys\fR)" 4 .IX Item "send_keys($element_id, @keys)" Simulates key input into the element identified by \f(CW$element_id\fR. .Sp \&\f(CW@keys\fR is an array of (groups of) inputs; multiple multi-character strings may be listed. In such cases the input will be appended. E.g. .Sp .Vb 1 \& $driver\->send_keys($element_id, "hello", \*(Aq \*(Aq, "world"); .Ve .Sp is valid input to enter the text \*(L"hello world\*(R" into \f(CW$element_id\fR. .Sp Note: Special keys are encoded according to the WebDriver spec. In case a driver implementation needs differentt encoding of special keys, this function should recode from the values found in \fBWebDriver::KEYS()\fR to the desired code-set .IP "tag_name($element_id)" 4 .IX Item "tag_name($element_id)" The name of the \s-1HTML\s0 tag identified by \f(CW$element_id\fR. .SH "SEE ALSO" .IX Header "SEE ALSO" Weasel .SH "AUTHOR" .IX Header "AUTHOR" Erik Huelsmann .SH "CONTRIBUTORS" .IX Header "CONTRIBUTORS" Erik Huelsmann Yves Lavoie .SH "MAINTAINERS" .IX Header "MAINTAINERS" Erik Huelsmann .SH "BUGS AND LIMITATIONS" .IX Header "BUGS AND LIMITATIONS" Bugs can be filed in the GitHub issue tracker for the Weasel project: https://github.com/perl\-weasel/weasel/issues .SH "SOURCE" .IX Header "SOURCE" The source code repository for Weasel is at https://github.com/perl\-weasel/weasel .SH "SUPPORT" .IX Header "SUPPORT" Community support is available through perl\-weasel@googlegroups.com . .SH "LICENSE AND COPYRIGHT" .IX Header "LICENSE AND COPYRIGHT" .Vb 1 \& (C) 2016 Erik Huelsmann .Ve .PP Licensed under the same terms as Perl.