Weasel::Element - The base HTML/Widget element class
0.02
my $element = $session->page->find("./input[\@name='phone']"); my $value = $element->send_keys('555-885-321');
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.
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
Required. Holds the element_id used by the session's driver to identify the element.
Finds the first child element matching c<$locator>. Returns undef when not found. Optionally takes a scheme argument to identify non-xpath type locators.
undef
In case the $locator 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.
$locator
Any arguments passed in the $widget_args array reference, are passed to the widget's constructor.
$widget_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.
Returns the value of the element's attribute named in $attribute or undef if none exists.
$attribute
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 undef.
Returns the element's 'innerHTML'.
Returns a boolean indicating if an element is visible (e.g. can potentially be scrolled into the viewport for interaction).
Scrolls the element into the viewport and simulates it being clicked on.
Focusses the element and simulates keyboard input. @keys can be any number of strings containing unicode characters to be sent. E.g.
@keys
$element->send_keys("hello", ' ', "world");
Returns the name of the tag of the element, e.g. 'div' or 'input'.
Erik Huelsmann
Erik Huelsmann Yves Lavoie
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.
(C) 2016-2019 Erik Huelsmann
Licensed under the same terms as Perl.
To install Weasel, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Weasel
CPAN shell
perl -MCPAN -e shell install Weasel
For more information on module installation, please visit the detailed CPAN module installation guide.