.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" 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::Element 3pm" .TH Weasel::Element 3pm "2023-08-21" "perl v5.36.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::Element \- The base HTML/Widget element class .SH "VERSION" .IX Header "VERSION" 0.02 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& my $element = $session\->page\->find("./input[\e@name=\*(Aqphone\*(Aq]"); \& my $value = $element\->send_keys(\*(Aq555\-885\-321\*(Aq); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module provides the base class for all page elements, encapsulating the regular element interactions, such as finding child element, querying attributes and the tag name, etc. .SH "DEPENDENCIES" .IX Header "DEPENDENCIES" .SH "ATTRIBUTES" .IX Header "ATTRIBUTES" .IP "session" 4 .IX Item "session" Required. Holds a reference to the Weasel::Session to which the element belongs. Used to access the session's driver to query element properties.x .IP "_id" 4 .IX Item "_id" Required. Holds the \fIelement_id\fR used by the session's driver to identify the element. .SH "SUBROUTINES/METHODS" .IX Header "SUBROUTINES/METHODS" .ie n .IP "find($locator [, scheme => $scheme] [, widget_args => \e@args ] [, %locator_args])" 4 .el .IP "find($locator [, scheme => \f(CW$scheme\fR] [, widget_args => \e@args ] [, \f(CW%locator_args\fR])" 4 .IX Item "find($locator [, scheme => $scheme] [, widget_args => @args ] [, %locator_args])" Finds the first child element matching c<$locator>. Returns \f(CW\*(C`undef\*(C'\fR when not found. Optionally takes a scheme argument to identify non-xpath type locators. .Sp In case the \f(CW$locator\fR is a mnemonic (starts with an asterisk ['*']), additional arguments may be provided for expansion of the mnemonic. See Weasel::FindExpanders::HTML for documentation of the standard expanders. .Sp Any arguments passed in the \f(CW$widget_args\fR array reference, are passed to the widget's constructor. .ie n .IP "find_all($locator [, scheme => $scheme] [, widget_args => \e@args ] [, %locator_args])" 4 .el .IP "find_all($locator [, scheme => \f(CW$scheme\fR] [, widget_args => \e@args ] [, \f(CW%locator_args\fR])" 4 .IX Item "find_all($locator [, scheme => $scheme] [, widget_args => @args ] [, %locator_args])" Returns, depending on scalar vs array context, a list or an arrayref with matching elements. Returns an empty list or ref to an empty array when none found. Optionally takes a scheme argument to identify non-xpath type locators. .Sp In case the \f(CW$locator\fR is a mnemonic (starts with an asterisk ['*']), additional arguments may be provided for expansion of the mnemonic. See Weasel::FindExpanders::HTML for documentation of the standard expanders. .Sp Any arguments passed in the \f(CW$widget_args\fR array reference, are passed to the widget's constructor. .IP "get_attribute($attribute)" 4 .IX Item "get_attribute($attribute)" Returns the value of the element's attribute named in \f(CW$attribute\fR or \&\f(CW\*(C`undef\*(C'\fR if none exists. .Sp Note: Some browsers apply default values to attributes which are not part of the original page. As such, there's no direct relation between the existence of attributes in the original page and this function returning \f(CW\*(C`undef\*(C'\fR. .Sp Note: Those users familiar with Selenium might be looking for a method called \f(CW\*(C`is_selected\*(C'\fR or \f(CW\*(C`set_selected\*(C'\fR. Weasel doesn't have that short-hand. Please use \f(CW\*(C`get_attribute\*(C'\fR/\f(CW\*(C`set_attribute\*(C'\fR with an attribute name of \f(CW\*(C`selected\*(C'\fR instead. .ie n .IP "set_attribute($attribute, $value)" 4 .el .IP "set_attribute($attribute, \f(CW$value\fR)" 4 .IX Item "set_attribute($attribute, $value)" Sets the value of the element's attribute named in \f(CW$attribute\fR. .Sp Note: Those users familiar with Selenium might be looking for a method called \f(CW\*(C`is_selected\*(C'\fR or \f(CW\*(C`set_selected\*(C'\fR. Weasel doesn't have that short-hand. Please use \f(CW\*(C`get_attribute\*(C'\fR/\f(CW\*(C`set_attribute\*(C'\fR with an attribute name of \f(CW\*(C`selected\*(C'\fR instead. .IP "\fBget_text()\fR" 4 .IX Item "get_text()" Returns the element's 'innerHTML'. .IP "has_class" 4 .IX Item "has_class" .PD 0 .IP "is_displayed" 4 .IX Item "is_displayed" .PD Returns a boolean indicating if an element is visible (e.g. can potentially be scrolled into the viewport for interaction). .IP "\fBclick()\fR" 4 .IX Item "click()" Scrolls the element into the viewport and simulates it being clicked on. .IP "send_keys(@keys)" 4 .IX Item "send_keys(@keys)" Focusses the element and simulates keyboard input. \f(CW@keys\fR can be any number of strings containing unicode characters to be sent. E.g. .Sp .Vb 1 \& $element\->send_keys("hello", \*(Aq \*(Aq, "world"); .Ve .IP "\fBtag_name()\fR" 4 .IX Item "tag_name()" Returns the name of the tag of the element, e.g. 'div' or 'input'. .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\-2023 Erik Huelsmann .Ve .PP Licensed under the same terms as Perl.