Weasel::FindExpanders - Mapping find patterns to xpath locators
0.01
use Weasel::FindExpanders qw( register_find_expander ); register_find_expander( 'button', 'HTML', sub { my %args = @_; $args{text} =~ s/'/''/g; # quote the quotes (XPath 2.0) return ".//button[text()='$args{text}']"; }); $session->find($session->page, "@button|{text=>\"whatever\"}");
Registers &expander_function as an expander for $pattern_name in $group_name.
&expander_function
$pattern_name
$group_name
Weasel::Session selects the expanders to be applied using its groups attribute.
Weasel::Session
groups
Returns a string of concatenated (using xpath '|' operator) expansions.
When $groups is undef, all groups will be searched for pattern_name.
$groups
pattern_name
If the pattern doesn't match '*<pattern_name>|{<arguments>}', the pattern is returned as the only list/arrayref element.
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-2023 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.