| 1 | package Selenium::Remote::Driver; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 26 | $Selenium::Remote::Driver::VERSION = '1.49'; | |||||||||||||||||||||||||||||||||||||||||
| 3 | 26 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 26 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | # ABSTRACT: Perl Client for Selenium Remote Driver | ||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 26 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 26 | ▶ | use Try::Tiny; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 26 | ▶ | use 5.006; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 26 | ▶ | use v5.10.0; # Before 5.006, v5.10.0 would not be understood. | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | # See http://perldoc.perl.org/5.10.0/functions/use.html#use-VERSION | ||||||||||||||||||||||||||||||||||||||||||
| 15 | # and http://www.dagolden.com/index.php/369/version-numbers-should-be-boring/ | ||||||||||||||||||||||||||||||||||||||||||
| 16 | # for details. | ||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 26 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 26 | our @CARP_NOT; | |||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 26 | ▶ | use IO::String; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 26 | ▶ | use Archive::Zip qw( :ERROR_CODES ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 26 | ▶ | use Scalar::Util; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 26 | ▶ | use Selenium::Remote::RemoteConnection; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 26 | ▶ | use Selenium::Remote::Commands; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | 26 | ▶ | use Selenium::Remote::Spec; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 26 | ▶ | use Selenium::Remote::WebElement; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 26 | ▶ | use Selenium::Remote::WDKeys; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | 26 | ▶ | use File::Spec::Functions (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 26 | ▶ | use File::Basename qw(basename); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 26 | ▶ | use Sub::Install (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 26 | ▶ | use MIME::Base64 (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 26 | ▶ | use Time::HiRes qw(usleep); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 26 | ▶ | use Clone qw{clone}; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 26 | ▶ | use List::Util qw{any}; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | 26 | use constant FINDERS => { | |||||||||||||||||||||||||||||||||||||||||
| 38 | class => 'class name', | ||||||||||||||||||||||||||||||||||||||||||
| 39 | class_name => 'class name', | ||||||||||||||||||||||||||||||||||||||||||
| 40 | css => 'css selector', | ||||||||||||||||||||||||||||||||||||||||||
| 41 | id => 'id', | ||||||||||||||||||||||||||||||||||||||||||
| 42 | link => 'link text', | ||||||||||||||||||||||||||||||||||||||||||
| 43 | link_text => 'link text', | ||||||||||||||||||||||||||||||||||||||||||
| 44 | name => 'name', | ||||||||||||||||||||||||||||||||||||||||||
| 45 | partial_link_text => 'partial link text', | ||||||||||||||||||||||||||||||||||||||||||
| 46 | tag_name => 'tag name', | ||||||||||||||||||||||||||||||||||||||||||
| 47 | xpath => 'xpath', | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 26 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 26 | our $FORCE_WD2 = 0; | |||||||||||||||||||||||||||||||||||||||||
| 51 | 26 | our $FORCE_WD3 = 0; | |||||||||||||||||||||||||||||||||||||||||
| 52 | 26 | our %CURRENT_ACTION_CHAIN = ( actions => [] ); | |||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | has 'remote_server_addr' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 58 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 59 | 32 | ▶ | coerce => sub { ( defined( $_[0] ) ? $_[0] : 'localhost' ) }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | 28 | ▶ | default => sub { 'localhost' }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 26 | predicate => 1 | |||||||||||||||||||||||||||||||||||||||||
| 62 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | has 'browser_name' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 65 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 66 | 35 | ▶ | coerce => sub { ( defined( $_[0] ) ? $_[0] : 'firefox' ) }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 11 | ▶ | default => sub { 'firefox' }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | 26 | ); | |||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | has 'base_url' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 71 | is => 'lazy', | ||||||||||||||||||||||||||||||||||||||||||
| 72 | coerce => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 6 | ▶ | my $base_url = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | 6 | $base_url =~ s|/$||; | |||||||||||||||||||||||||||||||||||||||||
| 75 | 6 | return $base_url; | |||||||||||||||||||||||||||||||||||||||||
| 76 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 77 | 26 | predicate => 'has_base_url', | |||||||||||||||||||||||||||||||||||||||||
| 78 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | has 'platform' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 81 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 82 | 34 | ▶ | coerce => sub { ( defined( $_[0] ) ? $_[0] : 'ANY' ) }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | 32 | ▶ | default => sub { 'ANY' }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 84 | 26 | ); | |||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | has 'port' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 87 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 88 | 30 | ▶ | coerce => sub { ( defined( $_[0] ) ? $_[0] : '4444' ) }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | 29 | ▶ | default => sub { '4444' }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | 26 | predicate => 1 | |||||||||||||||||||||||||||||||||||||||||
| 91 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | has 'version' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 94 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 95 | 32 | ▶ | default => sub { '' }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 96 | 26 | ); | |||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | has 'webelement_class' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 99 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 100 | 23 | ▶ | default => sub { 'Selenium::Remote::WebElement' }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 101 | 26 | ); | |||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | has 'default_finder' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 104 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 105 | 40 | ▶ | coerce => sub { __PACKAGE__->FINDERS->{ $_[0] } }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | 31 | ▶ | default => sub { 'xpath' }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | 26 | ); | |||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | has 'session_id' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 110 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 111 | 31 | ▶ | default => sub { undef }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | 26 | ); | |||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | has 'remote_conn' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 115 | is => 'lazy', | ||||||||||||||||||||||||||||||||||||||||||
| 116 | builder => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 117 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 118 | 2 | return Selenium::Remote::RemoteConnection->new( | |||||||||||||||||||||||||||||||||||||||||
| 119 | remote_server_addr => $self->remote_server_addr, | ||||||||||||||||||||||||||||||||||||||||||
| 120 | port => $self->port, | ||||||||||||||||||||||||||||||||||||||||||
| 121 | ua => $self->ua, | ||||||||||||||||||||||||||||||||||||||||||
| 122 | wd_context_prefix => $self->wd_context_prefix | ||||||||||||||||||||||||||||||||||||||||||
| 123 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 124 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 125 | 26 | ); | |||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | has 'error_handler' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 128 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 129 | coerce => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 130 | 4 | ▶ | my ($maybe_coderef) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | 4 | ▶ | if ( ref($maybe_coderef) eq 'CODE' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | 3 | return $maybe_coderef; | |||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||
| 135 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 136 | 1 | croak 'The error handler must be a code ref.'; | |||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||
| 138 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 139 | 26 | clearer => 1, | |||||||||||||||||||||||||||||||||||||||||
| 140 | predicate => 1 | ||||||||||||||||||||||||||||||||||||||||||
| 141 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | has 'ua' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 144 | is => 'lazy', | ||||||||||||||||||||||||||||||||||||||||||
| 145 | 3 | ▶ | builder => sub { return LWP::UserAgent->new } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | 26 | ); | |||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | has 'commands' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 149 | is => 'lazy', | ||||||||||||||||||||||||||||||||||||||||||
| 150 | builder => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 151 | 21 | ▶ | return Selenium::Remote::Commands->new; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_commands: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 153 | 26 | ); | |||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | has 'commands_v3' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 156 | is => 'lazy', | ||||||||||||||||||||||||||||||||||||||||||
| 157 | builder => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 158 | 3 | ▶ | return Selenium::Remote::Spec->new; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 160 | 26 | ); | |||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | has 'auto_close' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 163 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 164 | 38 | ▶ | coerce => sub { ( defined( $_[0] ) ? $_[0] : 1 ) }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 165 | 31 | ▶ | default => sub { 1 }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | 26 | ); | |||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||
| 168 | has 'pid' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 169 | is => 'lazy', | ||||||||||||||||||||||||||||||||||||||||||
| 170 | 35 | ▶ | builder => sub { return $$ } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_pid: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 171 | 26 | ); | |||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | has 'javascript' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 174 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 175 | 34 | ▶ | coerce => sub { $_[0] ? JSON::true : JSON::false }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | 30 | ▶ | default => sub { return JSON::true } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 177 | 26 | ); | |||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | has 'accept_ssl_certs' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 180 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 181 | 35 | ▶ | coerce => sub { $_[0] ? JSON::true : JSON::false }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 182 | 35 | ▶ | default => sub { return JSON::true } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 183 | 26 | ); | |||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | has 'proxy' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 186 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 187 | coerce => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 188 | 4 | ▶ | my $proxy = $_[0]; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=6 SCAR=18.1
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | 4 | ▶ | if ( $proxy->{proxyType} =~ /^pac$/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 190 | 4 | ▶ | if ( not defined $proxy->{proxyAutoconfigUrl} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 191 | 1 | croak "proxyAutoconfigUrl not provided\n"; | |||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||
| 193 | elsif ( not( $proxy->{proxyAutoconfigUrl} =~ /^(http|file)/g ) ) { | ||||||||||||||||||||||||||||||||||||||||||
| 194 | 1 | croak | |||||||||||||||||||||||||||||||||||||||||
| 195 | "proxyAutoconfigUrl should be of format http:// or file://"; | ||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | 2 | ▶ | if ( $proxy->{proxyAutoconfigUrl} =~ /^file/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 199 | 1 | my $pac_url = $proxy->{proxyAutoconfigUrl}; | |||||||||||||||||||||||||||||||||||||||||
| 200 | 1 | my $file = $pac_url; | |||||||||||||||||||||||||||||||||||||||||
| 201 | 1 | $file =~ s{^file://}{}; | |||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | 1 | ▶ | if ( !-e $file ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | warn "proxyAutoConfigUrl file does not exist: '$pac_url'"; | |||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||
| 208 | 2 | $proxy; | |||||||||||||||||||||||||||||||||||||||||
| 209 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 210 | 26 | ); | |||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||
| 212 | has 'extra_capabilities' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 213 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 214 | 34 | ▶ | default => sub { {} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 215 | 26 | ); | |||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||
| 217 | has 'firefox_profile' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 218 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 219 | coerce => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 220 | 1 | ▶ | my $profile = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=13.3
| |||||||||||||||||||||||||||||||||||||||||||
| 221 | 1 | ▶ | unless ( Scalar::Util::blessed($profile) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
builtin::blessed($profile) and $profile->isa("Selenium::Firefox::Profile")
MC/DC0%0/2
builtin::blessed($profile) and $profile->isa("Selenium::Firefox::Profile")
builtin::blessed($profile)
$profile->isa("Selenium::Firefox::Profile")
Truth table33%1/3
A and B
A= builtin::blessed($profile)B= $profile->isa("Selenium::Firefox::Profile")
| |||||||||||||||||||||||||||||||||||||||||||
| 222 | && $profile->isa('Selenium::Firefox::Profile') ) | ||||||||||||||||||||||||||||||||||||||||||
| 223 | { | ||||||||||||||||||||||||||||||||||||||||||
| 224 | 1 | croak "firefox_profile should be a Selenium::Firefox::Profile\n"; | |||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | return $profile; | |||||||||||||||||||||||||||||||||||||||||
| 228 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 229 | 26 | predicate => 'has_firefox_profile', | |||||||||||||||||||||||||||||||||||||||||
| 230 | clearer => 1 | ||||||||||||||||||||||||||||||||||||||||||
| 231 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | has debug => ( | ||||||||||||||||||||||||||||||||||||||||||
| 234 | is => 'lazy', | ||||||||||||||||||||||||||||||||||||||||||
| 235 | 30 | ▶ | default => sub { 0 }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 236 | 26 | ); | |||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||
| 238 | 26 | has 'desired_capabilities' => ( | |||||||||||||||||||||||||||||||||||||||||
| 239 | is => 'lazy', | ||||||||||||||||||||||||||||||||||||||||||
| 240 | predicate => 'has_desired_capabilities' | ||||||||||||||||||||||||||||||||||||||||||
| 241 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||
| 243 | has 'inner_window_size' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 244 | is => 'lazy', | ||||||||||||||||||||||||||||||||||||||||||
| 245 | predicate => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 246 | coerce => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | my $size = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | ▶ | croak "inner_window_size must have two elements: [ height, width ]" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 250 | unless scalar @$size == 2; | ||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | foreach my $dim (@$size) { | |||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | ▶ | croak 'inner_window_size only accepts integers, not: ' . $dim | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 254 | unless Scalar::Util::looks_like_number($dim); | ||||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | return $size; | |||||||||||||||||||||||||||||||||||||||||
| 258 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||
| 260 | 26 | ); | |||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | # At the time of writing, Geckodriver uses a different endpoint than | ||||||||||||||||||||||||||||||||||||||||||
| 263 | # the java bindings for executing synchronous and asynchronous | ||||||||||||||||||||||||||||||||||||||||||
| 264 | # scripts. As a matter of fact, Geckodriver does conform to the W3C | ||||||||||||||||||||||||||||||||||||||||||
| 265 | # spec, but as are bound to support both while the java bindings | ||||||||||||||||||||||||||||||||||||||||||
| 266 | # transition to full spec support, we need some way to handle the | ||||||||||||||||||||||||||||||||||||||||||
| 267 | # difference. | ||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||
| 269 | 26 | has '_execute_script_suffix' => ( | |||||||||||||||||||||||||||||||||||||||||
| 270 | is => 'lazy', | ||||||||||||||||||||||||||||||||||||||||||
| 271 | default => '' | ||||||||||||||||||||||||||||||||||||||||||
| 272 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | 26 | with 'Selenium::Remote::Finders'; | |||||||||||||||||||||||||||||||||||||||||
| 275 | 26 | with 'Selenium::Remote::Driver::CanSetWebdriverContext'; | |||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||
| 277 | sub BUILD { | ||||||||||||||||||||||||||||||||||||||||||
| 278 | 32 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BUILD: called CC=8 SCAR=21.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | 32 | ▶ | if ( !( defined $self->session_id ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 281 | 31 | ▶ | if ( $self->has_desired_capabilities ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 282 | 5 | $self->new_desired_session( $self->desired_capabilities ); | |||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||
| 284 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 285 | # Connect to remote server & establish a new session | ||||||||||||||||||||||||||||||||||||||||||
| 286 | 26 | $self->new_session( $self->extra_capabilities ); | |||||||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||
| 290 | 30 | ▶ | if ( !( defined $self->session_id ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | croak "Could not establish a session with the remote server\n"; | |||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||
| 293 | elsif ( $self->has_inner_window_size ) { | ||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | my $size = $self->inner_window_size; | |||||||||||||||||||||||||||||||||||||||||
| 295 | 0 | $self->set_inner_window_size(@$size); | |||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||
| 298 | #Set debug if needed | ||||||||||||||||||||||||||||||||||||||||||
| 299 | 30 | ▶ | $self->debug_on() if $self->debug; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | # Setup non-croaking, parameter versions of finders | ||||||||||||||||||||||||||||||||||||||||||
| 302 | 30 | foreach my $by ( keys %{ $self->FINDERS } ) { | |||||||||||||||||||||||||||||||||||||||||
| 303 | 300 | my $finder_name = 'find_element_by_' . $by; | |||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | # In case we get instantiated multiple times, we don't want to | ||||||||||||||||||||||||||||||||||||||||||
| 306 | # install into the name space every time. | ||||||||||||||||||||||||||||||||||||||||||
| 307 | 300 | ▶ | unless ( $self->can($finder_name) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 308 | 110 | my $find_sub = $self->_build_find_by($by); | |||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||
| 310 | 110 | Sub::Install::install_sub( | |||||||||||||||||||||||||||||||||||||||||
| 311 | { | ||||||||||||||||||||||||||||||||||||||||||
| 312 | code => $find_sub, | ||||||||||||||||||||||||||||||||||||||||||
| 313 | into => __PACKAGE__, | ||||||||||||||||||||||||||||||||||||||||||
| 314 | as => $finder_name, | ||||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||
| 316 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||
| 321 | sub new_from_caps { | ||||||||||||||||||||||||||||||||||||||||||
| 322 | 4 | ▶ | my ( $self, %args ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new_from_caps: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||
| 324 | 4 | ▶ | if ( not exists $args{desired_capabilities} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 325 | 2 | $args{desired_capabilities} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||
| 328 | 4 | return $self->new(%args); | |||||||||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||
| 331 | sub DEMOLISH { | ||||||||||||||||||||||||||||||||||||||||||
| 332 | 38 | ▶ | my ( $self, $in_global_destruction ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DEMOLISH: called CC=5 SCAR=16.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 333 | 38 | ▶ | return if $$ != $self->pid; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 334 | 38 | ▶ | return if $in_global_destruction; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 335 | 38 | ▶ | $self->quit() if ( $self->auto_close && defined $self->session_id ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->auto_close and defined $self->session_id
MC/DC100%2/2
$self->auto_close and defined $self->session_id
$self->auto_close
defined $self->session_id
Truth table100%3/3
A and B
A= $self->auto_closeB= defined $self->session_id
| |||||||||||||||||||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||
| 338 | # We install an 'around' because we can catch more exceptions this way | ||||||||||||||||||||||||||||||||||||||||||
| 339 | # than simply wrapping the explicit croaks in _execute_command. | ||||||||||||||||||||||||||||||||||||||||||
| 340 | # @args should be fed to the handler to provide context | ||||||||||||||||||||||||||||||||||||||||||
| 341 | # return_value could be assigned from the handler if we want to allow the | ||||||||||||||||||||||||||||||||||||||||||
| 342 | # error_handler to handle the errors | ||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||
| 344 | around '_execute_command' => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 345 | 291 | ▶ | my $orig = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 346 | 291 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | # copy @_ because it gets lost in the way | ||||||||||||||||||||||||||||||||||||||||||
| 349 | 291 | my @args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 350 | 291 | my $return_value; | |||||||||||||||||||||||||||||||||||||||||
| 351 | try { | ||||||||||||||||||||||||||||||||||||||||||
| 352 | 291 | ▶ | $return_value = $orig->( $self, @args ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||
| 354 | catch { | ||||||||||||||||||||||||||||||||||||||||||
| 355 | 19 | ▶ | if ( $self->has_error_handler ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 356 | 1 | $return_value = $self->error_handler->( $self, $_, @args ); | |||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||
| 358 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 359 | 18 | croak $_; | |||||||||||||||||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||||||||||||||||
| 361 | 291 | }; | |||||||||||||||||||||||||||||||||||||||||
| 362 | 272 | return $return_value; | |||||||||||||||||||||||||||||||||||||||||
| 363 | 26 | }; | |||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||
| 365 | # This is an internal method used the Driver & is not supposed to be used by | ||||||||||||||||||||||||||||||||||||||||||
| 366 | # end user. This method is used by Driver to set up all the parameters | ||||||||||||||||||||||||||||||||||||||||||
| 367 | # (url & JSON), send commands & receive processed response from the server. | ||||||||||||||||||||||||||||||||||||||||||
| 368 | sub _execute_command { | ||||||||||||||||||||||||||||||||||||||||||
| 369 | my ( $self, $res, $params ) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 370 | $res->{'session_id'} = $self->session_id; | ||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||
| 372 | print "Prepping $res->{command}\n" if $self->{debug}; | ||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||
| 374 | #webdriver 3 shims | ||||||||||||||||||||||||||||||||||||||||||
| 375 | return $self->{capabilities} | ||||||||||||||||||||||||||||||||||||||||||
| 376 | if $res->{command} eq 'getCapabilities' && $self->{capabilities}; | ||||||||||||||||||||||||||||||||||||||||||
| 377 | $res->{ms} = $params->{ms} if $params->{ms}; | ||||||||||||||||||||||||||||||||||||||||||
| 378 | $res->{type} = $params->{type} if $params->{type}; | ||||||||||||||||||||||||||||||||||||||||||
| 379 | $res->{text} = $params->{text} if $params->{text}; | ||||||||||||||||||||||||||||||||||||||||||
| 380 | $res->{using} = $params->{using} if $params->{using}; | ||||||||||||||||||||||||||||||||||||||||||
| 381 | $res->{value} = $params->{value} if $params->{value}; | ||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||
| 383 | print "Executing $res->{command}\n" if $self->{debug}; | ||||||||||||||||||||||||||||||||||||||||||
| 384 | my $resource = | ||||||||||||||||||||||||||||||||||||||||||
| 385 | $self->{is_wd3} | ||||||||||||||||||||||||||||||||||||||||||
| 386 | ? $self->commands_v3->get_params($res) | ||||||||||||||||||||||||||||||||||||||||||
| 387 | : $self->commands->get_params($res); | ||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||
| 389 | #Fall-back to legacy if wd3 command doesn't exist | ||||||||||||||||||||||||||||||||||||||||||
| 390 | if ( !$resource && $self->{is_wd3} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 391 | print "Falling back to legacy selenium method for $res->{command}\n" | ||||||||||||||||||||||||||||||||||||||||||
| 392 | if $self->{debug}; | ||||||||||||||||||||||||||||||||||||||||||
| 393 | $resource = $self->commands->get_params($res); | ||||||||||||||||||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||
| 396 | #XXX InternetExplorerDriver quirks | ||||||||||||||||||||||||||||||||||||||||||
| 397 | if ( $self->{is_wd3} && $self->browser_name eq 'internet explorer' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 398 | delete $params->{ms}; | ||||||||||||||||||||||||||||||||||||||||||
| 399 | delete $params->{type}; | ||||||||||||||||||||||||||||||||||||||||||
| 400 | delete $resource->{payload}->{type}; | ||||||||||||||||||||||||||||||||||||||||||
| 401 | my $oldvalue = delete $params->{'page load'}; | ||||||||||||||||||||||||||||||||||||||||||
| 402 | $params->{pageLoad} = $oldvalue if $oldvalue; | ||||||||||||||||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||
| 405 | if ($resource) { | ||||||||||||||||||||||||||||||||||||||||||
| 406 | $params = {} unless $params; | ||||||||||||||||||||||||||||||||||||||||||
| 407 | my $resp = $self->remote_conn->request( $resource, $params ); | ||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||
| 409 | #In general, the parse_response for v3 is better, which is why we use it *even if* we are falling back. | ||||||||||||||||||||||||||||||||||||||||||
| 410 | return $self->commands_v3->parse_response( $res, $resp ) | ||||||||||||||||||||||||||||||||||||||||||
| 411 | if $self->{is_wd3}; | ||||||||||||||||||||||||||||||||||||||||||
| 412 | return $self->commands->parse_response( $res, $resp ); | ||||||||||||||||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||||||||||||||||
| 414 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 415 | #Tell the use about the offending setting. | ||||||||||||||||||||||||||||||||||||||||||
| 416 | croak "Couldn't retrieve command settings properly ".$res->{command}."\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 417 | } | ||||||||||||||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||||||||||||
| 421 | sub new_session { | ||||||||||||||||||||||||||||||||||||||||||
| 422 | 22 | ▶ | my ( $self, $extra_capabilities ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new_session: called CC=7 SCAR=20.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 423 | 22 | ▶ | $extra_capabilities ||= {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$extra_capabilities ||= {}
MC/DC0%0/1
$extra_capabilities ||= {}
$extra_capabilities
Truth table50%1/2
A
A= $extra_capabilities
| |||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||
| 425 | 22 | ▶ | my $args = { | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->version // ""
MC/DC0%0/1
$self->version // ""
$self->version
Truth table50%1/2
A
A= $self->version
| |||||||||||||||||||||||||||||||||||||||||||
| 426 | 'desiredCapabilities' => { | ||||||||||||||||||||||||||||||||||||||||||
| 427 | 'browserName' => $self->browser_name, | ||||||||||||||||||||||||||||||||||||||||||
| 428 | 'platform' => $self->platform, | ||||||||||||||||||||||||||||||||||||||||||
| 429 | 'javascriptEnabled' => $self->javascript, | ||||||||||||||||||||||||||||||||||||||||||
| 430 | 'version' => $self->version // '', | ||||||||||||||||||||||||||||||||||||||||||
| 431 | 'acceptSslCerts' => $self->accept_ssl_certs, | ||||||||||||||||||||||||||||||||||||||||||
| 432 | %$extra_capabilities, | ||||||||||||||||||||||||||||||||||||||||||
| 433 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 434 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 435 | 22 | ▶ | $args->{'extra_capabilities'} = \%$extra_capabilities unless $FORCE_WD2; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||
| 437 | 22 | ▶ | if ( defined $self->proxy ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 438 | 2 | $args->{desiredCapabilities}->{proxy} = $self->proxy; | |||||||||||||||||||||||||||||||||||||||||
| 439 | } | ||||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||
| 441 | 22 | ▶ | if ( $args->{desiredCapabilities}->{browserName} =~ /firefox/i | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$args->{"desiredCapabilities"}{"browserName"} =~ /firefox/i and $self->has_firefox_profile
MC/DC0%0/2
$args->{"desiredCapabilities"}{"browserName"} =~ /firefox/i and $self->has_firefox_profile
$args->{"desiredCapabilities"}{"browserName"} =~ /firefox/i
$self->has_firefox_profile
Truth table66%2/3
A and B
A= $args->{"desiredCapabilities"}{"browserName"} =~ /firefox/iB= $self->has_firefox_profile
| |||||||||||||||||||||||||||||||||||||||||||
| 442 | && $self->has_firefox_profile ) | ||||||||||||||||||||||||||||||||||||||||||
| 443 | { | ||||||||||||||||||||||||||||||||||||||||||
| 444 | $args->{desiredCapabilities}->{firefox_profile} = | ||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | $self->firefox_profile->_encode; | |||||||||||||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||
| 448 | 22 | $self->_request_new_session($args); | |||||||||||||||||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||
| 452 | sub new_desired_session { | ||||||||||||||||||||||||||||||||||||||||||
| 453 | 5 | ▶ | my ( $self, $caps ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new_desired_session: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||
| 455 | 5 | $self->_request_new_session( | |||||||||||||||||||||||||||||||||||||||||
| 456 | { | ||||||||||||||||||||||||||||||||||||||||||
| 457 | desiredCapabilities => $caps | ||||||||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||||||
| 459 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||
| 462 | sub _request_new_session { | ||||||||||||||||||||||||||||||||||||||||||
| 463 | 29 | ▶ | my ( $self, $args ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_request_new_session: called CC=37 SCAR=41.3
| |||||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||
| 465 | #XXX UGLY shim for webdriver3 | ||||||||||||||||||||||||||||||||||||||||||
| 466 | $args->{capabilities}->{alwaysMatch} = | ||||||||||||||||||||||||||||||||||||||||||
| 467 | 29 | clone( $args->{desiredCapabilities} ); | |||||||||||||||||||||||||||||||||||||||||
| 468 | 29 | my $cmap = $self->commands_v3->get_caps_map(); | |||||||||||||||||||||||||||||||||||||||||
| 469 | 29 | my $caps = $self->commands_v3->get_caps(); | |||||||||||||||||||||||||||||||||||||||||
| 470 | 29 | foreach my $cap ( keys( %{ $args->{capabilities}->{alwaysMatch} } ) ) { | |||||||||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||||||||
| 472 | #Handle browser specific capabilities | ||||||||||||||||||||||||||||||||||||||||||
| 473 | 136 | ▶ | if ( exists( $args->{desiredCapabilities}->{browserName} ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $args->{"desiredCapabilities"}{"browserName"} and $cap eq "extra_capabilities"
MC/DC50%1/2
exists $args->{"desiredCapabilities"}{"browserName"} and $cap eq "extra_capabilities"
exists $args->{"desiredCapabilities"}{"browserName"}
$cap eq "extra_capabilities"
Truth table66%2/3
A and B
A= exists $args->{"desiredCapabilities"}{"browserName"}B= $cap eq "extra_capabilities"
| |||||||||||||||||||||||||||||||||||||||||||
| 474 | && $cap eq 'extra_capabilities' ) | ||||||||||||||||||||||||||||||||||||||||||
| 475 | { | ||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||
| 477 | 2 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 478 | exists $args->{capabilities}->{alwaysMatch} | ||||||||||||||||||||||||||||||||||||||||||
| 479 | ->{'moz:firefoxOptions'}->{args} ) | ||||||||||||||||||||||||||||||||||||||||||
| 480 | { | ||||||||||||||||||||||||||||||||||||||||||
| 481 | $args->{capabilities}->{alwaysMatch}->{$cap}->{args} = | ||||||||||||||||||||||||||||||||||||||||||
| 482 | $args->{capabilities}->{alwaysMatch}->{'moz:firefoxOptions'} | ||||||||||||||||||||||||||||||||||||||||||
| 483 | 1 | ->{args}; | |||||||||||||||||||||||||||||||||||||||||
| 484 | } | ||||||||||||||||||||||||||||||||||||||||||
| 485 | $args->{capabilities}->{alwaysMatch}->{'moz:firefoxOptions'} = | ||||||||||||||||||||||||||||||||||||||||||
| 486 | $args->{capabilities}->{alwaysMatch}->{$cap} | ||||||||||||||||||||||||||||||||||||||||||
| 487 | 2 | ▶ | if $args->{desiredCapabilities}->{browserName} eq 'firefox'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||||||||||||||||
| 489 | #XXX the chrome documentation is lies, you can't do this yet | ||||||||||||||||||||||||||||||||||||||||||
| 490 | #$args->{capabilities}->{alwaysMatch}->{'goog:chromeOptions'} = $args->{capabilities}->{alwaysMatch}->{$cap} if $args->{desiredCapabilities}->{browserName} eq 'chrome'; | ||||||||||||||||||||||||||||||||||||||||||
| 491 | #Does not appear there are any MSIE based options, so let's just let that be | ||||||||||||||||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||||||||||||||
| 493 | 136 | ▶ | if ( exists( $args->{desiredCapabilities}->{browserName} ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
exists $args->{"desiredCapabilities"}{"browserName"} and $args->{"desiredCapabilities"}{"browserName"} eq "firefox" and $cap eq "firefox_profile"
exists $args->{"desiredCapabilities"}{"browserName"} and $args->{"desiredCapabilities"}{"browserName"} eq "firefox"
MC/DC66%2/3
exists $args->{"desiredCapabilities"}{"browserName"} and $args->{"desiredCapabilities"}{"browserName"} eq "firefox" and $cap eq "firefox_profile"
exists $args->{"desiredCapabilities"}{"browserName"}
$args->{"desiredCapabilities"}{"browserName"} eq "firefox"
$cap eq "firefox_profile"
Truth table75%3/4
A and B and C
A= exists $args->{"desiredCapabilities"}{"browserName"}B= $args->{"desiredCapabilities"}{"browserName"} eq "firefox"C= $cap eq "firefox_profile"
| |||||||||||||||||||||||||||||||||||||||||||
| 494 | && $args->{desiredCapabilities}->{browserName} eq 'firefox' | ||||||||||||||||||||||||||||||||||||||||||
| 495 | && $cap eq 'firefox_profile' ) | ||||||||||||||||||||||||||||||||||||||||||
| 496 | { | ||||||||||||||||||||||||||||||||||||||||||
| 497 | 2 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 498 | ref $args->{capabilities}->{alwaysMatch}->{$cap} eq | ||||||||||||||||||||||||||||||||||||||||||
| 499 | 'Selenium::Firefox::Profile' ) | ||||||||||||||||||||||||||||||||||||||||||
| 500 | { | ||||||||||||||||||||||||||||||||||||||||||
| 501 | #XXX not sure if I need to keep a ref to the File::Temp::Tempdir object to prevent reaping | ||||||||||||||||||||||||||||||||||||||||||
| 502 | $args->{capabilities}->{alwaysMatch}->{'moz:firefoxOptions'} | ||||||||||||||||||||||||||||||||||||||||||
| 503 | ->{args} = [ | ||||||||||||||||||||||||||||||||||||||||||
| 504 | '-profile', | ||||||||||||||||||||||||||||||||||||||||||
| 505 | $args->{capabilities}->{alwaysMatch}->{$cap}->{profile_dir} | ||||||||||||||||||||||||||||||||||||||||||
| 506 | ->dirname() | ||||||||||||||||||||||||||||||||||||||||||
| 507 | 1 | ]; | |||||||||||||||||||||||||||||||||||||||||
| 508 | } | ||||||||||||||||||||||||||||||||||||||||||
| 509 | } | ||||||||||||||||||||||||||||||||||||||||||
| 510 | 136 | foreach my $newkey ( keys(%$cmap) ) { | |||||||||||||||||||||||||||||||||||||||||
| 511 | 470 | ▶ | if ( $newkey eq $cap ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 512 | 103 | ▶ | last if $cmap->{$newkey} eq $cap; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 513 | $args->{capabilities}->{alwaysMatch}->{ $cmap->{$newkey} } = | ||||||||||||||||||||||||||||||||||||||||||
| 514 | 72 | $args->{capabilities}->{alwaysMatch}->{$cap}; | |||||||||||||||||||||||||||||||||||||||||
| 515 | 72 | delete $args->{capabilities}->{alwaysMatch}->{$cap}; | |||||||||||||||||||||||||||||||||||||||||
| 516 | 72 | last; | |||||||||||||||||||||||||||||||||||||||||
| 517 | } | ||||||||||||||||||||||||||||||||||||||||||
| 518 | } | ||||||||||||||||||||||||||||||||||||||||||
| 519 | delete $args->{capabilities}->{alwaysMatch}->{$cap} | ||||||||||||||||||||||||||||||||||||||||||
| 520 | 136 | ▶ | if !any { $_ eq $cap } @$caps; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 521 | } | ||||||||||||||||||||||||||||||||||||||||||
| 522 | delete $args->{desiredCapabilities} | ||||||||||||||||||||||||||||||||||||||||||
| 523 | 29 | ▶ | if $FORCE_WD3; #XXX fork working-around busted fallback in firefox | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 524 | delete $args->{capabilities} | ||||||||||||||||||||||||||||||||||||||||||
| 525 | 29 | ▶ | if $FORCE_WD2; #XXX 'secret' feature to help the legacy unit tests to work | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||
| 527 | #Delete compatibility layer when using drivers directly | ||||||||||||||||||||||||||||||||||||||||||
| 528 | 29 | ▶ | if ( $self->isa('Selenium::Firefox') || $self->isa('Selenium::Chrome') || $self->isa('Selenium::Edge') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$self->isa("Selenium::Firefox") or $self->isa("Selenium::Chrome") or $self->isa("Selenium::Edge")
$self->isa("Selenium::Firefox") or $self->isa("Selenium::Chrome")
MC/DC33%1/3
$self->isa("Selenium::Firefox") or $self->isa("Selenium::Chrome") or $self->isa("Selenium::Edge")
$self->isa("Selenium::Firefox")
$self->isa("Selenium::Chrome")
$self->isa("Selenium::Edge")
Truth table50%2/4
A or B or C
A= $self->isa("Selenium::Firefox")B= $self->isa("Selenium::Chrome")C= $self->isa("Selenium::Edge")
| |||||||||||||||||||||||||||||||||||||||||||
| 529 | 2 | ▶ | if ( exists $args->{capabilities} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $args->{"capabilities"} and exists $args->{"capabilities"}{"alwaysMatch"}
MC/DC0%0/2
exists $args->{"capabilities"} and exists $args->{"capabilities"}{"alwaysMatch"}
exists $args->{"capabilities"}
exists $args->{"capabilities"}{"alwaysMatch"}
Truth table33%1/3
A and B
A= exists $args->{"capabilities"}B= exists $args->{"capabilities"}{"alwaysMatch"}
| |||||||||||||||||||||||||||||||||||||||||||
| 530 | && exists $args->{capabilities}->{alwaysMatch} ) | ||||||||||||||||||||||||||||||||||||||||||
| 531 | { | ||||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | delete $args->{capabilities}->{alwaysMatch}->{browserName}; | |||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | delete $args->{capabilities}->{alwaysMatch}->{browserVersion}; | |||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | delete $args->{capabilities}->{alwaysMatch}->{platformName}; | |||||||||||||||||||||||||||||||||||||||||
| 535 | } | ||||||||||||||||||||||||||||||||||||||||||
| 536 | } | ||||||||||||||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||||||||||||
| 538 | #Fix broken out of the box chrome because they hate the maintainers of their interfaces | ||||||||||||||||||||||||||||||||||||||||||
| 539 | 29 | ▶ | if ( $self->isa('Selenium::Chrome') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | ▶ | if ( exists $args->{desiredCapabilities} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 541 | 0 | ▶ | $args->{desiredCapabilities}{'goog:chromeOptions'}{args} //= []; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$args->{"desiredCapabilities"}{"goog:chromeOptions"}{"args"} //= []
MC/DC0%0/1
$args->{"desiredCapabilities"}{"goog:chromeOptions"}{"args"} //= []
$args->{"desiredCapabilities"}{"goog:chromeOptions"}{"args"}
Truth table0%0/2
A
A= $args->{"desiredCapabilities"}{"goog:chromeOptions"}{"args"}
| |||||||||||||||||||||||||||||||||||||||||||
| 542 | 0 | push(@{$args->{desiredCapabilities}{'goog:chromeOptions'}{args}}, qw{no-sandbox disable-dev-shm-usage}); | |||||||||||||||||||||||||||||||||||||||||
| 543 | } | ||||||||||||||||||||||||||||||||||||||||||
| 544 | } | ||||||||||||||||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||||||||||||||
| 546 | # Get actual status | ||||||||||||||||||||||||||||||||||||||||||
| 547 | 29 | $self->remote_conn->check_status(); | |||||||||||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||||||||||||
| 549 | # command => 'newSession' to fool the tests of commands implemented | ||||||||||||||||||||||||||||||||||||||||||
| 550 | # TODO: rewrite the testing better, this is so fragile. | ||||||||||||||||||||||||||||||||||||||||||
| 551 | 28 | my $resource_new_session = { | |||||||||||||||||||||||||||||||||||||||||
| 552 | method => $self->commands->get_method('newSession'), | ||||||||||||||||||||||||||||||||||||||||||
| 553 | url => $self->commands->get_url('newSession'), | ||||||||||||||||||||||||||||||||||||||||||
| 554 | no_content_success => | ||||||||||||||||||||||||||||||||||||||||||
| 555 | $self->commands->get_no_content_success('newSession'), | ||||||||||||||||||||||||||||||||||||||||||
| 556 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 557 | 28 | my $rc = $self->remote_conn; | |||||||||||||||||||||||||||||||||||||||||
| 558 | 28 | my $resp = $rc->request( $resource_new_session, $args, ); | |||||||||||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||||||||||||
| 560 | 28 | ▶ | if ( $resp->{cmd_status} && $resp->{cmd_status} eq 'NOT OK' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$resp->{"cmd_status"} and $resp->{"cmd_status"} eq "NOT OK"
MC/DC0%0/2
$resp->{"cmd_status"} and $resp->{"cmd_status"} eq "NOT OK"
$resp->{"cmd_status"}
$resp->{"cmd_status"} eq "NOT OK"
Truth table33%1/3
A and B
A= $resp->{"cmd_status"}B= $resp->{"cmd_status"} eq "NOT OK"
| |||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | croak "Could not obtain new session: ". $resp->{cmd_return}{message}; | |||||||||||||||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||||||||||||||||
| 564 | 28 | ▶ | if ( ( defined $resp->{'sessionId'} ) && $resp->{'sessionId'} ne '' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $resp->{"sessionId"} and $resp->{"sessionId"} ne ""
MC/DC50%1/2
defined $resp->{"sessionId"} and $resp->{"sessionId"} ne ""
defined $resp->{"sessionId"}
$resp->{"sessionId"} ne ""
Truth table66%2/3
A and B
A= defined $resp->{"sessionId"}B= $resp->{"sessionId"} ne ""
| |||||||||||||||||||||||||||||||||||||||||||
| 565 | 27 | $self->session_id( $resp->{'sessionId'} ); | |||||||||||||||||||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||||||||||||||||||
| 567 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 568 | 1 | my $error = 'Could not create new session'; | |||||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||||||
| 570 | 1 | ▶ | if ( ref $resp->{cmd_return} eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 571 | 1 | $error .= ': ' . $resp->{cmd_return}->{message}; | |||||||||||||||||||||||||||||||||||||||||
| 572 | } | ||||||||||||||||||||||||||||||||||||||||||
| 573 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | $error .= ': ' . $resp->{cmd_return}; | |||||||||||||||||||||||||||||||||||||||||
| 575 | } | ||||||||||||||||||||||||||||||||||||||||||
| 576 | 1 | croak $error; | |||||||||||||||||||||||||||||||||||||||||
| 577 | } | ||||||||||||||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||||||||||||
| 579 | #Webdriver 3 - best guess that this is 'whats goin on' | ||||||||||||||||||||||||||||||||||||||||||
| 580 | 27 | ▶ | if ( ref $resp->{cmd_return} eq 'HASH' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
ref $resp->{"cmd_return"} eq "HASH" and $resp->{"cmd_return"}{"capabilities"}
MC/DC100%2/2
ref $resp->{"cmd_return"} eq "HASH" and $resp->{"cmd_return"}{"capabilities"}
ref $resp->{"cmd_return"} eq "HASH"
$resp->{"cmd_return"}{"capabilities"}
Truth table100%3/3
A and B
A= ref $resp->{"cmd_return"} eq "HASH"B= $resp->{"cmd_return"}{"capabilities"}
| |||||||||||||||||||||||||||||||||||||||||||
| 581 | && $resp->{cmd_return}->{capabilities} ) | ||||||||||||||||||||||||||||||||||||||||||
| 582 | { | ||||||||||||||||||||||||||||||||||||||||||
| 583 | 2 | $self->{is_wd3} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 584 | 2 | $self->{emulate_jsonwire} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 585 | 2 | $self->{capabilities} = $resp->{cmd_return}->{capabilities}; | |||||||||||||||||||||||||||||||||||||||||
| 586 | } | ||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||
| 588 | #XXX chromedriver DOES NOT FOLLOW SPEC! | ||||||||||||||||||||||||||||||||||||||||||
| 589 | 27 | ▶ | if ( ref $resp->{cmd_return} eq 'HASH' && $resp->{cmd_return}->{chrome} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
ref $resp->{"cmd_return"} eq "HASH" and $resp->{"cmd_return"}{"chrome"}
MC/DC100%2/2
ref $resp->{"cmd_return"} eq "HASH" and $resp->{"cmd_return"}{"chrome"}
ref $resp->{"cmd_return"} eq "HASH"
$resp->{"cmd_return"}{"chrome"}
Truth table100%3/3
A and B
A= ref $resp->{"cmd_return"} eq "HASH"B= $resp->{"cmd_return"}{"chrome"}
| |||||||||||||||||||||||||||||||||||||||||||
| 590 | 1 | ▶ | if ( defined $resp->{cmd_return}->{setWindowRect} ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 591 | { #XXX i'm inferring we are wd3 based on the presence of this | ||||||||||||||||||||||||||||||||||||||||||
| 592 | 0 | $self->{is_wd3} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | $self->{emulate_jsonwire} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | $self->{capabilities} = $resp->{cmd_return}; | |||||||||||||||||||||||||||||||||||||||||
| 595 | } | ||||||||||||||||||||||||||||||||||||||||||
| 596 | } | ||||||||||||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||||||||||||
| 598 | #XXX unsurprisingly, neither does microsoft | ||||||||||||||||||||||||||||||||||||||||||
| 599 | 27 | ▶ | if ( ref $resp->{cmd_return} eq 'HASH' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
ref $resp->{"cmd_return"} eq "HASH" and $resp->{"cmd_return"}{"pageLoadStrategy"} and $self->browser_name eq "MicrosoftEdge"
ref $resp->{"cmd_return"} eq "HASH" and $resp->{"cmd_return"}{"pageLoadStrategy"}
MC/DC0%0/3
ref $resp->{"cmd_return"} eq "HASH" and $resp->{"cmd_return"}{"pageLoadStrategy"} and $self->browser_name eq "MicrosoftEdge"
ref $resp->{"cmd_return"} eq "HASH"
$resp->{"cmd_return"}{"pageLoadStrategy"}
$self->browser_name eq "MicrosoftEdge"
Truth table75%3/4
A and B and C
A= ref $resp->{"cmd_return"} eq "HASH"B= $resp->{"cmd_return"}{"pageLoadStrategy"}C= $self->browser_name eq "MicrosoftEdge"
| |||||||||||||||||||||||||||||||||||||||||||
| 600 | && $resp->{cmd_return}->{pageLoadStrategy} | ||||||||||||||||||||||||||||||||||||||||||
| 601 | && $self->browser_name eq 'MicrosoftEdge' ) | ||||||||||||||||||||||||||||||||||||||||||
| 602 | { | ||||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | $self->{is_wd3} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 604 | 0 | $self->{emulate_jsonwire} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 605 | 0 | $self->{capabilities} = $resp->{cmd_return}; | |||||||||||||||||||||||||||||||||||||||||
| 606 | } | ||||||||||||||||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||||||||||||||||
| 608 | 27 | return ( $args, $resp ); | |||||||||||||||||||||||||||||||||||||||||
| 609 | } | ||||||||||||||||||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||||||||||||||||
| 612 | sub is_webdriver_3 { | ||||||||||||||||||||||||||||||||||||||||||
| 613 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_webdriver_3: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 614 | 0 | return $self->{is_wd3}; | |||||||||||||||||||||||||||||||||||||||||
| 615 | } | ||||||||||||||||||||||||||||||||||||||||||
| 616 | |||||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||
| 618 | sub debug_on { | ||||||||||||||||||||||||||||||||||||||||||
| 619 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
debug_on: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 620 | 1 | $self->{debug} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 621 | 1 | $self->remote_conn->debug(1); | |||||||||||||||||||||||||||||||||||||||||
| 622 | } | ||||||||||||||||||||||||||||||||||||||||||
| 623 | |||||||||||||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||||||||||||
| 625 | sub debug_off { | ||||||||||||||||||||||||||||||||||||||||||
| 626 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
debug_off: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 627 | 0 | $self->{debug} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 628 | 0 | $self->remote_conn->debug(0); | |||||||||||||||||||||||||||||||||||||||||
| 629 | } | ||||||||||||||||||||||||||||||||||||||||||
| 630 | |||||||||||||||||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||||||||||||||||
| 632 | sub get_sessions { | ||||||||||||||||||||||||||||||||||||||||||
| 633 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_sessions: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | my $res = { 'command' => 'getSessions' }; | |||||||||||||||||||||||||||||||||||||||||
| 635 | 0 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 636 | } | ||||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||||||||||||||||
| 639 | sub status { | ||||||||||||||||||||||||||||||||||||||||||
| 640 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
status: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 641 | 1 | my $res = { 'command' => 'status' }; | |||||||||||||||||||||||||||||||||||||||||
| 642 | 1 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 643 | } | ||||||||||||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||||||||||||||||
| 646 | sub get_alert_text { | ||||||||||||||||||||||||||||||||||||||||||
| 647 | 6 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_alert_text: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 648 | 6 | my $res = { 'command' => 'getAlertText' }; | |||||||||||||||||||||||||||||||||||||||||
| 649 | 6 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 650 | } | ||||||||||||||||||||||||||||||||||||||||||
| 651 | |||||||||||||||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||||||||||||||
| 653 | sub send_keys_to_active_element { | ||||||||||||||||||||||||||||||||||||||||||
| 654 | 0 | ▶ | my ( $self, @strings ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
send_keys_to_active_element: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||||||||||||||||
| 656 | 0 | ▶ | if ( $self->{is_wd3} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"is_wd3"} and not grep({$self->browser_name eq $_;} "MicrosoftEdge")
MC/DC0%0/2
$self->{"is_wd3"} and not grep({$self->browser_name eq $_;} "MicrosoftEdge")
$self->{"is_wd3"}
not grep({$self->browser_name eq $_;} "MicrosoftEdge")
Truth table0%0/3
A and not(B)
A= $self->{"is_wd3"}B= not grep({$self->browser_name eq $_;} "MicrosoftEdge")
| |||||||||||||||||||||||||||||||||||||||||||
| 657 | 0 | && !( grep { $self->browser_name eq $_ } qw{MicrosoftEdge} ) ) | |||||||||||||||||||||||||||||||||||||||||
| 658 | { | ||||||||||||||||||||||||||||||||||||||||||
| 659 | 0 | @strings = map { split( '', $_ ) } @strings; | |||||||||||||||||||||||||||||||||||||||||
| 660 | my @acts = map { | ||||||||||||||||||||||||||||||||||||||||||
| 661 | 0 | ( | |||||||||||||||||||||||||||||||||||||||||
| 662 | { | ||||||||||||||||||||||||||||||||||||||||||
| 663 | 0 | type => 'keyDown', | |||||||||||||||||||||||||||||||||||||||||
| 664 | value => $_, | ||||||||||||||||||||||||||||||||||||||||||
| 665 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 666 | { | ||||||||||||||||||||||||||||||||||||||||||
| 667 | type => 'keyUp', | ||||||||||||||||||||||||||||||||||||||||||
| 668 | value => $_, | ||||||||||||||||||||||||||||||||||||||||||
| 669 | } | ||||||||||||||||||||||||||||||||||||||||||
| 670 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 671 | } @strings; | ||||||||||||||||||||||||||||||||||||||||||
| 672 | |||||||||||||||||||||||||||||||||||||||||||
| 673 | 0 | my $action = { | |||||||||||||||||||||||||||||||||||||||||
| 674 | actions => [ | ||||||||||||||||||||||||||||||||||||||||||
| 675 | { | ||||||||||||||||||||||||||||||||||||||||||
| 676 | id => 'key', | ||||||||||||||||||||||||||||||||||||||||||
| 677 | type => 'key', | ||||||||||||||||||||||||||||||||||||||||||
| 678 | actions => \@acts, | ||||||||||||||||||||||||||||||||||||||||||
| 679 | } | ||||||||||||||||||||||||||||||||||||||||||
| 680 | ] | ||||||||||||||||||||||||||||||||||||||||||
| 681 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | return $self->general_action(%$action); | |||||||||||||||||||||||||||||||||||||||||
| 683 | } | ||||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||
| 685 | 0 | my $res = { 'command' => 'sendKeysToActiveElement' }; | |||||||||||||||||||||||||||||||||||||||||
| 686 | 0 | my $params = { 'value' => \@strings, }; | |||||||||||||||||||||||||||||||||||||||||
| 687 | 0 | return $self->_execute_command( $res, $params ); | |||||||||||||||||||||||||||||||||||||||||
| 688 | } | ||||||||||||||||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||||||||
| 691 | sub send_keys_to_alert { | ||||||||||||||||||||||||||||||||||||||||||
| 692 | 0 | ▶ | return shift->send_keys_to_prompt(@_); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
send_keys_to_alert: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 693 | } | ||||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||||||||||||||||
| 696 | sub send_keys_to_prompt { | ||||||||||||||||||||||||||||||||||||||||||
| 697 | 1 | ▶ | my ( $self, $keys ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
send_keys_to_prompt: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 698 | 1 | my $res = { 'command' => 'sendKeysToPrompt' }; | |||||||||||||||||||||||||||||||||||||||||
| 699 | 1 | my $params = { 'text' => $keys }; | |||||||||||||||||||||||||||||||||||||||||
| 700 | 1 | return $self->_execute_command( $res, $params ); | |||||||||||||||||||||||||||||||||||||||||
| 701 | } | ||||||||||||||||||||||||||||||||||||||||||
| 702 | |||||||||||||||||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||||||||||||||||
| 704 | sub accept_alert { | ||||||||||||||||||||||||||||||||||||||||||
| 705 | 6 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
accept_alert: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 706 | 6 | my $res = { 'command' => 'acceptAlert' }; | |||||||||||||||||||||||||||||||||||||||||
| 707 | 6 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 708 | } | ||||||||||||||||||||||||||||||||||||||||||
| 709 | |||||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||
| 711 | sub dismiss_alert { | ||||||||||||||||||||||||||||||||||||||||||
| 712 | 3 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dismiss_alert: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 713 | 3 | my $res = { 'command' => 'dismissAlert' }; | |||||||||||||||||||||||||||||||||||||||||
| 714 | 3 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 715 | } | ||||||||||||||||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||||||||||||||||||
| 718 | sub general_action { | ||||||||||||||||||||||||||||||||||||||||||
| 719 | 0 | ▶ | my ( $self, %action ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
general_action: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 720 | |||||||||||||||||||||||||||||||||||||||||||
| 721 | 0 | _queue_action(%action); | |||||||||||||||||||||||||||||||||||||||||
| 722 | 0 | my $res = { 'command' => 'generalAction' }; | |||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | my $out = $self->_execute_command( $res, \%CURRENT_ACTION_CHAIN ); | |||||||||||||||||||||||||||||||||||||||||
| 724 | 0 | %CURRENT_ACTION_CHAIN = ( actions => [] ); | |||||||||||||||||||||||||||||||||||||||||
| 725 | 0 | return $out; | |||||||||||||||||||||||||||||||||||||||||
| 726 | } | ||||||||||||||||||||||||||||||||||||||||||
| 727 | |||||||||||||||||||||||||||||||||||||||||||
| 728 | sub _queue_action { | ||||||||||||||||||||||||||||||||||||||||||
| 729 | 0 | ▶ | my (%action) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_queue_action: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||
| 730 | 0 | ▶ | if ( ref $action{actions} eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 731 | 0 | foreach my $live_action ( @{ $action{actions} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 732 | 0 | my $existing_action; | |||||||||||||||||||||||||||||||||||||||||
| 733 | 0 | foreach my $global_action ( @{ $CURRENT_ACTION_CHAIN{actions} } ) { | |||||||||||||||||||||||||||||||||||||||||
| 734 | 0 | ▶ | if ( $global_action->{id} eq $live_action->{id} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 735 | 0 | $existing_action = $global_action; | |||||||||||||||||||||||||||||||||||||||||
| 736 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||
| 737 | } | ||||||||||||||||||||||||||||||||||||||||||
| 738 | } | ||||||||||||||||||||||||||||||||||||||||||
| 739 | 0 | ▶ | if ($existing_action) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 740 | push( | ||||||||||||||||||||||||||||||||||||||||||
| 741 | 0 | @{ $existing_action->{actions} }, | |||||||||||||||||||||||||||||||||||||||||
| 742 | 0 | @{ $live_action->{actions} } | |||||||||||||||||||||||||||||||||||||||||
| 743 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 744 | } | ||||||||||||||||||||||||||||||||||||||||||
| 745 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 746 | 0 | push( @{ $CURRENT_ACTION_CHAIN{actions} }, $live_action ); | |||||||||||||||||||||||||||||||||||||||||
| 747 | } | ||||||||||||||||||||||||||||||||||||||||||
| 748 | } | ||||||||||||||||||||||||||||||||||||||||||
| 749 | } | ||||||||||||||||||||||||||||||||||||||||||
| 750 | } | ||||||||||||||||||||||||||||||||||||||||||
| 751 | |||||||||||||||||||||||||||||||||||||||||||
| 752 | |||||||||||||||||||||||||||||||||||||||||||
| 753 | sub release_general_action { | ||||||||||||||||||||||||||||||||||||||||||
| 754 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
release_general_action: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 755 | 0 | my $res = { 'command' => 'releaseGeneralAction' }; | |||||||||||||||||||||||||||||||||||||||||
| 756 | 0 | %CURRENT_ACTION_CHAIN = ( actions => [] ); | |||||||||||||||||||||||||||||||||||||||||
| 757 | 0 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 758 | } | ||||||||||||||||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||||||||||||||||
| 761 | sub mouse_move_to_location { | ||||||||||||||||||||||||||||||||||||||||||
| 762 | 0 | ▶ | my ( $self, %params ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mouse_move_to_location: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 763 | 0 | ▶ | $params{element} = $params{element}{id} if exists $params{element}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||||||||||||||||
| 765 | 0 | ▶ | if ( $self->{is_wd3} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"is_wd3"} and not grep({$self->browser_name eq $_;} "MicrosoftEdge")
MC/DC0%0/2
$self->{"is_wd3"} and not grep({$self->browser_name eq $_;} "MicrosoftEdge")
$self->{"is_wd3"}
not grep({$self->browser_name eq $_;} "MicrosoftEdge")
Truth table0%0/3
A and not(B)
A= $self->{"is_wd3"}B= not grep({$self->browser_name eq $_;} "MicrosoftEdge")
| |||||||||||||||||||||||||||||||||||||||||||
| 766 | 0 | && !( grep { $self->browser_name eq $_ } qw{MicrosoftEdge} ) ) | |||||||||||||||||||||||||||||||||||||||||
| 767 | { | ||||||||||||||||||||||||||||||||||||||||||
| 768 | 0 | my $origin = $params{element}; | |||||||||||||||||||||||||||||||||||||||||
| 769 | my $move_action = { | ||||||||||||||||||||||||||||||||||||||||||
| 770 | type => "pointerMove", | ||||||||||||||||||||||||||||||||||||||||||
| 771 | duration => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 772 | x => $params{xoffset} // 0, | ||||||||||||||||||||||||||||||||||||||||||
| 773 | 0 | ▶ | y => $params{yoffset} // 0, | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/4
$params{"xoffset"} // 0
$params{"yoffset"} // 0
MC/DC0%0/1
$params{"xoffset"} // 0
$params{"xoffset"}
MC/DC0%0/1
$params{"yoffset"} // 0
$params{"yoffset"}
Truth table0%0/2
A
A= $params{"xoffset"}
Truth table0%0/2
A
A= $params{"yoffset"}
| |||||||||||||||||||||||||||||||||||||||||||
| 774 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 775 | $move_action->{origin} = | ||||||||||||||||||||||||||||||||||||||||||
| 776 | 0 | ▶ | { 'element-6066-11e4-a52e-4f735466cecf' => $origin } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 777 | if $origin; | ||||||||||||||||||||||||||||||||||||||||||
| 778 | |||||||||||||||||||||||||||||||||||||||||||
| 779 | 0 | _queue_action( | |||||||||||||||||||||||||||||||||||||||||
| 780 | actions => [ | ||||||||||||||||||||||||||||||||||||||||||
| 781 | { | ||||||||||||||||||||||||||||||||||||||||||
| 782 | type => "pointer", | ||||||||||||||||||||||||||||||||||||||||||
| 783 | id => 'mouse', | ||||||||||||||||||||||||||||||||||||||||||
| 784 | "parameters" => { "pointerType" => "mouse" }, | ||||||||||||||||||||||||||||||||||||||||||
| 785 | actions => [$move_action], | ||||||||||||||||||||||||||||||||||||||||||
| 786 | } | ||||||||||||||||||||||||||||||||||||||||||
| 787 | ] | ||||||||||||||||||||||||||||||||||||||||||
| 788 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 789 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 790 | } | ||||||||||||||||||||||||||||||||||||||||||
| 791 | |||||||||||||||||||||||||||||||||||||||||||
| 792 | 0 | my $res = { 'command' => 'mouseMoveToLocation' }; | |||||||||||||||||||||||||||||||||||||||||
| 793 | 0 | return $self->_execute_command( $res, \%params ); | |||||||||||||||||||||||||||||||||||||||||
| 794 | } | ||||||||||||||||||||||||||||||||||||||||||
| 795 | |||||||||||||||||||||||||||||||||||||||||||
| 796 | |||||||||||||||||||||||||||||||||||||||||||
| 797 | sub move_to { | ||||||||||||||||||||||||||||||||||||||||||
| 798 | 0 | ▶ | return shift->mouse_move_to_location(@_); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
move_to: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 799 | } | ||||||||||||||||||||||||||||||||||||||||||
| 800 | |||||||||||||||||||||||||||||||||||||||||||
| 801 | |||||||||||||||||||||||||||||||||||||||||||
| 802 | sub get_capabilities { | ||||||||||||||||||||||||||||||||||||||||||
| 803 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_capabilities: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 804 | 1 | my $res = { 'command' => 'getCapabilities' }; | |||||||||||||||||||||||||||||||||||||||||
| 805 | 1 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 806 | } | ||||||||||||||||||||||||||||||||||||||||||
| 807 | |||||||||||||||||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||||||||||||||||
| 809 | sub get_timeouts { | ||||||||||||||||||||||||||||||||||||||||||
| 810 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_timeouts: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 811 | 0 | my $res = { 'command' => 'getTimeouts' }; | |||||||||||||||||||||||||||||||||||||||||
| 812 | 0 | return $self->_execute_command( $res, {} ); | |||||||||||||||||||||||||||||||||||||||||
| 813 | } | ||||||||||||||||||||||||||||||||||||||||||
| 814 | |||||||||||||||||||||||||||||||||||||||||||
| 815 | |||||||||||||||||||||||||||||||||||||||||||
| 816 | sub set_timeout { | ||||||||||||||||||||||||||||||||||||||||||
| 817 | 1 | ▶ | my ( $self, $type, $ms ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_timeout: called CC=5 SCAR=28.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 818 | 1 | ▶ | if ( not defined $type ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 819 | 0 | croak "Expecting type"; | |||||||||||||||||||||||||||||||||||||||||
| 820 | } | ||||||||||||||||||||||||||||||||||||||||||
| 821 | 1 | $ms = _coerce_timeout_ms($ms); | |||||||||||||||||||||||||||||||||||||||||
| 822 | 0 | ▶ | $type = 'pageLoad' | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$type eq "page load" and $self->browser_name ne "MicrosoftEdge"
MC/DC0%0/2
$type eq "page load" and $self->browser_name ne "MicrosoftEdge"
$type eq "page load"
$self->browser_name ne "MicrosoftEdge"
Truth table0%0/3
A and B
A= $type eq "page load"B= $self->browser_name ne "MicrosoftEdge"
| |||||||||||||||||||||||||||||||||||||||||||
| 823 | if $type eq 'page load' | ||||||||||||||||||||||||||||||||||||||||||
| 824 | && $self->browser_name ne | ||||||||||||||||||||||||||||||||||||||||||
| 825 | 'MicrosoftEdge'; #XXX SHIM they changed the WC3 standard mid stream | ||||||||||||||||||||||||||||||||||||||||||
| 826 | |||||||||||||||||||||||||||||||||||||||||||
| 827 | 0 | my $res = { 'command' => 'setTimeout' }; | |||||||||||||||||||||||||||||||||||||||||
| 828 | 0 | my $params = { $type => $ms }; | |||||||||||||||||||||||||||||||||||||||||
| 829 | |||||||||||||||||||||||||||||||||||||||||||
| 830 | #XXX edge still follows earlier versions of the WC3 standard | ||||||||||||||||||||||||||||||||||||||||||
| 831 | 0 | ▶ | if ( $self->browser_name eq 'MicrosoftEdge' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 832 | 0 | $params->{ms} = $ms; | |||||||||||||||||||||||||||||||||||||||||
| 833 | 0 | $params->{type} = $type; | |||||||||||||||||||||||||||||||||||||||||
| 834 | } | ||||||||||||||||||||||||||||||||||||||||||
| 835 | 0 | return $self->_execute_command( $res, $params ); | |||||||||||||||||||||||||||||||||||||||||
| 836 | } | ||||||||||||||||||||||||||||||||||||||||||
| 837 | |||||||||||||||||||||||||||||||||||||||||||
| 838 | |||||||||||||||||||||||||||||||||||||||||||
| 839 | sub set_async_script_timeout { | ||||||||||||||||||||||||||||||||||||||||||
| 840 | 1 | ▶ | my ( $self, $ms ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_async_script_timeout: called CC=2 SCAR=9.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 841 | |||||||||||||||||||||||||||||||||||||||||||
| 842 | 1 | ▶ | return $self->set_timeout( 'script', $ms ) if $self->{is_wd3}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 843 | |||||||||||||||||||||||||||||||||||||||||||
| 844 | 1 | $ms = _coerce_timeout_ms($ms); | |||||||||||||||||||||||||||||||||||||||||
| 845 | 0 | my $res = { 'command' => 'setAsyncScriptTimeout' }; | |||||||||||||||||||||||||||||||||||||||||
| 846 | 0 | my $params = { 'ms' => $ms }; | |||||||||||||||||||||||||||||||||||||||||
| 847 | 0 | return $self->_execute_command( $res, $params ); | |||||||||||||||||||||||||||||||||||||||||
| 848 | } | ||||||||||||||||||||||||||||||||||||||||||
| 849 | |||||||||||||||||||||||||||||||||||||||||||
| 850 | |||||||||||||||||||||||||||||||||||||||||||
| 851 | sub set_implicit_wait_timeout { | ||||||||||||||||||||||||||||||||||||||||||
| 852 | 3 | ▶ | my ( $self, $ms ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_implicit_wait_timeout: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 853 | 3 | ▶ | return $self->set_timeout( 'implicit', $ms ) if $self->{is_wd3}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 854 | |||||||||||||||||||||||||||||||||||||||||||
| 855 | 3 | $ms = _coerce_timeout_ms($ms); | |||||||||||||||||||||||||||||||||||||||||
| 856 | 2 | my $res = { 'command' => 'setImplicitWaitTimeout' }; | |||||||||||||||||||||||||||||||||||||||||
| 857 | 2 | my $params = { 'ms' => $ms }; | |||||||||||||||||||||||||||||||||||||||||
| 858 | 2 | return $self->_execute_command( $res, $params ); | |||||||||||||||||||||||||||||||||||||||||
| 859 | } | ||||||||||||||||||||||||||||||||||||||||||
| 860 | |||||||||||||||||||||||||||||||||||||||||||
| 861 | |||||||||||||||||||||||||||||||||||||||||||
| 862 | sub pause { | ||||||||||||||||||||||||||||||||||||||||||
| 863 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pause: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 864 | 1 | ▶ | my $timeout = ( shift // 1000 ) * 1000; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() // 1000
MC/DC0%0/1
shift() // 1000
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 865 | 1 | usleep($timeout); | |||||||||||||||||||||||||||||||||||||||||
| 866 | } | ||||||||||||||||||||||||||||||||||||||||||
| 867 | |||||||||||||||||||||||||||||||||||||||||||
| 868 | |||||||||||||||||||||||||||||||||||||||||||
| 869 | sub close { | ||||||||||||||||||||||||||||||||||||||||||
| 870 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
close: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 871 | 0 | my $res = { 'command' => 'close' }; | |||||||||||||||||||||||||||||||||||||||||
| 872 | 0 | $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 873 | } | ||||||||||||||||||||||||||||||||||||||||||
| 874 | |||||||||||||||||||||||||||||||||||||||||||
| 875 | |||||||||||||||||||||||||||||||||||||||||||
| 876 | sub quit { | ||||||||||||||||||||||||||||||||||||||||||
| 877 | 27 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
quit: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 878 | 27 | my $res = { 'command' => 'quit' }; | |||||||||||||||||||||||||||||||||||||||||
| 879 | 27 | $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 880 | 27 | $self->session_id(undef); | |||||||||||||||||||||||||||||||||||||||||
| 881 | } | ||||||||||||||||||||||||||||||||||||||||||
| 882 | |||||||||||||||||||||||||||||||||||||||||||
| 883 | |||||||||||||||||||||||||||||||||||||||||||
| 884 | sub get_current_window_handle { | ||||||||||||||||||||||||||||||||||||||||||
| 885 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_current_window_handle: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 886 | 0 | my $res = { 'command' => 'getCurrentWindowHandle' }; | |||||||||||||||||||||||||||||||||||||||||
| 887 | 0 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 888 | } | ||||||||||||||||||||||||||||||||||||||||||
| 889 | |||||||||||||||||||||||||||||||||||||||||||
| 890 | |||||||||||||||||||||||||||||||||||||||||||
| 891 | sub get_window_handles { | ||||||||||||||||||||||||||||||||||||||||||
| 892 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_window_handles: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 893 | 2 | my $res = { 'command' => 'getWindowHandles' }; | |||||||||||||||||||||||||||||||||||||||||
| 894 | 2 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 895 | } | ||||||||||||||||||||||||||||||||||||||||||
| 896 | |||||||||||||||||||||||||||||||||||||||||||
| 897 | |||||||||||||||||||||||||||||||||||||||||||
| 898 | sub get_window_size { | ||||||||||||||||||||||||||||||||||||||||||
| 899 | 0 | ▶ | my ( $self, $window ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_window_size: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 900 | 0 | ▶ | $window = ( defined $window ) ? $window : 'current'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 901 | 0 | my $res = { 'command' => 'getWindowSize', 'window_handle' => $window }; | |||||||||||||||||||||||||||||||||||||||||
| 902 | $res = { 'command' => 'getWindowRect', handle => $window } | ||||||||||||||||||||||||||||||||||||||||||
| 903 | 0 | ▶ | if $self->{is_wd3}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 904 | 0 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 905 | } | ||||||||||||||||||||||||||||||||||||||||||
| 906 | |||||||||||||||||||||||||||||||||||||||||||
| 907 | |||||||||||||||||||||||||||||||||||||||||||
| 908 | sub get_window_position { | ||||||||||||||||||||||||||||||||||||||||||
| 909 | 0 | ▶ | my ( $self, $window ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_window_position: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 910 | 0 | ▶ | $window = ( defined $window ) ? $window : 'current'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 911 | 0 | my $res = { 'command' => 'getWindowPosition', 'window_handle' => $window }; | |||||||||||||||||||||||||||||||||||||||||
| 912 | $res = { 'command' => 'getWindowRect', handle => $window } | ||||||||||||||||||||||||||||||||||||||||||
| 913 | 0 | ▶ | if $self->{is_wd3}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 914 | 0 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 915 | } | ||||||||||||||||||||||||||||||||||||||||||
| 916 | |||||||||||||||||||||||||||||||||||||||||||
| 917 | |||||||||||||||||||||||||||||||||||||||||||
| 918 | sub get_current_url { | ||||||||||||||||||||||||||||||||||||||||||
| 919 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_current_url: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 920 | 2 | my $res = { 'command' => 'getCurrentUrl' }; | |||||||||||||||||||||||||||||||||||||||||
| 921 | 2 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 922 | } | ||||||||||||||||||||||||||||||||||||||||||
| 923 | |||||||||||||||||||||||||||||||||||||||||||
| 924 | |||||||||||||||||||||||||||||||||||||||||||
| 925 | sub navigate { | ||||||||||||||||||||||||||||||||||||||||||
| 926 | 0 | ▶ | my ( $self, $url ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
navigate: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 927 | 0 | $self->get($url); | |||||||||||||||||||||||||||||||||||||||||
| 928 | } | ||||||||||||||||||||||||||||||||||||||||||
| 929 | |||||||||||||||||||||||||||||||||||||||||||
| 930 | |||||||||||||||||||||||||||||||||||||||||||
| 931 | sub get { | ||||||||||||||||||||||||||||||||||||||||||
| 932 | 28 | ▶ | my ( $self, $url ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 933 | |||||||||||||||||||||||||||||||||||||||||||
| 934 | 28 | ▶ | if ( $self->has_base_url && $url !~ m|://| ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->has_base_url and not $url =~ m[://]
MC/DC100%2/2
$self->has_base_url and not $url =~ m[://]
$self->has_base_url
not $url =~ m[://]
Truth table100%3/3
A and not(B)
A= $self->has_base_urlB= not $url =~ m[://]
| |||||||||||||||||||||||||||||||||||||||||||
| 935 | 5 | $url =~ s|^/||; | |||||||||||||||||||||||||||||||||||||||||
| 936 | 5 | $url = $self->base_url . "/" . $url; | |||||||||||||||||||||||||||||||||||||||||
| 937 | } | ||||||||||||||||||||||||||||||||||||||||||
| 938 | |||||||||||||||||||||||||||||||||||||||||||
| 939 | 28 | my $res = { 'command' => 'get' }; | |||||||||||||||||||||||||||||||||||||||||
| 940 | 28 | my $params = { 'url' => $url }; | |||||||||||||||||||||||||||||||||||||||||
| 941 | 28 | return $self->_execute_command( $res, $params ); | |||||||||||||||||||||||||||||||||||||||||
| 942 | } | ||||||||||||||||||||||||||||||||||||||||||
| 943 | |||||||||||||||||||||||||||||||||||||||||||
| 944 | |||||||||||||||||||||||||||||||||||||||||||
| 945 | sub get_title { | ||||||||||||||||||||||||||||||||||||||||||
| 946 | 14 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_title: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 947 | 14 | my $res = { 'command' => 'getTitle' }; | |||||||||||||||||||||||||||||||||||||||||
| 948 | 14 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 949 | } | ||||||||||||||||||||||||||||||||||||||||||
| 950 | |||||||||||||||||||||||||||||||||||||||||||
| 951 | |||||||||||||||||||||||||||||||||||||||||||
| 952 | sub go_back { | ||||||||||||||||||||||||||||||||||||||||||
| 953 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
go_back: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 954 | 2 | my $res = { 'command' => 'goBack' }; | |||||||||||||||||||||||||||||||||||||||||
| 955 | 2 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 956 | } | ||||||||||||||||||||||||||||||||||||||||||
| 957 | |||||||||||||||||||||||||||||||||||||||||||
| 958 | |||||||||||||||||||||||||||||||||||||||||||
| 959 | sub go_forward { | ||||||||||||||||||||||||||||||||||||||||||
| 960 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
go_forward: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 961 | 1 | my $res = { 'command' => 'goForward' }; | |||||||||||||||||||||||||||||||||||||||||
| 962 | 1 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 963 | } | ||||||||||||||||||||||||||||||||||||||||||
| 964 | |||||||||||||||||||||||||||||||||||||||||||
| 965 | |||||||||||||||||||||||||||||||||||||||||||
| 966 | sub refresh { | ||||||||||||||||||||||||||||||||||||||||||
| 967 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
refresh: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 968 | 1 | my $res = { 'command' => 'refresh' }; | |||||||||||||||||||||||||||||||||||||||||
| 969 | 1 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 970 | } | ||||||||||||||||||||||||||||||||||||||||||
| 971 | |||||||||||||||||||||||||||||||||||||||||||
| 972 | |||||||||||||||||||||||||||||||||||||||||||
| 973 | sub has_javascript { | ||||||||||||||||||||||||||||||||||||||||||
| 974 | 10 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_javascript: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 975 | 10 | return int( $self->javascript ); | |||||||||||||||||||||||||||||||||||||||||
| 976 | } | ||||||||||||||||||||||||||||||||||||||||||
| 977 | |||||||||||||||||||||||||||||||||||||||||||
| 978 | |||||||||||||||||||||||||||||||||||||||||||
| 979 | sub execute_async_script { | ||||||||||||||||||||||||||||||||||||||||||
| 980 | 2 | ▶ | my ( $self, $script, @args ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
execute_async_script: called CC=10 SCAR=26.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 981 | 2 | ▶ | if ( $self->has_javascript ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 982 | 2 | ▶ | if ( not defined $script ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 983 | 0 | croak 'No script provided'; | |||||||||||||||||||||||||||||||||||||||||
| 984 | } | ||||||||||||||||||||||||||||||||||||||||||
| 985 | 2 | my $res = | |||||||||||||||||||||||||||||||||||||||||
| 986 | { 'command' => 'executeAsyncScript' . $self->_execute_script_suffix }; | ||||||||||||||||||||||||||||||||||||||||||
| 987 | |||||||||||||||||||||||||||||||||||||||||||
| 988 | # Check the args array if the elem obj is provided & replace it with | ||||||||||||||||||||||||||||||||||||||||||
| 989 | # JSON representation | ||||||||||||||||||||||||||||||||||||||||||
| 990 | 2 | ▶ | for ( my $i = 0 ; $i < @args ; $i++ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 991 | 2 | ▶ | if ( Scalar::Util::blessed( $args[$i] ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($args[$i]) and $args[$i]->isa("Selenium::Remote::WebElement")
MC/DC50%1/2
builtin::blessed($args[$i]) and $args[$i]->isa("Selenium::Remote::WebElement")
builtin::blessed($args[$i])
$args[$i]->isa("Selenium::Remote::WebElement")
Truth table66%2/3
A and B
A= builtin::blessed($args[$i])B= $args[$i]->isa("Selenium::Remote::WebElement")
| |||||||||||||||||||||||||||||||||||||||||||
| 992 | and $args[$i]->isa('Selenium::Remote::WebElement') ) | ||||||||||||||||||||||||||||||||||||||||||
| 993 | { | ||||||||||||||||||||||||||||||||||||||||||
| 994 | 1 | ▶ | if ( $self->{is_wd3} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 995 | $args[$i] = | ||||||||||||||||||||||||||||||||||||||||||
| 996 | { 'element-6066-11e4-a52e-4f735466cecf' => | ||||||||||||||||||||||||||||||||||||||||||
| 997 | 0 | ( $args[$i] )->{id} }; | |||||||||||||||||||||||||||||||||||||||||
| 998 | } | ||||||||||||||||||||||||||||||||||||||||||
| 999 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1000 | 1 | $args[$i] = { 'ELEMENT' => ( $args[$i] )->{id} }; | |||||||||||||||||||||||||||||||||||||||||
| 1001 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1002 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1003 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1004 | |||||||||||||||||||||||||||||||||||||||||||
| 1005 | 2 | my $params = { 'script' => $script, 'args' => \@args }; | |||||||||||||||||||||||||||||||||||||||||
| 1006 | 2 | my $ret = $self->_execute_command( $res, $params ); | |||||||||||||||||||||||||||||||||||||||||
| 1007 | |||||||||||||||||||||||||||||||||||||||||||
| 1008 | # replace any ELEMENTS with WebElement | ||||||||||||||||||||||||||||||||||||||||||
| 1009 | 2 | ▶ | if ( ref($ret) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
ref $ret and ref $ret eq "HASH" and $self->_looks_like_element($ret)
ref $ret and ref $ret eq "HASH"
MC/DC0%0/3
ref $ret and ref $ret eq "HASH" and $self->_looks_like_element($ret)
ref $ret
ref $ret eq "HASH"
$self->_looks_like_element($ret)
Truth table25%1/4
A and B and C
A= ref $retB= ref $ret eq "HASH"C= $self->_looks_like_element($ret)
| |||||||||||||||||||||||||||||||||||||||||||
| 1010 | and ( ref($ret) eq 'HASH' ) | ||||||||||||||||||||||||||||||||||||||||||
| 1011 | and $self->_looks_like_element($ret) ) | ||||||||||||||||||||||||||||||||||||||||||
| 1012 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1013 | 2 | $ret = $self->webelement_class->new( | |||||||||||||||||||||||||||||||||||||||||
| 1014 | id => $ret, | ||||||||||||||||||||||||||||||||||||||||||
| 1015 | driver => $self | ||||||||||||||||||||||||||||||||||||||||||
| 1016 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1017 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1018 | 2 | return $ret; | |||||||||||||||||||||||||||||||||||||||||
| 1019 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1020 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1021 | 0 | croak 'Javascript is not enabled on remote driver instance.'; | |||||||||||||||||||||||||||||||||||||||||
| 1022 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1023 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1024 | |||||||||||||||||||||||||||||||||||||||||||
| 1025 | |||||||||||||||||||||||||||||||||||||||||||
| 1026 | sub execute_script { | ||||||||||||||||||||||||||||||||||||||||||
| 1027 | 8 | ▶ | my ( $self, $script, @args ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
execute_script: called CC=7 SCAR=20.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1028 | 8 | ▶ | if ( $self->has_javascript ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1029 | 8 | ▶ | if ( not defined $script ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1030 | 0 | croak 'No script provided'; | |||||||||||||||||||||||||||||||||||||||||
| 1031 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1032 | 8 | my $res = | |||||||||||||||||||||||||||||||||||||||||
| 1033 | { 'command' => 'executeScript' . $self->_execute_script_suffix }; | ||||||||||||||||||||||||||||||||||||||||||
| 1034 | |||||||||||||||||||||||||||||||||||||||||||
| 1035 | # Check the args array if the elem obj is provided & replace it with | ||||||||||||||||||||||||||||||||||||||||||
| 1036 | # JSON representation | ||||||||||||||||||||||||||||||||||||||||||
| 1037 | 8 | ▶ | for ( my $i = 0 ; $i < @args ; $i++ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1038 | 2 | ▶ | if ( Scalar::Util::blessed( $args[$i] ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($args[$i]) and $args[$i]->isa("Selenium::Remote::WebElement")
MC/DC50%1/2
builtin::blessed($args[$i]) and $args[$i]->isa("Selenium::Remote::WebElement")
builtin::blessed($args[$i])
$args[$i]->isa("Selenium::Remote::WebElement")
Truth table66%2/3
A and B
A= builtin::blessed($args[$i])B= $args[$i]->isa("Selenium::Remote::WebElement")
| |||||||||||||||||||||||||||||||||||||||||||
| 1039 | and $args[$i]->isa('Selenium::Remote::WebElement') ) | ||||||||||||||||||||||||||||||||||||||||||
| 1040 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1041 | 1 | ▶ | if ( $self->{is_wd3} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1042 | $args[$i] = | ||||||||||||||||||||||||||||||||||||||||||
| 1043 | { 'element-6066-11e4-a52e-4f735466cecf' => | ||||||||||||||||||||||||||||||||||||||||||
| 1044 | 0 | ( $args[$i] )->{id} }; | |||||||||||||||||||||||||||||||||||||||||
| 1045 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1046 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1047 | 1 | $args[$i] = { 'ELEMENT' => ( $args[$i] )->{id} }; | |||||||||||||||||||||||||||||||||||||||||
| 1048 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1049 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1050 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1051 | |||||||||||||||||||||||||||||||||||||||||||
| 1052 | 8 | my $params = { 'script' => $script, 'args' => [@args] }; | |||||||||||||||||||||||||||||||||||||||||
| 1053 | 8 | my $ret = $self->_execute_command( $res, $params ); | |||||||||||||||||||||||||||||||||||||||||
| 1054 | |||||||||||||||||||||||||||||||||||||||||||
| 1055 | 8 | return $self->_convert_to_webelement($ret); | |||||||||||||||||||||||||||||||||||||||||
| 1056 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1057 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1058 | 0 | croak 'Javascript is not enabled on remote driver instance.'; | |||||||||||||||||||||||||||||||||||||||||
| 1059 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1060 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1061 | |||||||||||||||||||||||||||||||||||||||||||
| 1062 | # _looks_like_element | ||||||||||||||||||||||||||||||||||||||||||
| 1063 | # An internal method to check if a return value might be an element | ||||||||||||||||||||||||||||||||||||||||||
| 1064 | |||||||||||||||||||||||||||||||||||||||||||
| 1065 | sub _looks_like_element { | ||||||||||||||||||||||||||||||||||||||||||
| 1066 | 5 | ▶ | my ( $self, $maybe_element ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_looks_like_element: called CC=2 SCAR=8.1
| |||||||||||||||||||||||||||||||||||||||||||
| 1067 | |||||||||||||||||||||||||||||||||||||||||||
| 1068 | return ( | ||||||||||||||||||||||||||||||||||||||||||
| 1069 | exists $maybe_element->{ELEMENT} | ||||||||||||||||||||||||||||||||||||||||||
| 1070 | 5 | ▶ | or exists $maybe_element->{'element-6066-11e4-a52e-4f735466cecf'} | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
exists $maybe_element->{'ELEMENT'} || exists $maybe_element->{'element-6066-11e4-a52e-4f735466cecf'}
MC/DC0%0/2
exists $maybe_element->{'ELEMENT'} || exists $maybe_element->{'element-6066-11e4-a52e-4f735466cecf'}
exists $maybe_element->{'ELEMENT'}
exists $maybe_element->{'element-6066-11e4-a52e-4f735466cecf'}
Truth table33%1/3
A || B
A= exists $maybe_element->{'ELEMENT'}B= exists $maybe_element->{'element-6066-11e4-a52e-4f735466cecf'}
| |||||||||||||||||||||||||||||||||||||||||||
| 1071 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1072 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1073 | |||||||||||||||||||||||||||||||||||||||||||
| 1074 | # _convert_to_webelement | ||||||||||||||||||||||||||||||||||||||||||
| 1075 | # An internal method used to traverse a data structure | ||||||||||||||||||||||||||||||||||||||||||
| 1076 | # and convert any ELEMENTS with WebElements | ||||||||||||||||||||||||||||||||||||||||||
| 1077 | |||||||||||||||||||||||||||||||||||||||||||
| 1078 | sub _convert_to_webelement { | ||||||||||||||||||||||||||||||||||||||||||
| 1079 | 9 | ▶ | my ( $self, $ret ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_convert_to_webelement: called CC=7 SCAR=20.4
| |||||||||||||||||||||||||||||||||||||||||||
| 1080 | |||||||||||||||||||||||||||||||||||||||||||
| 1081 | 9 | ▶ | if ( ref($ret) and ( ref($ret) eq 'HASH' ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
ref $ret and ref $ret eq "HASH"
MC/DC100%2/2
ref $ret and ref $ret eq "HASH"
ref $ret
ref $ret eq "HASH"
Truth table100%3/3
A and B
A= ref $retB= ref $ret eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 1082 | 3 | ▶ | if ( $self->_looks_like_element($ret) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1083 | |||||||||||||||||||||||||||||||||||||||||||
| 1084 | # replace an ELEMENT with WebElement | ||||||||||||||||||||||||||||||||||||||||||
| 1085 | 3 | return $self->webelement_class->new( | |||||||||||||||||||||||||||||||||||||||||
| 1086 | id => $ret, | ||||||||||||||||||||||||||||||||||||||||||
| 1087 | driver => $self | ||||||||||||||||||||||||||||||||||||||||||
| 1088 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1089 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1090 | |||||||||||||||||||||||||||||||||||||||||||
| 1091 | 0 | my %hash; | |||||||||||||||||||||||||||||||||||||||||
| 1092 | 0 | foreach my $key ( keys %$ret ) { | |||||||||||||||||||||||||||||||||||||||||
| 1093 | 0 | $hash{$key} = $self->_convert_to_webelement( $ret->{$key} ); | |||||||||||||||||||||||||||||||||||||||||
| 1094 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1095 | 0 | return \%hash; | |||||||||||||||||||||||||||||||||||||||||
| 1096 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1097 | |||||||||||||||||||||||||||||||||||||||||||
| 1098 | 6 | ▶ | if ( ref($ret) and ( ref($ret) eq 'ARRAY' ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $ret and ref $ret eq "ARRAY"
MC/DC50%1/2
ref $ret and ref $ret eq "ARRAY"
ref $ret
ref $ret eq "ARRAY"
Truth table66%2/3
A and B
A= ref $retB= ref $ret eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||
| 1099 | 1 | my @array = map { $self->_convert_to_webelement($_) } @$ret; | |||||||||||||||||||||||||||||||||||||||||
| 1100 | 1 | return \@array; | |||||||||||||||||||||||||||||||||||||||||
| 1101 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1102 | |||||||||||||||||||||||||||||||||||||||||||
| 1103 | 5 | return $ret; | |||||||||||||||||||||||||||||||||||||||||
| 1104 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1105 | |||||||||||||||||||||||||||||||||||||||||||
| 1106 | |||||||||||||||||||||||||||||||||||||||||||
| 1107 | sub screenshot { | ||||||||||||||||||||||||||||||||||||||||||
| 1108 | 0 | ▶ | my ($self, $params) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
screenshot: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1109 | 0 | ▶ | $params //= { full => 0 }; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$params //= {"full", 0}
MC/DC0%0/1
$params //= {"full", 0}
$params
Truth table0%0/2
A
A= $params
| |||||||||||||||||||||||||||||||||||||||||||
| 1110 | |||||||||||||||||||||||||||||||||||||||||||
| 1111 | 0 | ▶ | croak "Full page screenshot only supported on geckodriver" if $params->{full} && ( $self->{browser_name} ne 'firefox' ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$params->{"full"} and $self->{"browser_name"} ne "firefox"
MC/DC0%0/2
$params->{"full"} and $self->{"browser_name"} ne "firefox"
$params->{"full"}
$self->{"browser_name"} ne "firefox"
Truth table0%0/3
A and B
A= $params->{"full"}B= $self->{"browser_name"} ne "firefox"
| |||||||||||||||||||||||||||||||||||||||||||
| 1112 | |||||||||||||||||||||||||||||||||||||||||||
| 1113 | 0 | ▶ | my $res = { 'command' => $params->{'full'} == 1 ? 'mozScreenshotFull' : 'screenshot' }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1114 | 0 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 1115 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1116 | |||||||||||||||||||||||||||||||||||||||||||
| 1117 | |||||||||||||||||||||||||||||||||||||||||||
| 1118 | sub capture_screenshot { | ||||||||||||||||||||||||||||||||||||||||||
| 1119 | 0 | ▶ | my ( $self, $filename, $params ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
capture_screenshot: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1120 | 0 | ▶ | croak '$filename is required' unless $filename; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1121 | |||||||||||||||||||||||||||||||||||||||||||
| 1122 | 0 | open( my $fh, '>', $filename ); | |||||||||||||||||||||||||||||||||||||||||
| 1123 | 0 | binmode $fh; | |||||||||||||||||||||||||||||||||||||||||
| 1124 | 0 | print $fh MIME::Base64::decode_base64( $self->screenshot($params) ); | |||||||||||||||||||||||||||||||||||||||||
| 1125 | 0 | CORE::close $fh; | |||||||||||||||||||||||||||||||||||||||||
| 1126 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 1127 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1128 | |||||||||||||||||||||||||||||||||||||||||||
| 1129 | |||||||||||||||||||||||||||||||||||||||||||
| 1130 | #TODO emulate behavior on wd3? | ||||||||||||||||||||||||||||||||||||||||||
| 1131 | #grep { eval { Selenium::Remote::Driver->new( browser => $_ ) } } (qw{firefox MicrosoftEdge chrome opera safari htmlunit iphone phantomjs},'internet_explorer'); | ||||||||||||||||||||||||||||||||||||||||||
| 1132 | #might do the trick | ||||||||||||||||||||||||||||||||||||||||||
| 1133 | sub available_engines { | ||||||||||||||||||||||||||||||||||||||||||
| 1134 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
available_engines: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1135 | 1 | my $res = { 'command' => 'availableEngines' }; | |||||||||||||||||||||||||||||||||||||||||
| 1136 | 1 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 1137 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1138 | |||||||||||||||||||||||||||||||||||||||||||
| 1139 | |||||||||||||||||||||||||||||||||||||||||||
| 1140 | sub switch_to_frame { | ||||||||||||||||||||||||||||||||||||||||||
| 1141 | 1 | ▶ | my ( $self, $id ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
switch_to_frame: called CC=4 SCAR=16.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1142 | |||||||||||||||||||||||||||||||||||||||||||
| 1143 | 1 | my $json_null = JSON::null; | |||||||||||||||||||||||||||||||||||||||||
| 1144 | 1 | my $params; | |||||||||||||||||||||||||||||||||||||||||
| 1145 | 1 | ▶ | $id = ( defined $id ) ? $id : $json_null; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1146 | |||||||||||||||||||||||||||||||||||||||||||
| 1147 | 1 | my $res = { 'command' => 'switchToFrame' }; | |||||||||||||||||||||||||||||||||||||||||
| 1148 | |||||||||||||||||||||||||||||||||||||||||||
| 1149 | 1 | ▶ | if ( ref $id eq $self->webelement_class ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1150 | 0 | ▶ | if ( $self->{is_wd3} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1151 | $params = | ||||||||||||||||||||||||||||||||||||||||||
| 1152 | { 'id' => | ||||||||||||||||||||||||||||||||||||||||||
| 1153 | 0 | { 'element-6066-11e4-a52e-4f735466cecf' => $id->{'id'} } }; | |||||||||||||||||||||||||||||||||||||||||
| 1154 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1155 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1156 | 0 | $params = { 'id' => { 'ELEMENT' => $id->{'id'} } }; | |||||||||||||||||||||||||||||||||||||||||
| 1157 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1158 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1159 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1160 | 1 | $params = { 'id' => $id }; | |||||||||||||||||||||||||||||||||||||||||
| 1161 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1162 | 1 | return $self->_execute_command( $res, $params ); | |||||||||||||||||||||||||||||||||||||||||
| 1163 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1164 | |||||||||||||||||||||||||||||||||||||||||||
| 1165 | |||||||||||||||||||||||||||||||||||||||||||
| 1166 | sub switch_to_parent_frame { | ||||||||||||||||||||||||||||||||||||||||||
| 1167 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
switch_to_parent_frame: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1168 | 0 | my $res = { 'command' => 'switchToParentFrame' }; | |||||||||||||||||||||||||||||||||||||||||
| 1169 | 0 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 1170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1171 | |||||||||||||||||||||||||||||||||||||||||||
| 1172 | |||||||||||||||||||||||||||||||||||||||||||
| 1173 | sub switch_to_window { | ||||||||||||||||||||||||||||||||||||||||||
| 1174 | 4 | ▶ | my ( $self, $name ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
switch_to_window: called CC=2 SCAR=7.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1175 | 4 | ▶ | if ( not defined $name ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1176 | 0 | return 'Window name not provided'; | |||||||||||||||||||||||||||||||||||||||||
| 1177 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1178 | 4 | my $res = { 'command' => 'switchToWindow' }; | |||||||||||||||||||||||||||||||||||||||||
| 1179 | 4 | my $params = { 'name' => $name, 'handle' => $name }; | |||||||||||||||||||||||||||||||||||||||||
| 1180 | 4 | return $self->_execute_command( $res, $params ); | |||||||||||||||||||||||||||||||||||||||||
| 1181 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1182 | |||||||||||||||||||||||||||||||||||||||||||
| 1183 | |||||||||||||||||||||||||||||||||||||||||||
| 1184 | sub set_window_position { | ||||||||||||||||||||||||||||||||||||||||||
| 1185 | 0 | ▶ | my ( $self, $x, $y, $window ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_window_position: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1186 | 0 | ▶ | $window = ( defined $window ) ? $window : 'current'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1187 | 0 | ▶ | if ( not defined $x and not defined $y ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $x or defined $y
MC/DC0%0/2
defined $x or defined $y
defined $x
defined $y
Truth table0%0/3
A or B
A= defined $xB= defined $y
| |||||||||||||||||||||||||||||||||||||||||||
| 1188 | 0 | croak "X & Y co-ordinates are required"; | |||||||||||||||||||||||||||||||||||||||||
| 1189 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1190 | 0 | ▶ | croak qq{Error: In set_window_size, argument x "$x" isn't numeric} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1191 | unless Scalar::Util::looks_like_number($x); | ||||||||||||||||||||||||||||||||||||||||||
| 1192 | 0 | ▶ | croak qq{Error: In set_window_size, argument y "$y" isn't numeric} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1193 | unless Scalar::Util::looks_like_number($y); | ||||||||||||||||||||||||||||||||||||||||||
| 1194 | 0 | $x += | |||||||||||||||||||||||||||||||||||||||||
| 1195 | 0; # convert to numeric if a string, otherwise they'll be sent as strings | ||||||||||||||||||||||||||||||||||||||||||
| 1196 | 0 | $y += 0; | |||||||||||||||||||||||||||||||||||||||||
| 1197 | 0 | my $res = { 'command' => 'setWindowPosition', 'window_handle' => $window }; | |||||||||||||||||||||||||||||||||||||||||
| 1198 | 0 | my $params = { 'x' => $x, 'y' => $y }; | |||||||||||||||||||||||||||||||||||||||||
| 1199 | 0 | ▶ | if ( $self->{is_wd3} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1200 | 0 | $res = { 'command' => 'setWindowRect', handle => $window }; | |||||||||||||||||||||||||||||||||||||||||
| 1201 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1202 | 0 | my $ret = $self->_execute_command( $res, $params ); | |||||||||||||||||||||||||||||||||||||||||
| 1203 | 0 | ▶ | return $ret ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1204 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1205 | |||||||||||||||||||||||||||||||||||||||||||
| 1206 | |||||||||||||||||||||||||||||||||||||||||||
| 1207 | sub set_window_size { | ||||||||||||||||||||||||||||||||||||||||||
| 1208 | 0 | ▶ | my ( $self, $height, $width, $window ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_window_size: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1209 | 0 | ▶ | $window = ( defined $window ) ? $window : 'current'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1210 | 0 | ▶ | if ( not defined $height and not defined $width ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $height or defined $width
MC/DC0%0/2
defined $height or defined $width
defined $height
defined $width
Truth table0%0/3
A or B
A= defined $heightB= defined $width
| |||||||||||||||||||||||||||||||||||||||||||
| 1211 | 0 | croak "height & width of browser are required"; | |||||||||||||||||||||||||||||||||||||||||
| 1212 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1213 | 0 | ▶ | croak qq{Error: In set_window_size, argument height "$height" isn't numeric} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1214 | unless Scalar::Util::looks_like_number($height); | ||||||||||||||||||||||||||||||||||||||||||
| 1215 | 0 | ▶ | croak qq{Error: In set_window_size, argument width "$width" isn't numeric} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1216 | unless Scalar::Util::looks_like_number($width); | ||||||||||||||||||||||||||||||||||||||||||
| 1217 | 0 | $height += | |||||||||||||||||||||||||||||||||||||||||
| 1218 | 0; # convert to numeric if a string, otherwise they'll be sent as strings | ||||||||||||||||||||||||||||||||||||||||||
| 1219 | 0 | $width += 0; | |||||||||||||||||||||||||||||||||||||||||
| 1220 | 0 | my $res = { 'command' => 'setWindowSize', 'window_handle' => $window }; | |||||||||||||||||||||||||||||||||||||||||
| 1221 | 0 | my $params = { 'height' => $height, 'width' => $width }; | |||||||||||||||||||||||||||||||||||||||||
| 1222 | 0 | ▶ | if ( $self->{is_wd3} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1223 | 0 | $res = { 'command' => 'setWindowRect', handle => $window }; | |||||||||||||||||||||||||||||||||||||||||
| 1224 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1225 | 0 | my $ret = $self->_execute_command( $res, $params ); | |||||||||||||||||||||||||||||||||||||||||
| 1226 | 0 | ▶ | return $ret ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1227 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1228 | |||||||||||||||||||||||||||||||||||||||||||
| 1229 | |||||||||||||||||||||||||||||||||||||||||||
| 1230 | sub maximize_window { | ||||||||||||||||||||||||||||||||||||||||||
| 1231 | 0 | ▶ | my ( $self, $window ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
maximize_window: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1232 | |||||||||||||||||||||||||||||||||||||||||||
| 1233 | 0 | ▶ | $window = ( defined $window ) ? $window : 'current'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1234 | 0 | my $res = { 'command' => 'maximizeWindow', 'window_handle' => $window }; | |||||||||||||||||||||||||||||||||||||||||
| 1235 | 0 | my $ret = $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 1236 | 0 | ▶ | return $ret ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1237 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1238 | |||||||||||||||||||||||||||||||||||||||||||
| 1239 | |||||||||||||||||||||||||||||||||||||||||||
| 1240 | sub minimize_window { | ||||||||||||||||||||||||||||||||||||||||||
| 1241 | 0 | ▶ | my ( $self, $window ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
minimize_window: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1242 | 0 | ▶ | $window = ( defined $window ) ? $window : 'current'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1243 | 0 | my $res = { 'command' => 'minimizeWindow', 'window_handle' => $window }; | |||||||||||||||||||||||||||||||||||||||||
| 1244 | 0 | my $ret = $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 1245 | 0 | ▶ | return $ret ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1246 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1247 | |||||||||||||||||||||||||||||||||||||||||||
| 1248 | |||||||||||||||||||||||||||||||||||||||||||
| 1249 | sub fullscreen_window { | ||||||||||||||||||||||||||||||||||||||||||
| 1250 | 0 | ▶ | my ( $self, $window ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fullscreen_window: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1251 | 0 | ▶ | $window = ( defined $window ) ? $window : 'current'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1252 | 0 | my $res = { 'command' => 'fullscreenWindow', 'window_handle' => $window }; | |||||||||||||||||||||||||||||||||||||||||
| 1253 | 0 | my $ret = $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 1254 | 0 | ▶ | return $ret ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1255 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1256 | |||||||||||||||||||||||||||||||||||||||||||
| 1257 | |||||||||||||||||||||||||||||||||||||||||||
| 1258 | sub get_all_cookies { | ||||||||||||||||||||||||||||||||||||||||||
| 1259 | 4 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_all_cookies: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1260 | 4 | my $res = { 'command' => 'getAllCookies' }; | |||||||||||||||||||||||||||||||||||||||||
| 1261 | 4 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 1262 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1263 | |||||||||||||||||||||||||||||||||||||||||||
| 1264 | |||||||||||||||||||||||||||||||||||||||||||
| 1265 | sub add_cookie { | ||||||||||||||||||||||||||||||||||||||||||
| 1266 | 1 | ▶ | my ( $self, $name, $value, $path, $domain, $secure, $httponly, $expiry ) = | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_cookie: called CC=8 SCAR=23.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1267 | @_; | ||||||||||||||||||||||||||||||||||||||||||
| 1268 | |||||||||||||||||||||||||||||||||||||||||||
| 1269 | 1 | ▶ | if ( ( not defined $name ) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $name and defined $value
MC/DC0%0/2
defined $name and defined $value
defined $name
defined $value
Truth table33%1/3
A and B
A= defined $nameB= defined $value
| |||||||||||||||||||||||||||||||||||||||||||
| 1270 | || ( not defined $value ) ) | ||||||||||||||||||||||||||||||||||||||||||
| 1271 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1272 | 0 | croak "Missing parameters"; | |||||||||||||||||||||||||||||||||||||||||
| 1273 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1274 | |||||||||||||||||||||||||||||||||||||||||||
| 1275 | 1 | my $res = { 'command' => 'addCookie' }; | |||||||||||||||||||||||||||||||||||||||||
| 1276 | 1 | my $json_false = JSON::false; | |||||||||||||||||||||||||||||||||||||||||
| 1277 | 1 | my $json_true = JSON::true; | |||||||||||||||||||||||||||||||||||||||||
| 1278 | 1 | ▶ | $secure = ( defined $secure && $secure ) ? $json_true : $json_false; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $secure and $secure
MC/DC0%0/2
defined $secure and $secure
defined $secure
$secure
Truth table33%1/3
A and B
A= defined $secureB= $secure
| |||||||||||||||||||||||||||||||||||||||||||
| 1279 | |||||||||||||||||||||||||||||||||||||||||||
| 1280 | 1 | my $params = { | |||||||||||||||||||||||||||||||||||||||||
| 1281 | 'cookie' => { | ||||||||||||||||||||||||||||||||||||||||||
| 1282 | 'name' => $name, | ||||||||||||||||||||||||||||||||||||||||||
| 1283 | 'value' => $value, | ||||||||||||||||||||||||||||||||||||||||||
| 1284 | 'path' => $path, | ||||||||||||||||||||||||||||||||||||||||||
| 1285 | 'secure' => $secure, | ||||||||||||||||||||||||||||||||||||||||||
| 1286 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1287 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 1288 | 1 | ▶ | $params->{cookie}->{domain} = $domain if $domain; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1289 | 1 | ▶ | $params->{cookie}->{'httponly'} = $httponly if $httponly; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1290 | 1 | ▶ | $params->{cookie}->{'expiry'} = $expiry if $expiry; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1291 | |||||||||||||||||||||||||||||||||||||||||||
| 1292 | 1 | return $self->_execute_command( $res, $params ); | |||||||||||||||||||||||||||||||||||||||||
| 1293 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1294 | |||||||||||||||||||||||||||||||||||||||||||
| 1295 | |||||||||||||||||||||||||||||||||||||||||||
| 1296 | sub delete_all_cookies { | ||||||||||||||||||||||||||||||||||||||||||
| 1297 | 2 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete_all_cookies: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1298 | 2 | my $res = { 'command' => 'deleteAllCookies' }; | |||||||||||||||||||||||||||||||||||||||||
| 1299 | 2 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 1300 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1301 | |||||||||||||||||||||||||||||||||||||||||||
| 1302 | |||||||||||||||||||||||||||||||||||||||||||
| 1303 | sub get_cookie_named { | ||||||||||||||||||||||||||||||||||||||||||
| 1304 | 0 | ▶ | my ( $self, $cookie_name ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_cookie_named: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1305 | 0 | my $res = { 'command' => 'getCookieNamed', 'name' => $cookie_name }; | |||||||||||||||||||||||||||||||||||||||||
| 1306 | 0 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 1307 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1308 | |||||||||||||||||||||||||||||||||||||||||||
| 1309 | |||||||||||||||||||||||||||||||||||||||||||
| 1310 | sub delete_cookie_named { | ||||||||||||||||||||||||||||||||||||||||||
| 1311 | 1 | ▶ | my ( $self, $cookie_name ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete_cookie_named: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1312 | 1 | ▶ | if ( not defined $cookie_name ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1313 | 0 | croak "Cookie name not provided"; | |||||||||||||||||||||||||||||||||||||||||
| 1314 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1315 | 1 | my $res = { 'command' => 'deleteCookieNamed', 'name' => $cookie_name }; | |||||||||||||||||||||||||||||||||||||||||
| 1316 | 1 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 1317 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1318 | |||||||||||||||||||||||||||||||||||||||||||
| 1319 | |||||||||||||||||||||||||||||||||||||||||||
| 1320 | sub get_page_source { | ||||||||||||||||||||||||||||||||||||||||||
| 1321 | 13 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_page_source: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1322 | 13 | my $res = { 'command' => 'getPageSource' }; | |||||||||||||||||||||||||||||||||||||||||
| 1323 | 13 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 1324 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1325 | |||||||||||||||||||||||||||||||||||||||||||
| 1326 | |||||||||||||||||||||||||||||||||||||||||||
| 1327 | sub find_element { | ||||||||||||||||||||||||||||||||||||||||||
| 1328 | 67 | ▶ | my ( $self, $query, $method ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_element: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1329 | 67 | ▶ | if ( not defined $query ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1330 | 0 | croak 'Search string to find element not provided.'; | |||||||||||||||||||||||||||||||||||||||||
| 1331 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1332 | |||||||||||||||||||||||||||||||||||||||||||
| 1333 | 67 | my $res = { 'command' => 'findElement' }; | |||||||||||||||||||||||||||||||||||||||||
| 1334 | 67 | my $params = $self->_build_find_params( $method, $query ); | |||||||||||||||||||||||||||||||||||||||||
| 1335 | 67 | my $ret_data = eval { $self->_execute_command( $res, $params ); }; | |||||||||||||||||||||||||||||||||||||||||
| 1336 | 67 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1337 | 12 | ▶ | if ( $@ =~ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1338 | /(An element could not be located on the page using the given search parameters)/ | ||||||||||||||||||||||||||||||||||||||||||
| 1339 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 1340 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1341 | # give details on what element wasn't found | ||||||||||||||||||||||||||||||||||||||||||
| 1342 | 11 | $@ = "$1: $query,$params->{using}"; | |||||||||||||||||||||||||||||||||||||||||
| 1343 | 11 | local @CARP_NOT = ( "Selenium::Remote::Driver", @CARP_NOT ); | |||||||||||||||||||||||||||||||||||||||||
| 1344 | 11 | croak $@; | |||||||||||||||||||||||||||||||||||||||||
| 1345 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1346 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1347 | # re throw if the exception wasn't what we expected | ||||||||||||||||||||||||||||||||||||||||||
| 1348 | 1 | die $@; | |||||||||||||||||||||||||||||||||||||||||
| 1349 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1350 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1351 | 55 | return $self->webelement_class->new( | |||||||||||||||||||||||||||||||||||||||||
| 1352 | id => $ret_data, | ||||||||||||||||||||||||||||||||||||||||||
| 1353 | driver => $self | ||||||||||||||||||||||||||||||||||||||||||
| 1354 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1355 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1356 | |||||||||||||||||||||||||||||||||||||||||||
| 1357 | |||||||||||||||||||||||||||||||||||||||||||
| 1358 | sub find_elements { | ||||||||||||||||||||||||||||||||||||||||||
| 1359 | 6 | ▶ | my ( $self, $query, $method ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_elements: called CC=6 SCAR=20.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1360 | 6 | ▶ | if ( not defined $query ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1361 | 0 | croak 'Search string to find element not provided.'; | |||||||||||||||||||||||||||||||||||||||||
| 1362 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1363 | |||||||||||||||||||||||||||||||||||||||||||
| 1364 | 6 | my $res = { 'command' => 'findElements' }; | |||||||||||||||||||||||||||||||||||||||||
| 1365 | 6 | my $params = $self->_build_find_params( $method, $query ); | |||||||||||||||||||||||||||||||||||||||||
| 1366 | 6 | my $ret_data = eval { $self->_execute_command( $res, $params ); }; | |||||||||||||||||||||||||||||||||||||||||
| 1367 | 6 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1368 | 0 | ▶ | if ( $@ =~ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1369 | /(An element could not be located on the page using the given search parameters)/ | ||||||||||||||||||||||||||||||||||||||||||
| 1370 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 1371 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1372 | # give details on what element wasn't found | ||||||||||||||||||||||||||||||||||||||||||
| 1373 | 0 | $@ = "$1: $query,$params->{using}"; | |||||||||||||||||||||||||||||||||||||||||
| 1374 | 0 | local @CARP_NOT = ( "Selenium::Remote::Driver", @CARP_NOT ); | |||||||||||||||||||||||||||||||||||||||||
| 1375 | 0 | croak $@; | |||||||||||||||||||||||||||||||||||||||||
| 1376 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1377 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1378 | # re throw if the exception wasn't what we expected | ||||||||||||||||||||||||||||||||||||||||||
| 1379 | 0 | die $@; | |||||||||||||||||||||||||||||||||||||||||
| 1380 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1381 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1382 | 6 | my $elem_obj_arr = []; | |||||||||||||||||||||||||||||||||||||||||
| 1383 | 6 | foreach (@$ret_data) { | |||||||||||||||||||||||||||||||||||||||||
| 1384 | 6 | push( | |||||||||||||||||||||||||||||||||||||||||
| 1385 | @$elem_obj_arr, | ||||||||||||||||||||||||||||||||||||||||||
| 1386 | $self->webelement_class->new( | ||||||||||||||||||||||||||||||||||||||||||
| 1387 | id => $_, | ||||||||||||||||||||||||||||||||||||||||||
| 1388 | driver => $self | ||||||||||||||||||||||||||||||||||||||||||
| 1389 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 1390 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1391 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1392 | 4 | ▶ | return wantarray ? @{$elem_obj_arr} : $elem_obj_arr; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1393 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1394 | |||||||||||||||||||||||||||||||||||||||||||
| 1395 | |||||||||||||||||||||||||||||||||||||||||||
| 1396 | sub find_child_element { | ||||||||||||||||||||||||||||||||||||||||||
| 1397 | 4 | ▶ | my ( $self, $elem, $query, $method ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_child_element: called CC=5 SCAR=18.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1398 | 4 | ▶ | if ( ( not defined $elem ) || ( not defined $query ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $elem and defined $query
MC/DC50%1/2
defined $elem and defined $query
defined $elem
defined $query
Truth table66%2/3
A and B
A= defined $elemB= defined $query
| |||||||||||||||||||||||||||||||||||||||||||
| 1399 | 1 | croak "Missing parameters"; | |||||||||||||||||||||||||||||||||||||||||
| 1400 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1401 | 3 | my $res = { 'command' => 'findChildElement', 'id' => $elem->{id} }; | |||||||||||||||||||||||||||||||||||||||||
| 1402 | 3 | my $params = $self->_build_find_params( $method, $query ); | |||||||||||||||||||||||||||||||||||||||||
| 1403 | 3 | my $ret_data = eval { $self->_execute_command( $res, $params ); }; | |||||||||||||||||||||||||||||||||||||||||
| 1404 | 3 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1405 | 0 | ▶ | if ( $@ =~ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1406 | /(An element could not be located on the page using the given search parameters)/ | ||||||||||||||||||||||||||||||||||||||||||
| 1407 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 1408 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1409 | # give details on what element wasn't found | ||||||||||||||||||||||||||||||||||||||||||
| 1410 | 0 | $@ = "$1: $query,$params->{using}"; | |||||||||||||||||||||||||||||||||||||||||
| 1411 | 0 | local @CARP_NOT = ( "Selenium::Remote::Driver", @CARP_NOT ); | |||||||||||||||||||||||||||||||||||||||||
| 1412 | 0 | croak $@; | |||||||||||||||||||||||||||||||||||||||||
| 1413 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1414 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1415 | # re throw if the exception wasn't what we expected | ||||||||||||||||||||||||||||||||||||||||||
| 1416 | 0 | die $@; | |||||||||||||||||||||||||||||||||||||||||
| 1417 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1418 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1419 | 3 | return $self->webelement_class->new( | |||||||||||||||||||||||||||||||||||||||||
| 1420 | id => $ret_data, | ||||||||||||||||||||||||||||||||||||||||||
| 1421 | driver => $self | ||||||||||||||||||||||||||||||||||||||||||
| 1422 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1423 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1424 | |||||||||||||||||||||||||||||||||||||||||||
| 1425 | |||||||||||||||||||||||||||||||||||||||||||
| 1426 | sub find_child_elements { | ||||||||||||||||||||||||||||||||||||||||||
| 1427 | 2 | ▶ | my ( $self, $elem, $query, $method ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_child_elements: called CC=7 SCAR=24.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1428 | 2 | ▶ | if ( ( not defined $elem ) || ( not defined $query ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $elem and defined $query
MC/DC0%0/2
defined $elem and defined $query
defined $elem
defined $query
Truth table33%1/3
A and B
A= defined $elemB= defined $query
| |||||||||||||||||||||||||||||||||||||||||||
| 1429 | 0 | croak "Missing parameters"; | |||||||||||||||||||||||||||||||||||||||||
| 1430 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1431 | |||||||||||||||||||||||||||||||||||||||||||
| 1432 | 2 | my $res = { 'command' => 'findChildElements', 'id' => $elem->{id} }; | |||||||||||||||||||||||||||||||||||||||||
| 1433 | 2 | my $params = $self->_build_find_params( $method, $query ); | |||||||||||||||||||||||||||||||||||||||||
| 1434 | 2 | my $ret_data = eval { $self->_execute_command( $res, $params ); }; | |||||||||||||||||||||||||||||||||||||||||
| 1435 | 2 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1436 | 0 | ▶ | if ( $@ =~ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1437 | /(An element could not be located on the page using the given search parameters)/ | ||||||||||||||||||||||||||||||||||||||||||
| 1438 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 1439 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1440 | # give details on what element wasn't found | ||||||||||||||||||||||||||||||||||||||||||
| 1441 | 0 | $@ = "$1: $query,$params->{using}"; | |||||||||||||||||||||||||||||||||||||||||
| 1442 | 0 | local @CARP_NOT = ( "Selenium::Remote::Driver", @CARP_NOT ); | |||||||||||||||||||||||||||||||||||||||||
| 1443 | 0 | croak $@; | |||||||||||||||||||||||||||||||||||||||||
| 1444 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1445 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1446 | # re throw if the exception wasn't what we expected | ||||||||||||||||||||||||||||||||||||||||||
| 1447 | 0 | die $@; | |||||||||||||||||||||||||||||||||||||||||
| 1448 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1449 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1450 | 2 | my $elem_obj_arr = []; | |||||||||||||||||||||||||||||||||||||||||
| 1451 | 2 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1452 | 2 | foreach (@$ret_data) { | |||||||||||||||||||||||||||||||||||||||||
| 1453 | 6 | $elem_obj_arr->[$i] = $self->webelement_class->new( | |||||||||||||||||||||||||||||||||||||||||
| 1454 | id => $_, | ||||||||||||||||||||||||||||||||||||||||||
| 1455 | driver => $self | ||||||||||||||||||||||||||||||||||||||||||
| 1456 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1457 | 6 | $i++; | |||||||||||||||||||||||||||||||||||||||||
| 1458 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1459 | 2 | ▶ | return wantarray ? @{$elem_obj_arr} : $elem_obj_arr; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1460 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1461 | |||||||||||||||||||||||||||||||||||||||||||
| 1462 | |||||||||||||||||||||||||||||||||||||||||||
| 1463 | sub _build_find_params { | ||||||||||||||||||||||||||||||||||||||||||
| 1464 | 78 | ▶ | my ( $self, $method, $query ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_find_params: called CC=3 SCAR=12.7
| |||||||||||||||||||||||||||||||||||||||||||
| 1465 | |||||||||||||||||||||||||||||||||||||||||||
| 1466 | 78 | my $using = $self->_build_using($method); | |||||||||||||||||||||||||||||||||||||||||
| 1467 | |||||||||||||||||||||||||||||||||||||||||||
| 1468 | # geckodriver doesn't accept name as a valid selector | ||||||||||||||||||||||||||||||||||||||||||
| 1469 | 78 | ▶ | if ( $self->isa('Selenium::Firefox') && $using eq 'name' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->isa("Selenium::Firefox") and $using eq "name"
MC/DC0%0/2
$self->isa("Selenium::Firefox") and $using eq "name"
$self->isa("Selenium::Firefox")
$using eq "name"
Truth table33%1/3
A and B
A= $self->isa("Selenium::Firefox")B= $using eq "name"
| |||||||||||||||||||||||||||||||||||||||||||
| 1470 | return { | ||||||||||||||||||||||||||||||||||||||||||
| 1471 | 0 | using => 'css selector', | |||||||||||||||||||||||||||||||||||||||||
| 1472 | value => qq{[name="$query"]} | ||||||||||||||||||||||||||||||||||||||||||
| 1473 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 1474 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1475 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1476 | return { | ||||||||||||||||||||||||||||||||||||||||||
| 1477 | 78 | using => $using, | |||||||||||||||||||||||||||||||||||||||||
| 1478 | value => $query | ||||||||||||||||||||||||||||||||||||||||||
| 1479 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 1480 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1481 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1482 | |||||||||||||||||||||||||||||||||||||||||||
| 1483 | sub _build_using { | ||||||||||||||||||||||||||||||||||||||||||
| 1484 | 78 | ▶ | my ( $self, $method ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_using: called CC=3 SCAR=11.6
| |||||||||||||||||||||||||||||||||||||||||||
| 1485 | |||||||||||||||||||||||||||||||||||||||||||
| 1486 | 78 | ▶ | if ($method) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1487 | 69 | ▶ | if ( $self->FINDERS->{$method} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1488 | 69 | return $self->FINDERS->{$method}; | |||||||||||||||||||||||||||||||||||||||||
| 1489 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1490 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1491 | croak 'Bad method, expected: ' | ||||||||||||||||||||||||||||||||||||||||||
| 1492 | 0 | . join( ', ', keys %{ $self->FINDERS } ) | |||||||||||||||||||||||||||||||||||||||||
| 1493 | . ", got $method"; | ||||||||||||||||||||||||||||||||||||||||||
| 1494 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1495 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1496 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1497 | 9 | return $self->default_finder; | |||||||||||||||||||||||||||||||||||||||||
| 1498 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1499 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1500 | |||||||||||||||||||||||||||||||||||||||||||
| 1501 | sub get_active_element { | ||||||||||||||||||||||||||||||||||||||||||
| 1502 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_active_element: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1503 | 1 | my $res = { 'command' => 'getActiveElement' }; | |||||||||||||||||||||||||||||||||||||||||
| 1504 | 1 | my $ret_data = eval { $self->_execute_command($res) }; | |||||||||||||||||||||||||||||||||||||||||
| 1505 | 1 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1506 | 0 | croak $@; | |||||||||||||||||||||||||||||||||||||||||
| 1507 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1508 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1509 | 1 | return $self->webelement_class->new( | |||||||||||||||||||||||||||||||||||||||||
| 1510 | id => $ret_data, | ||||||||||||||||||||||||||||||||||||||||||
| 1511 | driver => $self | ||||||||||||||||||||||||||||||||||||||||||
| 1512 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1513 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1514 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1515 | |||||||||||||||||||||||||||||||||||||||||||
| 1516 | |||||||||||||||||||||||||||||||||||||||||||
| 1517 | sub cache_status { | ||||||||||||||||||||||||||||||||||||||||||
| 1518 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cache_status: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1519 | 0 | my $res = { 'command' => 'cacheStatus' }; | |||||||||||||||||||||||||||||||||||||||||
| 1520 | 0 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 1521 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1522 | |||||||||||||||||||||||||||||||||||||||||||
| 1523 | |||||||||||||||||||||||||||||||||||||||||||
| 1524 | sub set_geolocation { | ||||||||||||||||||||||||||||||||||||||||||
| 1525 | 1 | ▶ | my ( $self, %params ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_geolocation: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1526 | 1 | my $res = { 'command' => 'setGeolocation' }; | |||||||||||||||||||||||||||||||||||||||||
| 1527 | 1 | return $self->_execute_command( $res, \%params ); | |||||||||||||||||||||||||||||||||||||||||
| 1528 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1529 | |||||||||||||||||||||||||||||||||||||||||||
| 1530 | |||||||||||||||||||||||||||||||||||||||||||
| 1531 | sub get_geolocation { | ||||||||||||||||||||||||||||||||||||||||||
| 1532 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_geolocation: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1533 | 0 | my $res = { 'command' => 'getGeolocation' }; | |||||||||||||||||||||||||||||||||||||||||
| 1534 | 0 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 1535 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1536 | |||||||||||||||||||||||||||||||||||||||||||
| 1537 | |||||||||||||||||||||||||||||||||||||||||||
| 1538 | sub get_log { | ||||||||||||||||||||||||||||||||||||||||||
| 1539 | 4 | ▶ | my ( $self, $type ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_log: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1540 | 4 | my $res = { 'command' => 'getLog' }; | |||||||||||||||||||||||||||||||||||||||||
| 1541 | 4 | return $self->_execute_command( $res, { type => $type } ); | |||||||||||||||||||||||||||||||||||||||||
| 1542 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1543 | |||||||||||||||||||||||||||||||||||||||||||
| 1544 | |||||||||||||||||||||||||||||||||||||||||||
| 1545 | sub get_log_types { | ||||||||||||||||||||||||||||||||||||||||||
| 1546 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_log_types: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1547 | 1 | my $res = { 'command' => 'getLogTypes' }; | |||||||||||||||||||||||||||||||||||||||||
| 1548 | 1 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 1549 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1550 | |||||||||||||||||||||||||||||||||||||||||||
| 1551 | |||||||||||||||||||||||||||||||||||||||||||
| 1552 | sub set_orientation { | ||||||||||||||||||||||||||||||||||||||||||
| 1553 | 0 | ▶ | my ( $self, $orientation ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_orientation: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1554 | 0 | my $res = { 'command' => 'setOrientation' }; | |||||||||||||||||||||||||||||||||||||||||
| 1555 | 0 | return $self->_execute_command( $res, { orientation => $orientation } ); | |||||||||||||||||||||||||||||||||||||||||
| 1556 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1557 | |||||||||||||||||||||||||||||||||||||||||||
| 1558 | |||||||||||||||||||||||||||||||||||||||||||
| 1559 | sub get_orientation { | ||||||||||||||||||||||||||||||||||||||||||
| 1560 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_orientation: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1561 | 0 | my $res = { 'command' => 'getOrientation' }; | |||||||||||||||||||||||||||||||||||||||||
| 1562 | 0 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 1563 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1564 | |||||||||||||||||||||||||||||||||||||||||||
| 1565 | |||||||||||||||||||||||||||||||||||||||||||
| 1566 | sub send_modifier { | ||||||||||||||||||||||||||||||||||||||||||
| 1567 | 1 | ▶ | my ( $self, $modifier, $isdown ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
send_modifier: called CC=6 SCAR=24.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1568 | 1 | ▶ | if ( $isdown =~ /(down|up)/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1569 | 1 | ▶ | $isdown = $isdown =~ /down/ ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1570 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1571 | |||||||||||||||||||||||||||||||||||||||||||
| 1572 | 1 | ▶ | if ( $self->{is_wd3} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"is_wd3"} and not grep({$self->browser_name eq $_;} "MicrosoftEdge")
MC/DC0%0/2
$self->{"is_wd3"} and not grep({$self->browser_name eq $_;} "MicrosoftEdge")
$self->{"is_wd3"}
not grep({$self->browser_name eq $_;} "MicrosoftEdge")
Truth table33%1/3
A and not(B)
A= $self->{"is_wd3"}B= not grep({$self->browser_name eq $_;} "MicrosoftEdge")
| |||||||||||||||||||||||||||||||||||||||||||
| 1573 | 0 | && !( grep { $self->browser_name eq $_ } qw{MicrosoftEdge} ) ) | |||||||||||||||||||||||||||||||||||||||||
| 1574 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1575 | my $acts = [ | ||||||||||||||||||||||||||||||||||||||||||
| 1576 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1577 | type => $isdown ? 'keyDown' : 'keyUp', | ||||||||||||||||||||||||||||||||||||||||||
| 1578 | 0 | ▶ | value => KEYS->{ lc($modifier) }, | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1579 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 1580 | ]; | ||||||||||||||||||||||||||||||||||||||||||
| 1581 | |||||||||||||||||||||||||||||||||||||||||||
| 1582 | 0 | my $action = { | |||||||||||||||||||||||||||||||||||||||||
| 1583 | actions => [ | ||||||||||||||||||||||||||||||||||||||||||
| 1584 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1585 | id => 'key', | ||||||||||||||||||||||||||||||||||||||||||
| 1586 | type => 'key', | ||||||||||||||||||||||||||||||||||||||||||
| 1587 | actions => $acts, | ||||||||||||||||||||||||||||||||||||||||||
| 1588 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1589 | ] | ||||||||||||||||||||||||||||||||||||||||||
| 1590 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 1591 | 0 | _queue_action(%$action); | |||||||||||||||||||||||||||||||||||||||||
| 1592 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 1593 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1594 | |||||||||||||||||||||||||||||||||||||||||||
| 1595 | 1 | my $res = { 'command' => 'sendModifier' }; | |||||||||||||||||||||||||||||||||||||||||
| 1596 | 1 | my $params = { | |||||||||||||||||||||||||||||||||||||||||
| 1597 | value => $modifier, | ||||||||||||||||||||||||||||||||||||||||||
| 1598 | isdown => $isdown | ||||||||||||||||||||||||||||||||||||||||||
| 1599 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 1600 | 1 | return $self->_execute_command( $res, $params ); | |||||||||||||||||||||||||||||||||||||||||
| 1601 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1602 | |||||||||||||||||||||||||||||||||||||||||||
| 1603 | |||||||||||||||||||||||||||||||||||||||||||
| 1604 | sub compare_elements { | ||||||||||||||||||||||||||||||||||||||||||
| 1605 | 0 | ▶ | my ( $self, $elem1, $elem2 ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
compare_elements: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1606 | my $res = { | ||||||||||||||||||||||||||||||||||||||||||
| 1607 | 'command' => 'elementEquals', | ||||||||||||||||||||||||||||||||||||||||||
| 1608 | 'id' => $elem1->{id}, | ||||||||||||||||||||||||||||||||||||||||||
| 1609 | 'other' => $elem2->{id} | ||||||||||||||||||||||||||||||||||||||||||
| 1610 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||
| 1611 | 0 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 1612 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1613 | |||||||||||||||||||||||||||||||||||||||||||
| 1614 | |||||||||||||||||||||||||||||||||||||||||||
| 1615 | sub click { | ||||||||||||||||||||||||||||||||||||||||||
| 1616 | 0 | ▶ | my ( $self, $button, $append ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
click: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1617 | 0 | $button = _get_button($button); | |||||||||||||||||||||||||||||||||||||||||
| 1618 | |||||||||||||||||||||||||||||||||||||||||||
| 1619 | 0 | my $res = { 'command' => 'click' }; | |||||||||||||||||||||||||||||||||||||||||
| 1620 | 0 | my $params = { 'button' => $button }; | |||||||||||||||||||||||||||||||||||||||||
| 1621 | |||||||||||||||||||||||||||||||||||||||||||
| 1622 | 0 | ▶ | if ( $self->{is_wd3} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"is_wd3"} and not grep({$self->browser_name eq $_;} "MicrosoftEdge")
MC/DC0%0/2
$self->{"is_wd3"} and not grep({$self->browser_name eq $_;} "MicrosoftEdge")
$self->{"is_wd3"}
not grep({$self->browser_name eq $_;} "MicrosoftEdge")
Truth table0%0/3
A and not(B)
A= $self->{"is_wd3"}B= not grep({$self->browser_name eq $_;} "MicrosoftEdge")
| |||||||||||||||||||||||||||||||||||||||||||
| 1623 | 0 | && !( grep { $self->browser_name eq $_ } qw{MicrosoftEdge} ) ) | |||||||||||||||||||||||||||||||||||||||||
| 1624 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1625 | 0 | $params = { | |||||||||||||||||||||||||||||||||||||||||
| 1626 | actions => [ | ||||||||||||||||||||||||||||||||||||||||||
| 1627 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1628 | type => "pointer", | ||||||||||||||||||||||||||||||||||||||||||
| 1629 | id => 'mouse', | ||||||||||||||||||||||||||||||||||||||||||
| 1630 | parameters => { "pointerType" => "mouse" }, | ||||||||||||||||||||||||||||||||||||||||||
| 1631 | actions => [ | ||||||||||||||||||||||||||||||||||||||||||
| 1632 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1633 | type => "pointerDown", | ||||||||||||||||||||||||||||||||||||||||||
| 1634 | duration => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 1635 | button => $button, | ||||||||||||||||||||||||||||||||||||||||||
| 1636 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 1637 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1638 | type => "pointerUp", | ||||||||||||||||||||||||||||||||||||||||||
| 1639 | duration => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 1640 | button => $button, | ||||||||||||||||||||||||||||||||||||||||||
| 1641 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 1642 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 1643 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1644 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 1645 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 1646 | 0 | ▶ | if ($append) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1647 | 0 | _queue_action(%$params); | |||||||||||||||||||||||||||||||||||||||||
| 1648 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 1649 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1650 | 0 | return $self->general_action(%$params); | |||||||||||||||||||||||||||||||||||||||||
| 1651 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1652 | |||||||||||||||||||||||||||||||||||||||||||
| 1653 | 0 | return $self->_execute_command( $res, $params ); | |||||||||||||||||||||||||||||||||||||||||
| 1654 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1655 | |||||||||||||||||||||||||||||||||||||||||||
| 1656 | sub _get_button { | ||||||||||||||||||||||||||||||||||||||||||
| 1657 | 0 | ▶ | my $button = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_button: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1658 | 0 | my $button_enum = { LEFT => 0, MIDDLE => 1, RIGHT => 2 }; | |||||||||||||||||||||||||||||||||||||||||
| 1659 | 0 | ▶ | if ( defined $button && $button =~ /(LEFT|MIDDLE|RIGHT)/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $button and $button =~ /(LEFT|MIDDLE|RIGHT)/i
MC/DC0%0/2
defined $button and $button =~ /(LEFT|MIDDLE|RIGHT)/i
defined $button
$button =~ /(LEFT|MIDDLE|RIGHT)/i
Truth table0%0/3
A and B
A= defined $buttonB= $button =~ /(LEFT|MIDDLE|RIGHT)/i
| |||||||||||||||||||||||||||||||||||||||||||
| 1660 | 0 | return $button_enum->{ uc $1 }; | |||||||||||||||||||||||||||||||||||||||||
| 1661 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1662 | 0 | ▶ | if ( defined $button && $button =~ /(0|1|2)/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $button and $button =~ /(0|1|2)/
MC/DC0%0/2
defined $button and $button =~ /(0|1|2)/
defined $button
$button =~ /(0|1|2)/
Truth table0%0/3
A and B
A= defined $buttonB= $button =~ /(0|1|2)/
| |||||||||||||||||||||||||||||||||||||||||||
| 1663 | #Handle user error sending in "1" | ||||||||||||||||||||||||||||||||||||||||||
| 1664 | 0 | return int($1); | |||||||||||||||||||||||||||||||||||||||||
| 1665 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1666 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 1667 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1668 | |||||||||||||||||||||||||||||||||||||||||||
| 1669 | |||||||||||||||||||||||||||||||||||||||||||
| 1670 | sub double_click { | ||||||||||||||||||||||||||||||||||||||||||
| 1671 | 0 | ▶ | my ( $self, $button ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
double_click: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1672 | |||||||||||||||||||||||||||||||||||||||||||
| 1673 | 0 | $button = _get_button($button); | |||||||||||||||||||||||||||||||||||||||||
| 1674 | |||||||||||||||||||||||||||||||||||||||||||
| 1675 | 0 | ▶ | if ( $self->{is_wd3} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"is_wd3"} and not grep({$self->browser_name eq $_;} "MicrosoftEdge")
MC/DC0%0/2
$self->{"is_wd3"} and not grep({$self->browser_name eq $_;} "MicrosoftEdge")
$self->{"is_wd3"}
not grep({$self->browser_name eq $_;} "MicrosoftEdge")
Truth table0%0/3
A and not(B)
A= $self->{"is_wd3"}B= not grep({$self->browser_name eq $_;} "MicrosoftEdge")
| |||||||||||||||||||||||||||||||||||||||||||
| 1676 | 0 | && !( grep { $self->browser_name eq $_ } qw{MicrosoftEdge} ) ) | |||||||||||||||||||||||||||||||||||||||||
| 1677 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1678 | 0 | $self->click( $button, 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 1679 | 0 | $self->click( $button, 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 1680 | 0 | return $self->general_action(); | |||||||||||||||||||||||||||||||||||||||||
| 1681 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1682 | |||||||||||||||||||||||||||||||||||||||||||
| 1683 | 0 | my $res = { 'command' => 'doubleClick' }; | |||||||||||||||||||||||||||||||||||||||||
| 1684 | 0 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 1685 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1686 | |||||||||||||||||||||||||||||||||||||||||||
| 1687 | |||||||||||||||||||||||||||||||||||||||||||
| 1688 | sub button_down { | ||||||||||||||||||||||||||||||||||||||||||
| 1689 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
button_down: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1690 | |||||||||||||||||||||||||||||||||||||||||||
| 1691 | 0 | ▶ | if ( $self->{is_wd3} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"is_wd3"} and not grep({$self->browser_name eq $_;} "MicrosoftEdge")
MC/DC0%0/2
$self->{"is_wd3"} and not grep({$self->browser_name eq $_;} "MicrosoftEdge")
$self->{"is_wd3"}
not grep({$self->browser_name eq $_;} "MicrosoftEdge")
Truth table0%0/3
A and not(B)
A= $self->{"is_wd3"}B= not grep({$self->browser_name eq $_;} "MicrosoftEdge")
| |||||||||||||||||||||||||||||||||||||||||||
| 1692 | 0 | && !( grep { $self->browser_name eq $_ } qw{MicrosoftEdge} ) ) | |||||||||||||||||||||||||||||||||||||||||
| 1693 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1694 | 0 | my $params = { | |||||||||||||||||||||||||||||||||||||||||
| 1695 | actions => [ | ||||||||||||||||||||||||||||||||||||||||||
| 1696 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1697 | type => "pointer", | ||||||||||||||||||||||||||||||||||||||||||
| 1698 | id => 'mouse', | ||||||||||||||||||||||||||||||||||||||||||
| 1699 | parameters => { "pointerType" => "mouse" }, | ||||||||||||||||||||||||||||||||||||||||||
| 1700 | actions => [ | ||||||||||||||||||||||||||||||||||||||||||
| 1701 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1702 | type => "pointerDown", | ||||||||||||||||||||||||||||||||||||||||||
| 1703 | duration => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 1704 | button => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 1705 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 1706 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 1707 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1708 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 1709 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 1710 | 0 | _queue_action(%$params); | |||||||||||||||||||||||||||||||||||||||||
| 1711 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 1712 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1713 | |||||||||||||||||||||||||||||||||||||||||||
| 1714 | 0 | my $res = { 'command' => 'buttonDown' }; | |||||||||||||||||||||||||||||||||||||||||
| 1715 | 0 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 1716 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1717 | |||||||||||||||||||||||||||||||||||||||||||
| 1718 | |||||||||||||||||||||||||||||||||||||||||||
| 1719 | sub button_up { | ||||||||||||||||||||||||||||||||||||||||||
| 1720 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
button_up: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1721 | |||||||||||||||||||||||||||||||||||||||||||
| 1722 | 0 | ▶ | if ( $self->{is_wd3} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"is_wd3"} and not grep({$self->browser_name eq $_;} "MicrosoftEdge")
MC/DC0%0/2
$self->{"is_wd3"} and not grep({$self->browser_name eq $_;} "MicrosoftEdge")
$self->{"is_wd3"}
not grep({$self->browser_name eq $_;} "MicrosoftEdge")
Truth table0%0/3
A and not(B)
A= $self->{"is_wd3"}B= not grep({$self->browser_name eq $_;} "MicrosoftEdge")
| |||||||||||||||||||||||||||||||||||||||||||
| 1723 | 0 | && !( grep { $self->browser_name eq $_ } qw{MicrosoftEdge} ) ) | |||||||||||||||||||||||||||||||||||||||||
| 1724 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1725 | 0 | my $params = { | |||||||||||||||||||||||||||||||||||||||||
| 1726 | actions => [ | ||||||||||||||||||||||||||||||||||||||||||
| 1727 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1728 | type => "pointer", | ||||||||||||||||||||||||||||||||||||||||||
| 1729 | id => 'mouse', | ||||||||||||||||||||||||||||||||||||||||||
| 1730 | parameters => { "pointerType" => "mouse" }, | ||||||||||||||||||||||||||||||||||||||||||
| 1731 | actions => [ | ||||||||||||||||||||||||||||||||||||||||||
| 1732 | { | ||||||||||||||||||||||||||||||||||||||||||
| 1733 | type => "pointerUp", | ||||||||||||||||||||||||||||||||||||||||||
| 1734 | duration => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 1735 | button => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 1736 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 1737 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 1738 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1739 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 1740 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 1741 | 0 | _queue_action(%$params); | |||||||||||||||||||||||||||||||||||||||||
| 1742 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 1743 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1744 | |||||||||||||||||||||||||||||||||||||||||||
| 1745 | 0 | my $res = { 'command' => 'buttonUp' }; | |||||||||||||||||||||||||||||||||||||||||
| 1746 | 0 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 1747 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1748 | |||||||||||||||||||||||||||||||||||||||||||
| 1749 | |||||||||||||||||||||||||||||||||||||||||||
| 1750 | # this method duplicates upload() method in the | ||||||||||||||||||||||||||||||||||||||||||
| 1751 | # org.openqa.selenium.remote.RemoteWebElement java class. | ||||||||||||||||||||||||||||||||||||||||||
| 1752 | |||||||||||||||||||||||||||||||||||||||||||
| 1753 | sub upload_file { | ||||||||||||||||||||||||||||||||||||||||||
| 1754 | 5 | ▶ | my ( $self, $filename, $raw_content ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
upload_file: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1755 | |||||||||||||||||||||||||||||||||||||||||||
| 1756 | 5 | my $params; | |||||||||||||||||||||||||||||||||||||||||
| 1757 | 5 | ▶ | if ( defined $raw_content ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1758 | |||||||||||||||||||||||||||||||||||||||||||
| 1759 | #If no processing is passed, send the argument raw | ||||||||||||||||||||||||||||||||||||||||||
| 1760 | 1 | $params = { file => $raw_content }; | |||||||||||||||||||||||||||||||||||||||||
| 1761 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1762 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1763 | #Otherwise, zip/base64 it. | ||||||||||||||||||||||||||||||||||||||||||
| 1764 | 4 | $params = $self->_prepare_file($filename); | |||||||||||||||||||||||||||||||||||||||||
| 1765 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1766 | |||||||||||||||||||||||||||||||||||||||||||
| 1767 | 4 | my $res = { 'command' => 'uploadFile' }; # /session/:SessionId/file | |||||||||||||||||||||||||||||||||||||||||
| 1768 | 4 | my $ret = $self->_execute_command( $res, $params ); | |||||||||||||||||||||||||||||||||||||||||
| 1769 | |||||||||||||||||||||||||||||||||||||||||||
| 1770 | 3 | return $ret; | |||||||||||||||||||||||||||||||||||||||||
| 1771 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1772 | |||||||||||||||||||||||||||||||||||||||||||
| 1773 | sub _prepare_file { | ||||||||||||||||||||||||||||||||||||||||||
| 1774 | 4 | ▶ | my ( $self, $filename ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_prepare_file: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||||||||||||||||
| 1775 | |||||||||||||||||||||||||||||||||||||||||||
| 1776 | 4 | ▶ | if ( not -r $filename ) { croak "upload_file: no such file: $filename"; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1777 | 3 | my $string = ""; # buffer | |||||||||||||||||||||||||||||||||||||||||
| 1778 | 3 | my $zip = Archive::Zip->new(); | |||||||||||||||||||||||||||||||||||||||||
| 1779 | 3 | $zip->addFile( $filename, basename($filename) ); | |||||||||||||||||||||||||||||||||||||||||
| 1780 | 3 | ▶ | if ( $zip->writeToFileHandle( IO::String->new($string) ) != AZ_OK ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1781 | 0 | die 'zip failed'; | |||||||||||||||||||||||||||||||||||||||||
| 1782 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1783 | |||||||||||||||||||||||||||||||||||||||||||
| 1784 | 3 | return { file => MIME::Base64::encode_base64( $string, '' ) }; | |||||||||||||||||||||||||||||||||||||||||
| 1785 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1786 | |||||||||||||||||||||||||||||||||||||||||||
| 1787 | |||||||||||||||||||||||||||||||||||||||||||
| 1788 | sub get_text { | ||||||||||||||||||||||||||||||||||||||||||
| 1789 | 14 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_text: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1790 | 14 | return $self->find_element(@_)->get_text(); | |||||||||||||||||||||||||||||||||||||||||
| 1791 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1792 | |||||||||||||||||||||||||||||||||||||||||||
| 1793 | |||||||||||||||||||||||||||||||||||||||||||
| 1794 | sub get_body { | ||||||||||||||||||||||||||||||||||||||||||
| 1795 | 13 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_body: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1796 | 13 | return $self->get_text( '//body', 'xpath' ); | |||||||||||||||||||||||||||||||||||||||||
| 1797 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1798 | |||||||||||||||||||||||||||||||||||||||||||
| 1799 | |||||||||||||||||||||||||||||||||||||||||||
| 1800 | sub get_path { | ||||||||||||||||||||||||||||||||||||||||||
| 1801 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_path: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1802 | 0 | my $location = $self->get_current_url; | |||||||||||||||||||||||||||||||||||||||||
| 1803 | 0 | $location =~ s/\?.*//; # strip of query params | |||||||||||||||||||||||||||||||||||||||||
| 1804 | 0 | $location =~ s/#.*//; # strip of anchors | |||||||||||||||||||||||||||||||||||||||||
| 1805 | 0 | $location =~ s#^https?://[^/]+##; # strip off host | |||||||||||||||||||||||||||||||||||||||||
| 1806 | 0 | return $location; | |||||||||||||||||||||||||||||||||||||||||
| 1807 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1808 | |||||||||||||||||||||||||||||||||||||||||||
| 1809 | |||||||||||||||||||||||||||||||||||||||||||
| 1810 | sub get_user_agent { | ||||||||||||||||||||||||||||||||||||||||||
| 1811 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_user_agent: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1812 | 1 | return $self->execute_script('return window.navigator.userAgent;'); | |||||||||||||||||||||||||||||||||||||||||
| 1813 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1814 | |||||||||||||||||||||||||||||||||||||||||||
| 1815 | |||||||||||||||||||||||||||||||||||||||||||
| 1816 | sub set_inner_window_size { | ||||||||||||||||||||||||||||||||||||||||||
| 1817 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_inner_window_size: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1818 | 0 | my $height = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1819 | 0 | my $width = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1820 | 0 | my $location = $self->get_current_url; | |||||||||||||||||||||||||||||||||||||||||
| 1821 | |||||||||||||||||||||||||||||||||||||||||||
| 1822 | 0 | $self->execute_script( 'window.open("' . $location . '", "_blank")' ); | |||||||||||||||||||||||||||||||||||||||||
| 1823 | 0 | $self->close; | |||||||||||||||||||||||||||||||||||||||||
| 1824 | 0 | my @handles = @{ $self->get_window_handles }; | |||||||||||||||||||||||||||||||||||||||||
| 1825 | 0 | $self->switch_to_window( pop @handles ); | |||||||||||||||||||||||||||||||||||||||||
| 1826 | |||||||||||||||||||||||||||||||||||||||||||
| 1827 | 0 | my @resize = ( | |||||||||||||||||||||||||||||||||||||||||
| 1828 | 'window.innerHeight = ' . $height, | ||||||||||||||||||||||||||||||||||||||||||
| 1829 | 'window.innerWidth = ' . $width, | ||||||||||||||||||||||||||||||||||||||||||
| 1830 | 'return 1' | ||||||||||||||||||||||||||||||||||||||||||
| 1831 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1832 | |||||||||||||||||||||||||||||||||||||||||||
| 1833 | 0 | ▶ | return $self->execute_script( join( ';', @resize ) ) ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1834 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1835 | |||||||||||||||||||||||||||||||||||||||||||
| 1836 | |||||||||||||||||||||||||||||||||||||||||||
| 1837 | sub get_local_storage_item { | ||||||||||||||||||||||||||||||||||||||||||
| 1838 | 2 | ▶ | my ( $self, $key ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_local_storage_item: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1839 | 2 | my $res = { 'command' => 'getLocalStorageItem' }; | |||||||||||||||||||||||||||||||||||||||||
| 1840 | 2 | my $params = { 'key' => $key }; | |||||||||||||||||||||||||||||||||||||||||
| 1841 | 2 | return $self->_execute_command( $res, $params ); | |||||||||||||||||||||||||||||||||||||||||
| 1842 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1843 | |||||||||||||||||||||||||||||||||||||||||||
| 1844 | |||||||||||||||||||||||||||||||||||||||||||
| 1845 | sub delete_local_storage_item { | ||||||||||||||||||||||||||||||||||||||||||
| 1846 | 1 | ▶ | my ( $self, $key ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete_local_storage_item: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1847 | 1 | my $res = { 'command' => 'deleteLocalStorageItem' }; | |||||||||||||||||||||||||||||||||||||||||
| 1848 | 1 | my $params = { 'key' => $key }; | |||||||||||||||||||||||||||||||||||||||||
| 1849 | 1 | return $self->_execute_command( $res, $params ); | |||||||||||||||||||||||||||||||||||||||||
| 1850 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1851 | |||||||||||||||||||||||||||||||||||||||||||
| 1852 | sub _coerce_timeout_ms { | ||||||||||||||||||||||||||||||||||||||||||
| 1853 | 7 | ▶ | my ($ms) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_coerce_timeout_ms: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1854 | |||||||||||||||||||||||||||||||||||||||||||
| 1855 | 7 | ▶ | if ( defined $ms ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1856 | 6 | return _coerce_number($ms); | |||||||||||||||||||||||||||||||||||||||||
| 1857 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1858 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1859 | 1 | croak 'Expecting a timeout in ms'; | |||||||||||||||||||||||||||||||||||||||||
| 1860 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1861 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1862 | |||||||||||||||||||||||||||||||||||||||||||
| 1863 | sub _coerce_number { | ||||||||||||||||||||||||||||||||||||||||||
| 1864 | 7 | ▶ | my ($maybe_number) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_coerce_number: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1865 | |||||||||||||||||||||||||||||||||||||||||||
| 1866 | 7 | ▶ | if ( Scalar::Util::looks_like_number($maybe_number) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1867 | 2 | return $maybe_number + 0; | |||||||||||||||||||||||||||||||||||||||||
| 1868 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1869 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1870 | 5 | croak "Expecting a number, not: $maybe_number"; | |||||||||||||||||||||||||||||||||||||||||
| 1871 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1872 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1873 | |||||||||||||||||||||||||||||||||||||||||||
| 1874 | 26 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 1875 | |||||||||||||||||||||||||||||||||||||||||||
| 1876 | __END__ | ||||||||||||||||||||||||||||||||||||||||||
| 1877 | |||||||||||||||||||||||||||||||||||||||||||
| 1878 | =pod | ||||||||||||||||||||||||||||||||||||||||||
| 1879 | |||||||||||||||||||||||||||||||||||||||||||
| 1880 | =encoding UTF-8 | ||||||||||||||||||||||||||||||||||||||||||
| 1881 | |||||||||||||||||||||||||||||||||||||||||||
| 1882 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 1883 | |||||||||||||||||||||||||||||||||||||||||||
| 1884 | Selenium::Remote::Driver - Perl Client for Selenium Remote Driver | ||||||||||||||||||||||||||||||||||||||||||
| 1885 | |||||||||||||||||||||||||||||||||||||||||||
| 1886 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||
| 1887 | |||||||||||||||||||||||||||||||||||||||||||
| 1888 | version 1.49 | ||||||||||||||||||||||||||||||||||||||||||
| 1889 | |||||||||||||||||||||||||||||||||||||||||||
| 1890 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 1891 | |||||||||||||||||||||||||||||||||||||||||||
| 1892 | use Selenium::Remote::Driver; | ||||||||||||||||||||||||||||||||||||||||||
| 1893 | |||||||||||||||||||||||||||||||||||||||||||
| 1894 | my $driver = Selenium::Remote::Driver->new; | ||||||||||||||||||||||||||||||||||||||||||
| 1895 | $driver->get('http://www.google.com'); | ||||||||||||||||||||||||||||||||||||||||||
| 1896 | print $driver->get_title(); | ||||||||||||||||||||||||||||||||||||||||||
| 1897 | $driver->quit(); | ||||||||||||||||||||||||||||||||||||||||||
| 1898 | |||||||||||||||||||||||||||||||||||||||||||
| 1899 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 1900 | |||||||||||||||||||||||||||||||||||||||||||
| 1901 | Selenium is a test tool that allows you to write | ||||||||||||||||||||||||||||||||||||||||||
| 1902 | automated web application UI tests in any programming language against | ||||||||||||||||||||||||||||||||||||||||||
| 1903 | any HTTP website using any mainstream JavaScript-enabled browser. This module is | ||||||||||||||||||||||||||||||||||||||||||
| 1904 | an implementation of the client for the Remote driver that Selenium provides. | ||||||||||||||||||||||||||||||||||||||||||
| 1905 | You can find bindings for other languages at this location: | ||||||||||||||||||||||||||||||||||||||||||
| 1906 | |||||||||||||||||||||||||||||||||||||||||||
| 1907 | L<https://www.seleniumhq.org/download/> | ||||||||||||||||||||||||||||||||||||||||||
| 1908 | |||||||||||||||||||||||||||||||||||||||||||
| 1909 | This module sends commands directly to the Server using HTTP. Using this module | ||||||||||||||||||||||||||||||||||||||||||
| 1910 | together with the Selenium Server, you can automatically control any supported | ||||||||||||||||||||||||||||||||||||||||||
| 1911 | browser. To use this module, you need to have already downloaded and started | ||||||||||||||||||||||||||||||||||||||||||
| 1912 | the Selenium Server (Selenium Server is a Java application). | ||||||||||||||||||||||||||||||||||||||||||
| 1913 | |||||||||||||||||||||||||||||||||||||||||||
| 1914 | =for Pod::Coverage BUILD | ||||||||||||||||||||||||||||||||||||||||||
| 1915 | |||||||||||||||||||||||||||||||||||||||||||
| 1916 | =for Pod::Coverage DEMOLISH | ||||||||||||||||||||||||||||||||||||||||||
| 1917 | |||||||||||||||||||||||||||||||||||||||||||
| 1918 | =head1 USAGE | ||||||||||||||||||||||||||||||||||||||||||
| 1919 | |||||||||||||||||||||||||||||||||||||||||||
| 1920 | =head2 Without Standalone Server | ||||||||||||||||||||||||||||||||||||||||||
| 1921 | |||||||||||||||||||||||||||||||||||||||||||
| 1922 | As of v0.25, it's possible to use this module without a standalone | ||||||||||||||||||||||||||||||||||||||||||
| 1923 | server - that is, you would not need the JRE or the JDK to run your | ||||||||||||||||||||||||||||||||||||||||||
| 1924 | Selenium tests. See L<Selenium::Chrome>, L<Selenium::PhantomJS>, | ||||||||||||||||||||||||||||||||||||||||||
| 1925 | L<Selenium::Edge>, L<Selenium::InternetExplorer>,and L<Selenium::Firefox> | ||||||||||||||||||||||||||||||||||||||||||
| 1926 | for details. If you'd like additional browsers besides these, | ||||||||||||||||||||||||||||||||||||||||||
| 1927 | give us a holler over in | ||||||||||||||||||||||||||||||||||||||||||
| 1928 | L<Github|https://github.com/teodesian/Selenium-Remote-Driver/issues>. | ||||||||||||||||||||||||||||||||||||||||||
| 1929 | |||||||||||||||||||||||||||||||||||||||||||
| 1930 | =head2 Remote Driver Response | ||||||||||||||||||||||||||||||||||||||||||
| 1931 | |||||||||||||||||||||||||||||||||||||||||||
| 1932 | Selenium::Remote::Driver uses the | ||||||||||||||||||||||||||||||||||||||||||
| 1933 | L<JsonWireProtocol|https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol> | ||||||||||||||||||||||||||||||||||||||||||
| 1934 | And the | ||||||||||||||||||||||||||||||||||||||||||
| 1935 | L<WC3 WebDriver Protocol|https://www.w3.org/TR/webdriver/> | ||||||||||||||||||||||||||||||||||||||||||
| 1936 | to communicate with the Selenium Server. If an error occurs while | ||||||||||||||||||||||||||||||||||||||||||
| 1937 | executing the command then the server sends back an HTTP error code | ||||||||||||||||||||||||||||||||||||||||||
| 1938 | with a JSON encoded reponse that indicates the precise | ||||||||||||||||||||||||||||||||||||||||||
| 1939 | L<Response Error Code|https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#response-status-codes>. | ||||||||||||||||||||||||||||||||||||||||||
| 1940 | The module will then croak with the error message associated with this | ||||||||||||||||||||||||||||||||||||||||||
| 1941 | code. If no error occurred, then the subroutine called will return the | ||||||||||||||||||||||||||||||||||||||||||
| 1942 | value sent back from the server (if a return value was sent). | ||||||||||||||||||||||||||||||||||||||||||
| 1943 | |||||||||||||||||||||||||||||||||||||||||||
| 1944 | So a rule of thumb while invoking methods on the driver is if the method did not | ||||||||||||||||||||||||||||||||||||||||||
| 1945 | croak when called, then you can safely assume the command was successful even if | ||||||||||||||||||||||||||||||||||||||||||
| 1946 | nothing was returned by the method. | ||||||||||||||||||||||||||||||||||||||||||
| 1947 | |||||||||||||||||||||||||||||||||||||||||||
| 1948 | =head2 WebElement | ||||||||||||||||||||||||||||||||||||||||||
| 1949 | |||||||||||||||||||||||||||||||||||||||||||
| 1950 | Selenium Webdriver represents all the HTML elements as WebElement, which is | ||||||||||||||||||||||||||||||||||||||||||
| 1951 | in turn represented by L<Selenium::Remote::WebElement> module. So any method that | ||||||||||||||||||||||||||||||||||||||||||
| 1952 | deals with WebElements will return and/or expect WebElement object. The POD for | ||||||||||||||||||||||||||||||||||||||||||
| 1953 | that module describes all the methods that perform various actions on the | ||||||||||||||||||||||||||||||||||||||||||
| 1954 | WebElements like click, submit etc. | ||||||||||||||||||||||||||||||||||||||||||
| 1955 | |||||||||||||||||||||||||||||||||||||||||||
| 1956 | To interact with any WebElement you have to first "find" it, read the POD for | ||||||||||||||||||||||||||||||||||||||||||
| 1957 | find_element or find_elements for further info. Once you find the required element | ||||||||||||||||||||||||||||||||||||||||||
| 1958 | then you can perform various actions. If you don't call find_* method first, all | ||||||||||||||||||||||||||||||||||||||||||
| 1959 | your further actions will fail for that element. Finally, just remember that you | ||||||||||||||||||||||||||||||||||||||||||
| 1960 | don't have to instantiate WebElement objects at all - they will be automatically | ||||||||||||||||||||||||||||||||||||||||||
| 1961 | created when you use the find_* methods. | ||||||||||||||||||||||||||||||||||||||||||
| 1962 | |||||||||||||||||||||||||||||||||||||||||||
| 1963 | A sub-class of Selenium::Remote::WebElement may be used instead of Selenium::Remote::WebElement, | ||||||||||||||||||||||||||||||||||||||||||
| 1964 | by providing that class name as an option the constructor: | ||||||||||||||||||||||||||||||||||||||||||
| 1965 | |||||||||||||||||||||||||||||||||||||||||||
| 1966 | my $driver = Selenium::Remote::Driver->new( webelement_class => ... ); | ||||||||||||||||||||||||||||||||||||||||||
| 1967 | |||||||||||||||||||||||||||||||||||||||||||
| 1968 | For example, a testing-subclass may extend the web-element object with testing methods. | ||||||||||||||||||||||||||||||||||||||||||
| 1969 | |||||||||||||||||||||||||||||||||||||||||||
| 1970 | =head2 LWP Read Timeout errors | ||||||||||||||||||||||||||||||||||||||||||
| 1971 | |||||||||||||||||||||||||||||||||||||||||||
| 1972 | It's possible to make Selenium calls that take longer than the default | ||||||||||||||||||||||||||||||||||||||||||
| 1973 | L<LWP::UserAgent> timeout. For example, setting the asynchronous | ||||||||||||||||||||||||||||||||||||||||||
| 1974 | script timeout greater than the LWP::UserAgent timeout and then | ||||||||||||||||||||||||||||||||||||||||||
| 1975 | executing a long running asynchronous snippet of javascript will | ||||||||||||||||||||||||||||||||||||||||||
| 1976 | immediately trigger an error like: | ||||||||||||||||||||||||||||||||||||||||||
| 1977 | |||||||||||||||||||||||||||||||||||||||||||
| 1978 | Error while executing command: executeAsyncScript: Server returned | ||||||||||||||||||||||||||||||||||||||||||
| 1979 | error message read timeout at... | ||||||||||||||||||||||||||||||||||||||||||
| 1980 | |||||||||||||||||||||||||||||||||||||||||||
| 1981 | You can get around this by configuring LWP's timeout value, either by | ||||||||||||||||||||||||||||||||||||||||||
| 1982 | constructing your own LWP and passing it in to ::Driver during | ||||||||||||||||||||||||||||||||||||||||||
| 1983 | instantiation | ||||||||||||||||||||||||||||||||||||||||||
| 1984 | |||||||||||||||||||||||||||||||||||||||||||
| 1985 | my $timeout_ua = LWP::UserAgent->new; | ||||||||||||||||||||||||||||||||||||||||||
| 1986 | $timeout_ua->timeout(360); # this value is in seconds! | ||||||||||||||||||||||||||||||||||||||||||
| 1987 | my $d = Selenium::Remote::Driver->new( ua => $timeout_ua ); | ||||||||||||||||||||||||||||||||||||||||||
| 1988 | |||||||||||||||||||||||||||||||||||||||||||
| 1989 | or by configuring the timeout on the fly as necessary: | ||||||||||||||||||||||||||||||||||||||||||
| 1990 | |||||||||||||||||||||||||||||||||||||||||||
| 1991 | use feature qw/say/; | ||||||||||||||||||||||||||||||||||||||||||
| 1992 | use Selenium::Remote::Driver; | ||||||||||||||||||||||||||||||||||||||||||
| 1993 | |||||||||||||||||||||||||||||||||||||||||||
| 1994 | my $d = Selenium::Remote::Driver->new; | ||||||||||||||||||||||||||||||||||||||||||
| 1995 | say $d->ua->timeout; # 180 seconds is the default | ||||||||||||||||||||||||||||||||||||||||||
| 1996 | |||||||||||||||||||||||||||||||||||||||||||
| 1997 | $d->ua->timeout(2); # LWP wants seconds, not milliseconds! | ||||||||||||||||||||||||||||||||||||||||||
| 1998 | $d->set_timeout('script', 1000); # S::R::D wants milliseconds! | ||||||||||||||||||||||||||||||||||||||||||
| 1999 | |||||||||||||||||||||||||||||||||||||||||||
| 2000 | # Async scripts only return when the callback is invoked. Since there | ||||||||||||||||||||||||||||||||||||||||||
| 2001 | # is no callback here, Selenium will block for the entire duration of | ||||||||||||||||||||||||||||||||||||||||||
| 2002 | # the async timeout script. This will hit Selenium's async script | ||||||||||||||||||||||||||||||||||||||||||
| 2003 | # timeout before hitting LWP::UserAgent's read timeout | ||||||||||||||||||||||||||||||||||||||||||
| 2004 | $d->execute_async_script('return "hello"'); | ||||||||||||||||||||||||||||||||||||||||||
| 2005 | |||||||||||||||||||||||||||||||||||||||||||
| 2006 | $d->quit; | ||||||||||||||||||||||||||||||||||||||||||
| 2007 | |||||||||||||||||||||||||||||||||||||||||||
| 2008 | =head1 TESTING | ||||||||||||||||||||||||||||||||||||||||||
| 2009 | |||||||||||||||||||||||||||||||||||||||||||
| 2010 | If are writing automated tests using this module, you may be | ||||||||||||||||||||||||||||||||||||||||||
| 2011 | interested in L<Test::Selenium::Remote::Driver> which is also included | ||||||||||||||||||||||||||||||||||||||||||
| 2012 | in this distribution. It includes convenience testing methods for many | ||||||||||||||||||||||||||||||||||||||||||
| 2013 | of the selenum methods available here. | ||||||||||||||||||||||||||||||||||||||||||
| 2014 | |||||||||||||||||||||||||||||||||||||||||||
| 2015 | Your other option is to use this module in conjunction with your | ||||||||||||||||||||||||||||||||||||||||||
| 2016 | choice of testing modules, like L<Test::Spec> or L<Test::More> as | ||||||||||||||||||||||||||||||||||||||||||
| 2017 | you please. | ||||||||||||||||||||||||||||||||||||||||||
| 2018 | |||||||||||||||||||||||||||||||||||||||||||
| 2019 | =head1 WC3 WEBDRIVER COMPATIBILITY | ||||||||||||||||||||||||||||||||||||||||||
| 2020 | |||||||||||||||||||||||||||||||||||||||||||
| 2021 | WC3 Webdriver is a constantly evolving standard, so some things may or may not work at any given time. | ||||||||||||||||||||||||||||||||||||||||||
| 2022 | |||||||||||||||||||||||||||||||||||||||||||
| 2023 | Furthermore, out of date drivers probably identify as WD3, while only implementing a few methods and retaining JSONWire functionality. | ||||||||||||||||||||||||||||||||||||||||||
| 2024 | One way of dealing with this is setting: | ||||||||||||||||||||||||||||||||||||||||||
| 2025 | |||||||||||||||||||||||||||||||||||||||||||
| 2026 | $driver->{is_wd3} = 0 | ||||||||||||||||||||||||||||||||||||||||||
| 2027 | |||||||||||||||||||||||||||||||||||||||||||
| 2028 | Of course, this will prevent access of any new WC3 methods, but will probably make your tests pass until your browser's driver gets it's act together. | ||||||||||||||||||||||||||||||||||||||||||
| 2029 | |||||||||||||||||||||||||||||||||||||||||||
| 2030 | There are also some JSONWire behaviors that we emulate in methods, such as Selenium::Remote::WebElement::get_attribute. | ||||||||||||||||||||||||||||||||||||||||||
| 2031 | You can get around that by passing an extra flag to the sub, or setting: | ||||||||||||||||||||||||||||||||||||||||||
| 2032 | |||||||||||||||||||||||||||||||||||||||||||
| 2033 | $driver->{emulate_jsonwire} = 0; | ||||||||||||||||||||||||||||||||||||||||||
| 2034 | |||||||||||||||||||||||||||||||||||||||||||
| 2035 | When in WC3 Webdriver mode. | ||||||||||||||||||||||||||||||||||||||||||
| 2036 | |||||||||||||||||||||||||||||||||||||||||||
| 2037 | =head2 FINDERS | ||||||||||||||||||||||||||||||||||||||||||
| 2038 | |||||||||||||||||||||||||||||||||||||||||||
| 2039 | This constant is a hashref map of the old element finder aliases from wd2 to wd3. | ||||||||||||||||||||||||||||||||||||||||||
| 2040 | |||||||||||||||||||||||||||||||||||||||||||
| 2041 | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||||
| 2042 | print Dumper($Selenium::Remote::Driver::FINDERS); | ||||||||||||||||||||||||||||||||||||||||||
| 2043 | |||||||||||||||||||||||||||||||||||||||||||
| 2044 | =head2 WC3 WEBDRIVER CURRENT STATUS | ||||||||||||||||||||||||||||||||||||||||||
| 2045 | |||||||||||||||||||||||||||||||||||||||||||
| 2046 | That said, the following 'sanity tests' in the at/ (acceptance test) directory of the module passed on the following versions: | ||||||||||||||||||||||||||||||||||||||||||
| 2047 | |||||||||||||||||||||||||||||||||||||||||||
| 2048 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2049 | |||||||||||||||||||||||||||||||||||||||||||
| 2050 | =item Selenium Server: 3.8.1 - all tests | ||||||||||||||||||||||||||||||||||||||||||
| 2051 | |||||||||||||||||||||||||||||||||||||||||||
| 2052 | =item geckodriver: 0.19.1 - at/sanity.test, at/firefox.test (Selenium::Firefox) | ||||||||||||||||||||||||||||||||||||||||||
| 2053 | |||||||||||||||||||||||||||||||||||||||||||
| 2054 | =item chromedriver: 2.35 - at/sanity-chrome.test, at/chrome.test (Selenium::Chrome) | ||||||||||||||||||||||||||||||||||||||||||
| 2055 | |||||||||||||||||||||||||||||||||||||||||||
| 2056 | =item edgedriver: 5.16299 - at/sanity-edge.test | ||||||||||||||||||||||||||||||||||||||||||
| 2057 | |||||||||||||||||||||||||||||||||||||||||||
| 2058 | =item InternetExplorerDriver : 3.8.1 - at/sanity-ie.test (be sure to enable 'allow local files to run active content in your 'advanced settings' pane) | ||||||||||||||||||||||||||||||||||||||||||
| 2059 | |||||||||||||||||||||||||||||||||||||||||||
| 2060 | =item safaridriver : 11.0.2 - at/sanity-safari.test (be sure to enable 'allow automated testing' in the developer menu) -- it appears WC3 spec is *unimplemented* | ||||||||||||||||||||||||||||||||||||||||||
| 2061 | |||||||||||||||||||||||||||||||||||||||||||
| 2062 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2063 | |||||||||||||||||||||||||||||||||||||||||||
| 2064 | These tests are intended to be run directly against a working selenium server on the local host with said drivers configured. | ||||||||||||||||||||||||||||||||||||||||||
| 2065 | |||||||||||||||||||||||||||||||||||||||||||
| 2066 | If you are curious as to what 'works and does not' on your driver versions (and a few other quirks), | ||||||||||||||||||||||||||||||||||||||||||
| 2067 | it is strongly encouraged you look at where the test calls the methods you are interested in. | ||||||||||||||||||||||||||||||||||||||||||
| 2068 | |||||||||||||||||||||||||||||||||||||||||||
| 2069 | While other browsers/drivers (especially legacy ones) likely work fine as well, | ||||||||||||||||||||||||||||||||||||||||||
| 2070 | any new browser/driver will likely have problems if it's not listed above. | ||||||||||||||||||||||||||||||||||||||||||
| 2071 | |||||||||||||||||||||||||||||||||||||||||||
| 2072 | There is also a 'legacy.test' file available to run against old browsers/selenium (2.x servers, pre geckodriver). | ||||||||||||||||||||||||||||||||||||||||||
| 2073 | This should only be used to verify backwards-compatibility has not been broken. | ||||||||||||||||||||||||||||||||||||||||||
| 2074 | |||||||||||||||||||||||||||||||||||||||||||
| 2075 | =head2 Firefox Notes | ||||||||||||||||||||||||||||||||||||||||||
| 2076 | |||||||||||||||||||||||||||||||||||||||||||
| 2077 | If you are intending to pass extra_capabilities to firefox on a WD3 enabled server with geckodriver, you MUST do the following: | ||||||||||||||||||||||||||||||||||||||||||
| 2078 | |||||||||||||||||||||||||||||||||||||||||||
| 2079 | $Selenium::Remote::Driver::FORCE_WD3=1; | ||||||||||||||||||||||||||||||||||||||||||
| 2080 | |||||||||||||||||||||||||||||||||||||||||||
| 2081 | This is because the gecko driver prefers legacy capabilities, both of which are normally passed for compatibility reasons. | ||||||||||||||||||||||||||||||||||||||||||
| 2082 | |||||||||||||||||||||||||||||||||||||||||||
| 2083 | =head2 Chrome Notes | ||||||||||||||||||||||||||||||||||||||||||
| 2084 | |||||||||||||||||||||||||||||||||||||||||||
| 2085 | Use the option goog:chromeOptions instead of chromeOptions, if you are intending to pass extra_capabilities on a | ||||||||||||||||||||||||||||||||||||||||||
| 2086 | WD3 enabled server with chromedriver enabled. | ||||||||||||||||||||||||||||||||||||||||||
| 2087 | |||||||||||||||||||||||||||||||||||||||||||
| 2088 | https://sites.google.com/a/chromium.org/chromedriver/capabilities | ||||||||||||||||||||||||||||||||||||||||||
| 2089 | |||||||||||||||||||||||||||||||||||||||||||
| 2090 | Also, if you instantiate the object in WC3 mode (which is the default), the remote driver will throw exceptions you have no choice but to catch, | ||||||||||||||||||||||||||||||||||||||||||
| 2091 | rather than falling back to JSONWire methods where applicable like geckodriver does. | ||||||||||||||||||||||||||||||||||||||||||
| 2092 | |||||||||||||||||||||||||||||||||||||||||||
| 2093 | As of chrome 75 (and it's appropriate driver versions), the WC3 spec has finally been implemented. | ||||||||||||||||||||||||||||||||||||||||||
| 2094 | As such, to use chrome older than this, you will have to manually force on JSONWire mode: | ||||||||||||||||||||||||||||||||||||||||||
| 2095 | |||||||||||||||||||||||||||||||||||||||||||
| 2096 | $Selenium::Remote::Driver::FORCE_WD2=1; | ||||||||||||||||||||||||||||||||||||||||||
| 2097 | |||||||||||||||||||||||||||||||||||||||||||
| 2098 | =head2 Notes on Running Selenium at Scale via selenium.jar | ||||||||||||||||||||||||||||||||||||||||||
| 2099 | |||||||||||||||||||||||||||||||||||||||||||
| 2100 | When running many, many tests in parallel you can eventually reach resource exhaustion. | ||||||||||||||||||||||||||||||||||||||||||
| 2101 | You have to instruct the Selenium JAR to do some cleanup to avoid explosions: | ||||||||||||||||||||||||||||||||||||||||||
| 2102 | |||||||||||||||||||||||||||||||||||||||||||
| 2103 | Inside of your selenium server's node.json (running a grid), you would put in the following: | ||||||||||||||||||||||||||||||||||||||||||
| 2104 | |||||||||||||||||||||||||||||||||||||||||||
| 2105 | "configuration" : | ||||||||||||||||||||||||||||||||||||||||||
| 2106 | { | ||||||||||||||||||||||||||||||||||||||||||
| 2107 | "cleanUpCycle":2000 | ||||||||||||||||||||||||||||||||||||||||||
| 2108 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2109 | Or run the selenium jar with the -cleanupCycle parameter. Of course use whatever # of seconds is appropriate to your situation. | ||||||||||||||||||||||||||||||||||||||||||
| 2110 | |||||||||||||||||||||||||||||||||||||||||||
| 2111 | =head1 CONSTRUCTOR | ||||||||||||||||||||||||||||||||||||||||||
| 2112 | |||||||||||||||||||||||||||||||||||||||||||
| 2113 | =head2 new | ||||||||||||||||||||||||||||||||||||||||||
| 2114 | |||||||||||||||||||||||||||||||||||||||||||
| 2115 | Dies if communication with the selenium server cannot be established. | ||||||||||||||||||||||||||||||||||||||||||
| 2116 | |||||||||||||||||||||||||||||||||||||||||||
| 2117 | Input: (all optional) | ||||||||||||||||||||||||||||||||||||||||||
| 2118 | |||||||||||||||||||||||||||||||||||||||||||
| 2119 | Desired capabilities - HASH - Following options are accepted: | ||||||||||||||||||||||||||||||||||||||||||
| 2120 | |||||||||||||||||||||||||||||||||||||||||||
| 2121 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2122 | |||||||||||||||||||||||||||||||||||||||||||
| 2123 | =item B<remote_server_addr> - <string> - IP or FQDN of the Webdriver server machine. Default: 'localhost' | ||||||||||||||||||||||||||||||||||||||||||
| 2124 | |||||||||||||||||||||||||||||||||||||||||||
| 2125 | =item B<port> - <string> - Port on which the Webdriver server is listening. Default: 4444 | ||||||||||||||||||||||||||||||||||||||||||
| 2126 | |||||||||||||||||||||||||||||||||||||||||||
| 2127 | =item B<browser_name> - <string> - desired browser string: {phantomjs|firefox|internet explorer|MicrosoftEdge|safari|htmlunit|iphone|chrome} | ||||||||||||||||||||||||||||||||||||||||||
| 2128 | |||||||||||||||||||||||||||||||||||||||||||
| 2129 | =item B<version> - <string> - desired browser version number | ||||||||||||||||||||||||||||||||||||||||||
| 2130 | |||||||||||||||||||||||||||||||||||||||||||
| 2131 | =item B<platform> - <string> - desired platform: {WINDOWS|XP|VISTA|MAC|LINUX|UNIX|ANY} | ||||||||||||||||||||||||||||||||||||||||||
| 2132 | |||||||||||||||||||||||||||||||||||||||||||
| 2133 | =item B<accept_ssl_certs> - <boolean> - whether SSL certs should be accepted, default is true. | ||||||||||||||||||||||||||||||||||||||||||
| 2134 | |||||||||||||||||||||||||||||||||||||||||||
| 2135 | =item B<firefox_profile> - Profile - Use Selenium::Firefox::Profile to create a Firefox profile for the browser to use. | ||||||||||||||||||||||||||||||||||||||||||
| 2136 | |||||||||||||||||||||||||||||||||||||||||||
| 2137 | =item B<javascript> - <boolean> - Whether or not to use Javascript. You probably won't disable this, as you would be using L<WWW::Mechanize> instead. Default: True | ||||||||||||||||||||||||||||||||||||||||||
| 2138 | |||||||||||||||||||||||||||||||||||||||||||
| 2139 | =item B<auto_close> - <boolean> - Whether to automatically close the browser session on the server when the object goes out of scope. Default: False. | ||||||||||||||||||||||||||||||||||||||||||
| 2140 | |||||||||||||||||||||||||||||||||||||||||||
| 2141 | =item B<default_finder> - <string> - Default method by which to evaluate selectors. Default: 'xpath' | ||||||||||||||||||||||||||||||||||||||||||
| 2142 | |||||||||||||||||||||||||||||||||||||||||||
| 2143 | =item B<session_id> - <string> - Provide a Session ID to highjack a browser session on the remote server. Useful for micro-optimizers. Default: undef | ||||||||||||||||||||||||||||||||||||||||||
| 2144 | |||||||||||||||||||||||||||||||||||||||||||
| 2145 | =item B<pageLoadStrategy> - STRING - OPTIONAL, 'normal|eager|none'. default 'normal'. WebDriver3 only. | ||||||||||||||||||||||||||||||||||||||||||
| 2146 | |||||||||||||||||||||||||||||||||||||||||||
| 2147 | =item B<extra_capabilities> - HASH - Any other extra capabilities. Accepted keys will vary by browser. If firefox_profile is passed, the args (or profile) key will be overwritten, depending on how it was passed. | ||||||||||||||||||||||||||||||||||||||||||
| 2148 | |||||||||||||||||||||||||||||||||||||||||||
| 2149 | =item B<debug> - BOOL - Turn Debug mode on from the start if true, rather than having to call debug_on(). | ||||||||||||||||||||||||||||||||||||||||||
| 2150 | |||||||||||||||||||||||||||||||||||||||||||
| 2151 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2152 | |||||||||||||||||||||||||||||||||||||||||||
| 2153 | On WebDriver3 the 'extra_capabilities' will be automatically converted into the parameter needed by your browser. | ||||||||||||||||||||||||||||||||||||||||||
| 2154 | For example, extra_capabilities is passed to the server as the moz:firefoxOptions parameter. | ||||||||||||||||||||||||||||||||||||||||||
| 2155 | |||||||||||||||||||||||||||||||||||||||||||
| 2156 | You can also specify some options in the constructor hash that are | ||||||||||||||||||||||||||||||||||||||||||
| 2157 | not part of the browser-related desired capabilities. | ||||||||||||||||||||||||||||||||||||||||||
| 2158 | |||||||||||||||||||||||||||||||||||||||||||
| 2159 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2160 | |||||||||||||||||||||||||||||||||||||||||||
| 2161 | =item B<auto_close> - <boolean> - whether driver should end session on remote server on close. | ||||||||||||||||||||||||||||||||||||||||||
| 2162 | |||||||||||||||||||||||||||||||||||||||||||
| 2163 | =item B<base_url> - <string> - OPTIONAL, base url for the website Selenium acts on. This can save you from repeating the domain in every call to $driver->get() | ||||||||||||||||||||||||||||||||||||||||||
| 2164 | |||||||||||||||||||||||||||||||||||||||||||
| 2165 | =item B<default_finder> - <string> - choose default finder used for find_element* {class|class_name|css|id|link|link_text|name|partial_link_text|tag_name|xpath} | ||||||||||||||||||||||||||||||||||||||||||
| 2166 | |||||||||||||||||||||||||||||||||||||||||||
| 2167 | =item B<inner_window_size> - <aref[Int]> - An array ref [ height, width ] that the browser window should use as its initial size immediately after instantiation | ||||||||||||||||||||||||||||||||||||||||||
| 2168 | |||||||||||||||||||||||||||||||||||||||||||
| 2169 | =item B<error_handler> - CODEREF - A CODEREF that we will call in event of any exceptions. See L</error_handler> for more details. | ||||||||||||||||||||||||||||||||||||||||||
| 2170 | |||||||||||||||||||||||||||||||||||||||||||
| 2171 | =item B<webelement_class> - <string> - sub-class of Selenium::Remote::WebElement if you wish to use an alternate WebElement class. | ||||||||||||||||||||||||||||||||||||||||||
| 2172 | |||||||||||||||||||||||||||||||||||||||||||
| 2173 | =item B<ua> - LWP::UserAgent instance - if you wish to use a specific $ua, like from Test::LWP::UserAgent | ||||||||||||||||||||||||||||||||||||||||||
| 2174 | |||||||||||||||||||||||||||||||||||||||||||
| 2175 | =item B<proxy> - HASH - Proxy configuration with the following keys: | ||||||||||||||||||||||||||||||||||||||||||
| 2176 | |||||||||||||||||||||||||||||||||||||||||||
| 2177 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 2178 | |||||||||||||||||||||||||||||||||||||||||||
| 2179 | =item B<proxyType> - <string> - REQUIRED, Possible values are: | ||||||||||||||||||||||||||||||||||||||||||
| 2180 | |||||||||||||||||||||||||||||||||||||||||||
| 2181 | direct - A direct connection - no proxy in use, | ||||||||||||||||||||||||||||||||||||||||||
| 2182 | manual - Manual proxy settings configured, e.g. setting a proxy for HTTP, a proxy for FTP, etc, | ||||||||||||||||||||||||||||||||||||||||||
| 2183 | pac - Proxy autoconfiguration from a URL, | ||||||||||||||||||||||||||||||||||||||||||
| 2184 | autodetect - proxy autodetection, probably with WPAD, | ||||||||||||||||||||||||||||||||||||||||||
| 2185 | system - Use system settings | ||||||||||||||||||||||||||||||||||||||||||
| 2186 | |||||||||||||||||||||||||||||||||||||||||||
| 2187 | =item B<proxyAutoconfigUrl> - <string> - REQUIRED if proxyType is 'pac', ignored otherwise. Expected format: http://hostname.com:1234/pacfile or file:///path/to/pacfile | ||||||||||||||||||||||||||||||||||||||||||
| 2188 | |||||||||||||||||||||||||||||||||||||||||||
| 2189 | =item B<ftpProxy> - <string> - OPTIONAL, ignored if proxyType is not 'manual'. Expected format: hostname.com:1234 | ||||||||||||||||||||||||||||||||||||||||||
| 2190 | |||||||||||||||||||||||||||||||||||||||||||
| 2191 | =item B<httpProxy> - <string> - OPTIONAL, ignored if proxyType is not 'manual'. Expected format: hostname.com:1234 | ||||||||||||||||||||||||||||||||||||||||||
| 2192 | |||||||||||||||||||||||||||||||||||||||||||
| 2193 | =item B<sslProxy> - <string> - OPTIONAL, ignored if proxyType is not 'manual'. Expected format: hostname.com:1234 | ||||||||||||||||||||||||||||||||||||||||||
| 2194 | |||||||||||||||||||||||||||||||||||||||||||
| 2195 | =item B<socksProxy> - <string> - OPTIONAL, ignored if proxyType is not 'manual'. Expected format: hostname.com:1234. WebDriver 3 only. | ||||||||||||||||||||||||||||||||||||||||||
| 2196 | |||||||||||||||||||||||||||||||||||||||||||
| 2197 | =item B<socksVersion> - <int> - OPTIONAL, ignored if proxyType is not 'manual'. WebDriver 3 only. | ||||||||||||||||||||||||||||||||||||||||||
| 2198 | |||||||||||||||||||||||||||||||||||||||||||
| 2199 | =item B<noProxy> - <ARRAY> - OPTIONAL, list of URLs to bypass the proxy for. WebDriver3 only. | ||||||||||||||||||||||||||||||||||||||||||
| 2200 | |||||||||||||||||||||||||||||||||||||||||||
| 2201 | =item B<firefox_profile> - <string> - Base64 encoded ZIP file of a firefox profile directory, for use when you don't want/need Selenium::Firefox::Profile. | ||||||||||||||||||||||||||||||||||||||||||
| 2202 | |||||||||||||||||||||||||||||||||||||||||||
| 2203 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2204 | |||||||||||||||||||||||||||||||||||||||||||
| 2205 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 2206 | |||||||||||||||||||||||||||||||||||||||||||
| 2207 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 2208 | |||||||||||||||||||||||||||||||||||||||||||
| 2209 | Selenium::Remote::Driver object | ||||||||||||||||||||||||||||||||||||||||||
| 2210 | |||||||||||||||||||||||||||||||||||||||||||
| 2211 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2212 | |||||||||||||||||||||||||||||||||||||||||||
| 2213 | my $driver = Selenium::Remote::Driver->new; | ||||||||||||||||||||||||||||||||||||||||||
| 2214 | |||||||||||||||||||||||||||||||||||||||||||
| 2215 | #or | ||||||||||||||||||||||||||||||||||||||||||
| 2216 | my $driver = Selenium::Remote::Driver->new('browser_name' => 'firefox', | ||||||||||||||||||||||||||||||||||||||||||
| 2217 | 'platform' => 'MAC'); | ||||||||||||||||||||||||||||||||||||||||||
| 2218 | |||||||||||||||||||||||||||||||||||||||||||
| 2219 | #or (for Firefox 47 or lower on Selenium 3+) | ||||||||||||||||||||||||||||||||||||||||||
| 2220 | my $driver = Selenium::Remote::Driver->new('browser_name' => 'firefox', | ||||||||||||||||||||||||||||||||||||||||||
| 2221 | 'platform' => 'MAC', | ||||||||||||||||||||||||||||||||||||||||||
| 2222 | 'extra_capabilities' => { | ||||||||||||||||||||||||||||||||||||||||||
| 2223 | 'marionette' => \0, | ||||||||||||||||||||||||||||||||||||||||||
| 2224 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 2225 | |||||||||||||||||||||||||||||||||||||||||||
| 2226 | #or | ||||||||||||||||||||||||||||||||||||||||||
| 2227 | my $driver = Selenium::Remote::Driver->new('remote_server_addr' => '10.10.1.1', | ||||||||||||||||||||||||||||||||||||||||||
| 2228 | 'port' => '2222', | ||||||||||||||||||||||||||||||||||||||||||
| 2229 | 'auto_close' => 0); | ||||||||||||||||||||||||||||||||||||||||||
| 2230 | |||||||||||||||||||||||||||||||||||||||||||
| 2231 | #or | ||||||||||||||||||||||||||||||||||||||||||
| 2232 | my $driver = Selenium::Remote::Driver->new('browser_name' =>'chrome', | ||||||||||||||||||||||||||||||||||||||||||
| 2233 | 'extra_capabilities' => { | ||||||||||||||||||||||||||||||||||||||||||
| 2234 | 'goog:chromeOptions' => { | ||||||||||||||||||||||||||||||||||||||||||
| 2235 | 'args' => [ | ||||||||||||||||||||||||||||||||||||||||||
| 2236 | 'window-size=1260,960', | ||||||||||||||||||||||||||||||||||||||||||
| 2237 | 'incognito' | ||||||||||||||||||||||||||||||||||||||||||
| 2238 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 2239 | 'prefs' => { | ||||||||||||||||||||||||||||||||||||||||||
| 2240 | 'session' => { | ||||||||||||||||||||||||||||||||||||||||||
| 2241 | 'restore_on_startup' => 4, | ||||||||||||||||||||||||||||||||||||||||||
| 2242 | 'urls_to_restore_on_startup' => [ | ||||||||||||||||||||||||||||||||||||||||||
| 2243 | 'http://www.google.com', | ||||||||||||||||||||||||||||||||||||||||||
| 2244 | 'http://docs.seleniumhq.org' | ||||||||||||||||||||||||||||||||||||||||||
| 2245 | ]}, | ||||||||||||||||||||||||||||||||||||||||||
| 2246 | 'first_run_tabs' => [ | ||||||||||||||||||||||||||||||||||||||||||
| 2247 | 'http://www.google.com', | ||||||||||||||||||||||||||||||||||||||||||
| 2248 | 'http://docs.seleniumhq.org' | ||||||||||||||||||||||||||||||||||||||||||
| 2249 | ] | ||||||||||||||||||||||||||||||||||||||||||
| 2250 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2251 | } | ||||||||||||||||||||||||||||||||||||||||||
| 2252 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 2253 | |||||||||||||||||||||||||||||||||||||||||||
| 2254 | #or | ||||||||||||||||||||||||||||||||||||||||||
| 2255 | my $driver = Selenium::Remote::Driver->new('proxy' => {'proxyType' => 'manual', 'httpProxy' => 'myproxy.com:1234'}); | ||||||||||||||||||||||||||||||||||||||||||
| 2256 | |||||||||||||||||||||||||||||||||||||||||||
| 2257 | #or | ||||||||||||||||||||||||||||||||||||||||||
| 2258 | my $driver = Selenium::Remote::Driver->new('default_finder' => 'css'); | ||||||||||||||||||||||||||||||||||||||||||
| 2259 | |||||||||||||||||||||||||||||||||||||||||||
| 2260 | =head3 error_handler | ||||||||||||||||||||||||||||||||||||||||||
| 2261 | |||||||||||||||||||||||||||||||||||||||||||
| 2262 | =head3 clear_error_handler | ||||||||||||||||||||||||||||||||||||||||||
| 2263 | |||||||||||||||||||||||||||||||||||||||||||
| 2264 | OPTIONAL constructor arg & associated setter/clearer: if you wish to | ||||||||||||||||||||||||||||||||||||||||||
| 2265 | install your own error handler, you may pass a code ref in to | ||||||||||||||||||||||||||||||||||||||||||
| 2266 | C<error_handler> during instantiation like follows: | ||||||||||||||||||||||||||||||||||||||||||
| 2267 | |||||||||||||||||||||||||||||||||||||||||||
| 2268 | my $driver = Selenium::Remote::Driver->new( | ||||||||||||||||||||||||||||||||||||||||||
| 2269 | error_handler => sub { print $_[1]; croak 'goodbye'; } | ||||||||||||||||||||||||||||||||||||||||||
| 2270 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 2271 | |||||||||||||||||||||||||||||||||||||||||||
| 2272 | Additionally, you can set and/or clear it at any time on an | ||||||||||||||||||||||||||||||||||||||||||
| 2273 | already-instantiated driver: | ||||||||||||||||||||||||||||||||||||||||||
| 2274 | |||||||||||||||||||||||||||||||||||||||||||
| 2275 | # later, change the error handler to something else | ||||||||||||||||||||||||||||||||||||||||||
| 2276 | $driver->error_handler( sub { print $_[1]; croak 'hello'; } ); | ||||||||||||||||||||||||||||||||||||||||||
| 2277 | |||||||||||||||||||||||||||||||||||||||||||
| 2278 | # stop handling errors manually and use the default S:R:D behavior | ||||||||||||||||||||||||||||||||||||||||||
| 2279 | # (we will croak about the exception) | ||||||||||||||||||||||||||||||||||||||||||
| 2280 | $driver->clear_error_handler; | ||||||||||||||||||||||||||||||||||||||||||
| 2281 | |||||||||||||||||||||||||||||||||||||||||||
| 2282 | Your error handler will receive three arguments: the first argument is | ||||||||||||||||||||||||||||||||||||||||||
| 2283 | the C<$driver> object itself, and the second argument is the exception | ||||||||||||||||||||||||||||||||||||||||||
| 2284 | message and stack trace in one multiline string. The final argument(s) are the | ||||||||||||||||||||||||||||||||||||||||||
| 2285 | argument array to the command just executed. | ||||||||||||||||||||||||||||||||||||||||||
| 2286 | |||||||||||||||||||||||||||||||||||||||||||
| 2287 | B<N.B.>: If you set your own error handler, you are entirely | ||||||||||||||||||||||||||||||||||||||||||
| 2288 | responsible for handling webdriver exceptions, _including_ croaking | ||||||||||||||||||||||||||||||||||||||||||
| 2289 | behavior. That is, when you set an error handler, we will no longer | ||||||||||||||||||||||||||||||||||||||||||
| 2290 | croak on Webdriver exceptions - it's up to you to do so. For | ||||||||||||||||||||||||||||||||||||||||||
| 2291 | consistency with the standard S:R:D behavior, we recommend your error | ||||||||||||||||||||||||||||||||||||||||||
| 2292 | handler also croak when it's done, especially since your test | ||||||||||||||||||||||||||||||||||||||||||
| 2293 | shouldn't be running into unexpected errors. Catching specific or | ||||||||||||||||||||||||||||||||||||||||||
| 2294 | desired errors in your error handler makes sense, but not croaking at | ||||||||||||||||||||||||||||||||||||||||||
| 2295 | all can leave you in unfamiliar territory. Reaching an unexpected | ||||||||||||||||||||||||||||||||||||||||||
| 2296 | exception might mean your test has gone off the rails, and the further | ||||||||||||||||||||||||||||||||||||||||||
| 2297 | your test gets from the source of the of the exception, the harder it | ||||||||||||||||||||||||||||||||||||||||||
| 2298 | will be to debug. | ||||||||||||||||||||||||||||||||||||||||||
| 2299 | |||||||||||||||||||||||||||||||||||||||||||
| 2300 | B<N.B.>: Four methods will still croak on their own: L</find_element>, | ||||||||||||||||||||||||||||||||||||||||||
| 2301 | L</find_elements>, L</find_child_element>, and | ||||||||||||||||||||||||||||||||||||||||||
| 2302 | L</find_child_elements>. If these methods throw a Webdriver Exception, | ||||||||||||||||||||||||||||||||||||||||||
| 2303 | your error handler _will still be_ invoked inside an C<eval>, and then | ||||||||||||||||||||||||||||||||||||||||||
| 2304 | they'll croak with their own error message that indicates the locator | ||||||||||||||||||||||||||||||||||||||||||
| 2305 | and strategy used. So, your strategies for avoiding exceptions when | ||||||||||||||||||||||||||||||||||||||||||
| 2306 | finding elements do not change (either use find_elements and check | ||||||||||||||||||||||||||||||||||||||||||
| 2307 | the returned array size, wrap your calls to find_element* in an | ||||||||||||||||||||||||||||||||||||||||||
| 2308 | C<eval>, or use the parameterized versions find_element_*). | ||||||||||||||||||||||||||||||||||||||||||
| 2309 | |||||||||||||||||||||||||||||||||||||||||||
| 2310 | =head2 new_from_caps | ||||||||||||||||||||||||||||||||||||||||||
| 2311 | |||||||||||||||||||||||||||||||||||||||||||
| 2312 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2313 | For experienced users who want complete control over the desired | ||||||||||||||||||||||||||||||||||||||||||
| 2314 | capabilities, use this alternative constructor along with the | ||||||||||||||||||||||||||||||||||||||||||
| 2315 | C<desired_capabilities> hash key in the init hash. Unlike "new", | ||||||||||||||||||||||||||||||||||||||||||
| 2316 | this constructor will not assume any defaults for your desired | ||||||||||||||||||||||||||||||||||||||||||
| 2317 | capabilities. | ||||||||||||||||||||||||||||||||||||||||||
| 2318 | |||||||||||||||||||||||||||||||||||||||||||
| 2319 | This alternate constructor IGNORES all other browser-related | ||||||||||||||||||||||||||||||||||||||||||
| 2320 | desiredCapability options; the only options that will be respected | ||||||||||||||||||||||||||||||||||||||||||
| 2321 | are those that are NOT part of the Capabilities JSON Object as | ||||||||||||||||||||||||||||||||||||||||||
| 2322 | described in the Json Wire Protocol. | ||||||||||||||||||||||||||||||||||||||||||
| 2323 | |||||||||||||||||||||||||||||||||||||||||||
| 2324 | Input: | ||||||||||||||||||||||||||||||||||||||||||
| 2325 | The only respected keys in the input hash are: | ||||||||||||||||||||||||||||||||||||||||||
| 2326 | |||||||||||||||||||||||||||||||||||||||||||
| 2327 | desired_capabilities - HASHREF - defaults to {} | ||||||||||||||||||||||||||||||||||||||||||
| 2328 | remote_server_addr - STRING - defaults to localhost | ||||||||||||||||||||||||||||||||||||||||||
| 2329 | port - INTEGER - defaults to 4444 | ||||||||||||||||||||||||||||||||||||||||||
| 2330 | default_finder - STRING - defaults to xpath | ||||||||||||||||||||||||||||||||||||||||||
| 2331 | webelement_class - STRING - defaults to Selenium::Remote::WebElement | ||||||||||||||||||||||||||||||||||||||||||
| 2332 | auto_close - BOOLEAN - defaults to 1 | ||||||||||||||||||||||||||||||||||||||||||
| 2333 | error_handler - CODEREF - defaults to croaking on exceptions | ||||||||||||||||||||||||||||||||||||||||||
| 2334 | |||||||||||||||||||||||||||||||||||||||||||
| 2335 | Except for C<desired_capabilities>, these keys perform exactly the | ||||||||||||||||||||||||||||||||||||||||||
| 2336 | same as listed in the regular "new" constructor. | ||||||||||||||||||||||||||||||||||||||||||
| 2337 | |||||||||||||||||||||||||||||||||||||||||||
| 2338 | The hashref you pass in as desired_capabilities only gets json | ||||||||||||||||||||||||||||||||||||||||||
| 2339 | encoded before being passed to the Selenium server; no default | ||||||||||||||||||||||||||||||||||||||||||
| 2340 | options of any sort will be added. | ||||||||||||||||||||||||||||||||||||||||||
| 2341 | |||||||||||||||||||||||||||||||||||||||||||
| 2342 | This means you must handle normalization and casing of the input | ||||||||||||||||||||||||||||||||||||||||||
| 2343 | options (like "browser_name" vs "browserName") and take care of | ||||||||||||||||||||||||||||||||||||||||||
| 2344 | things like encoding the firefox profile if applicable. More | ||||||||||||||||||||||||||||||||||||||||||
| 2345 | information about the desired capabilities object is available on | ||||||||||||||||||||||||||||||||||||||||||
| 2346 | the Selenium wiki: | ||||||||||||||||||||||||||||||||||||||||||
| 2347 | |||||||||||||||||||||||||||||||||||||||||||
| 2348 | https://code.google.com/p/selenium/wiki/JsonWireProtocol#Capabilities_JSON_Object | ||||||||||||||||||||||||||||||||||||||||||
| 2349 | |||||||||||||||||||||||||||||||||||||||||||
| 2350 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 2351 | Remote Driver object | ||||||||||||||||||||||||||||||||||||||||||
| 2352 | |||||||||||||||||||||||||||||||||||||||||||
| 2353 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2354 | my $driver = Selenium::Remote::Driver->new_from_caps( | ||||||||||||||||||||||||||||||||||||||||||
| 2355 | 'desired_capabilities' => {'browserName' => 'firefox'} | ||||||||||||||||||||||||||||||||||||||||||
| 2356 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 2357 | |||||||||||||||||||||||||||||||||||||||||||
| 2358 | The above would generate a POST to the webdriver server at | ||||||||||||||||||||||||||||||||||||||||||
| 2359 | localhost:4444 with the exact payload of '{"desiredCapabilities": | ||||||||||||||||||||||||||||||||||||||||||
| 2360 | {"browserName": "firefox" }}'. | ||||||||||||||||||||||||||||||||||||||||||
| 2361 | |||||||||||||||||||||||||||||||||||||||||||
| 2362 | =for Pod::Coverage has_base_url | ||||||||||||||||||||||||||||||||||||||||||
| 2363 | |||||||||||||||||||||||||||||||||||||||||||
| 2364 | =for Pod::Coverage has_desired_capabilities | ||||||||||||||||||||||||||||||||||||||||||
| 2365 | |||||||||||||||||||||||||||||||||||||||||||
| 2366 | =for Pod::Coverage has_error_handler | ||||||||||||||||||||||||||||||||||||||||||
| 2367 | |||||||||||||||||||||||||||||||||||||||||||
| 2368 | =for Pod::Coverage has_firefox_profile | ||||||||||||||||||||||||||||||||||||||||||
| 2369 | |||||||||||||||||||||||||||||||||||||||||||
| 2370 | =for Pod::Coverage has_inner_window_size | ||||||||||||||||||||||||||||||||||||||||||
| 2371 | |||||||||||||||||||||||||||||||||||||||||||
| 2372 | =for Pod::Coverage has_javascript | ||||||||||||||||||||||||||||||||||||||||||
| 2373 | |||||||||||||||||||||||||||||||||||||||||||
| 2374 | =for Pod::Coverage has_port | ||||||||||||||||||||||||||||||||||||||||||
| 2375 | |||||||||||||||||||||||||||||||||||||||||||
| 2376 | =for Pod::Coverage has_remote_server_addr | ||||||||||||||||||||||||||||||||||||||||||
| 2377 | |||||||||||||||||||||||||||||||||||||||||||
| 2378 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 2379 | |||||||||||||||||||||||||||||||||||||||||||
| 2380 | =head2 new_session (extra_capabilities) | ||||||||||||||||||||||||||||||||||||||||||
| 2381 | |||||||||||||||||||||||||||||||||||||||||||
| 2382 | Make a new session on the server. | ||||||||||||||||||||||||||||||||||||||||||
| 2383 | Called by new(), not intended for regular use. | ||||||||||||||||||||||||||||||||||||||||||
| 2384 | |||||||||||||||||||||||||||||||||||||||||||
| 2385 | Occaisonally handy for recovering from brower crashes. | ||||||||||||||||||||||||||||||||||||||||||
| 2386 | |||||||||||||||||||||||||||||||||||||||||||
| 2387 | DANGER DANGER DANGER | ||||||||||||||||||||||||||||||||||||||||||
| 2388 | |||||||||||||||||||||||||||||||||||||||||||
| 2389 | This will throw away your old session if you have not closed it! | ||||||||||||||||||||||||||||||||||||||||||
| 2390 | |||||||||||||||||||||||||||||||||||||||||||
| 2391 | DANGER DANGER DANGER | ||||||||||||||||||||||||||||||||||||||||||
| 2392 | |||||||||||||||||||||||||||||||||||||||||||
| 2393 | =head2 new_desired_session(capabilities) | ||||||||||||||||||||||||||||||||||||||||||
| 2394 | |||||||||||||||||||||||||||||||||||||||||||
| 2395 | Basically the same as new_session, but with caps. | ||||||||||||||||||||||||||||||||||||||||||
| 2396 | Sort of an analog to new_from_caps. | ||||||||||||||||||||||||||||||||||||||||||
| 2397 | |||||||||||||||||||||||||||||||||||||||||||
| 2398 | =head2 is_webdriver_3 | ||||||||||||||||||||||||||||||||||||||||||
| 2399 | |||||||||||||||||||||||||||||||||||||||||||
| 2400 | Print whether the server (or browser) thinks it's implemented webdriver 3. | ||||||||||||||||||||||||||||||||||||||||||
| 2401 | If this returns true, webdriver 3 methods will be used in the case an action exists in L<Selenium::Remote::Spec> for the method you are trying to call. | ||||||||||||||||||||||||||||||||||||||||||
| 2402 | If a method you are calling has no webdriver 3 equivalent (or browser extension), the legacy commands implemented in L<Selenium::Remote::Commands> will be used. | ||||||||||||||||||||||||||||||||||||||||||
| 2403 | |||||||||||||||||||||||||||||||||||||||||||
| 2404 | Note how I said *thinks* above. In the case you want to force usage of legacy methods, set $driver->{is_wd3} to work around various browser issues. | ||||||||||||||||||||||||||||||||||||||||||
| 2405 | |||||||||||||||||||||||||||||||||||||||||||
| 2406 | =head2 debug_on | ||||||||||||||||||||||||||||||||||||||||||
| 2407 | |||||||||||||||||||||||||||||||||||||||||||
| 2408 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2409 | Turns on debugging mode and the driver will print extra info like request | ||||||||||||||||||||||||||||||||||||||||||
| 2410 | and response to stdout. Useful, when you want to see what is being sent to | ||||||||||||||||||||||||||||||||||||||||||
| 2411 | the server & what response you are getting back. | ||||||||||||||||||||||||||||||||||||||||||
| 2412 | |||||||||||||||||||||||||||||||||||||||||||
| 2413 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2414 | $driver->debug_on; | ||||||||||||||||||||||||||||||||||||||||||
| 2415 | |||||||||||||||||||||||||||||||||||||||||||
| 2416 | =head2 debug_off | ||||||||||||||||||||||||||||||||||||||||||
| 2417 | |||||||||||||||||||||||||||||||||||||||||||
| 2418 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2419 | Turns off the debugging mode. | ||||||||||||||||||||||||||||||||||||||||||
| 2420 | |||||||||||||||||||||||||||||||||||||||||||
| 2421 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2422 | $driver->debug_off; | ||||||||||||||||||||||||||||||||||||||||||
| 2423 | |||||||||||||||||||||||||||||||||||||||||||
| 2424 | =head2 get_sessions | ||||||||||||||||||||||||||||||||||||||||||
| 2425 | |||||||||||||||||||||||||||||||||||||||||||
| 2426 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2427 | Returns a list of the currently active sessions. Each session will be | ||||||||||||||||||||||||||||||||||||||||||
| 2428 | returned as an array of Hashes with the following keys: | ||||||||||||||||||||||||||||||||||||||||||
| 2429 | |||||||||||||||||||||||||||||||||||||||||||
| 2430 | 'id' : The session ID | ||||||||||||||||||||||||||||||||||||||||||
| 2431 | 'capabilities: An object describing session's capabilities | ||||||||||||||||||||||||||||||||||||||||||
| 2432 | |||||||||||||||||||||||||||||||||||||||||||
| 2433 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 2434 | Array of Hashes | ||||||||||||||||||||||||||||||||||||||||||
| 2435 | |||||||||||||||||||||||||||||||||||||||||||
| 2436 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2437 | print Dumper $driver->get_sessions(); | ||||||||||||||||||||||||||||||||||||||||||
| 2438 | |||||||||||||||||||||||||||||||||||||||||||
| 2439 | =head2 status | ||||||||||||||||||||||||||||||||||||||||||
| 2440 | |||||||||||||||||||||||||||||||||||||||||||
| 2441 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2442 | Query the server's current status. All server implementations | ||||||||||||||||||||||||||||||||||||||||||
| 2443 | should return two basic objects describing the server's current | ||||||||||||||||||||||||||||||||||||||||||
| 2444 | platform and when the server was built. | ||||||||||||||||||||||||||||||||||||||||||
| 2445 | |||||||||||||||||||||||||||||||||||||||||||
| 2446 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 2447 | Hash ref | ||||||||||||||||||||||||||||||||||||||||||
| 2448 | |||||||||||||||||||||||||||||||||||||||||||
| 2449 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2450 | print Dumper $driver->status; | ||||||||||||||||||||||||||||||||||||||||||
| 2451 | |||||||||||||||||||||||||||||||||||||||||||
| 2452 | =head2 get_alert_text | ||||||||||||||||||||||||||||||||||||||||||
| 2453 | |||||||||||||||||||||||||||||||||||||||||||
| 2454 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2455 | Gets the text of the currently displayed JavaScript alert(), confirm() | ||||||||||||||||||||||||||||||||||||||||||
| 2456 | or prompt() dialog. | ||||||||||||||||||||||||||||||||||||||||||
| 2457 | |||||||||||||||||||||||||||||||||||||||||||
| 2458 | Example | ||||||||||||||||||||||||||||||||||||||||||
| 2459 | my $string = $driver->get_alert_text; | ||||||||||||||||||||||||||||||||||||||||||
| 2460 | |||||||||||||||||||||||||||||||||||||||||||
| 2461 | =head2 send_keys_to_active_element | ||||||||||||||||||||||||||||||||||||||||||
| 2462 | |||||||||||||||||||||||||||||||||||||||||||
| 2463 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2464 | Send a sequence of key strokes to the active element. This command is | ||||||||||||||||||||||||||||||||||||||||||
| 2465 | similar to the send keys command in every aspect except the implicit | ||||||||||||||||||||||||||||||||||||||||||
| 2466 | termination: The modifiers are not released at the end of the call. | ||||||||||||||||||||||||||||||||||||||||||
| 2467 | Rather, the state of the modifier keys is kept between calls, so mouse | ||||||||||||||||||||||||||||||||||||||||||
| 2468 | interactions can be performed while modifier keys are depressed. | ||||||||||||||||||||||||||||||||||||||||||
| 2469 | |||||||||||||||||||||||||||||||||||||||||||
| 2470 | Compatibility: | ||||||||||||||||||||||||||||||||||||||||||
| 2471 | On webdriver 3 servers, don't use this to send modifier keys; use send_modifier instead. | ||||||||||||||||||||||||||||||||||||||||||
| 2472 | |||||||||||||||||||||||||||||||||||||||||||
| 2473 | Input: 1 | ||||||||||||||||||||||||||||||||||||||||||
| 2474 | Required: | ||||||||||||||||||||||||||||||||||||||||||
| 2475 | {ARRAY | STRING} - Array of strings or a string. | ||||||||||||||||||||||||||||||||||||||||||
| 2476 | |||||||||||||||||||||||||||||||||||||||||||
| 2477 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2478 | $driver->send_keys_to_active_element('abcd', 'efg'); | ||||||||||||||||||||||||||||||||||||||||||
| 2479 | $driver->send_keys_to_active_element('hijk'); | ||||||||||||||||||||||||||||||||||||||||||
| 2480 | |||||||||||||||||||||||||||||||||||||||||||
| 2481 | or | ||||||||||||||||||||||||||||||||||||||||||
| 2482 | |||||||||||||||||||||||||||||||||||||||||||
| 2483 | # include the WDKeys module | ||||||||||||||||||||||||||||||||||||||||||
| 2484 | use Selenium::Remote::WDKeys; | ||||||||||||||||||||||||||||||||||||||||||
| 2485 | $driver->send_keys_to_active_element(KEYS->{'space'}, KEYS->{'enter'}); | ||||||||||||||||||||||||||||||||||||||||||
| 2486 | |||||||||||||||||||||||||||||||||||||||||||
| 2487 | =head2 send_keys_to_alert | ||||||||||||||||||||||||||||||||||||||||||
| 2488 | |||||||||||||||||||||||||||||||||||||||||||
| 2489 | Synonymous with send_keys_to_prompt | ||||||||||||||||||||||||||||||||||||||||||
| 2490 | |||||||||||||||||||||||||||||||||||||||||||
| 2491 | =head2 send_keys_to_prompt | ||||||||||||||||||||||||||||||||||||||||||
| 2492 | |||||||||||||||||||||||||||||||||||||||||||
| 2493 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2494 | Sends keystrokes to a JavaScript prompt() dialog. | ||||||||||||||||||||||||||||||||||||||||||
| 2495 | |||||||||||||||||||||||||||||||||||||||||||
| 2496 | Input: | ||||||||||||||||||||||||||||||||||||||||||
| 2497 | {string} keys to send | ||||||||||||||||||||||||||||||||||||||||||
| 2498 | |||||||||||||||||||||||||||||||||||||||||||
| 2499 | Example: | ||||||||||||||||||||||||||||||||||||||||||
| 2500 | $driver->send_keys_to_prompt('hello world'); | ||||||||||||||||||||||||||||||||||||||||||
| 2501 | or | ||||||||||||||||||||||||||||||||||||||||||
| 2502 | ok($driver->get_alert_text eq 'Please Input your name','prompt appears'); | ||||||||||||||||||||||||||||||||||||||||||
| 2503 | $driver->send_keys_to_alert("Larry Wall"); | ||||||||||||||||||||||||||||||||||||||||||
| 2504 | $driver->accept_alert; | ||||||||||||||||||||||||||||||||||||||||||
| 2505 | |||||||||||||||||||||||||||||||||||||||||||
| 2506 | =head2 accept_alert | ||||||||||||||||||||||||||||||||||||||||||
| 2507 | |||||||||||||||||||||||||||||||||||||||||||
| 2508 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2509 | Accepts the currently displayed alert dialog. Usually, this is | ||||||||||||||||||||||||||||||||||||||||||
| 2510 | equivalent to clicking the 'OK' button in the dialog. | ||||||||||||||||||||||||||||||||||||||||||
| 2511 | |||||||||||||||||||||||||||||||||||||||||||
| 2512 | Example: | ||||||||||||||||||||||||||||||||||||||||||
| 2513 | $driver->accept_alert; | ||||||||||||||||||||||||||||||||||||||||||
| 2514 | |||||||||||||||||||||||||||||||||||||||||||
| 2515 | =head2 dismiss_alert | ||||||||||||||||||||||||||||||||||||||||||
| 2516 | |||||||||||||||||||||||||||||||||||||||||||
| 2517 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2518 | Dismisses the currently displayed alert dialog. For comfirm() | ||||||||||||||||||||||||||||||||||||||||||
| 2519 | and prompt() dialogs, this is equivalent to clicking the | ||||||||||||||||||||||||||||||||||||||||||
| 2520 | 'Cancel' button. For alert() dialogs, this is equivalent to | ||||||||||||||||||||||||||||||||||||||||||
| 2521 | clicking the 'OK' button. | ||||||||||||||||||||||||||||||||||||||||||
| 2522 | |||||||||||||||||||||||||||||||||||||||||||
| 2523 | Example: | ||||||||||||||||||||||||||||||||||||||||||
| 2524 | $driver->dismiss_alert; | ||||||||||||||||||||||||||||||||||||||||||
| 2525 | |||||||||||||||||||||||||||||||||||||||||||
| 2526 | =head2 general_action | ||||||||||||||||||||||||||||||||||||||||||
| 2527 | |||||||||||||||||||||||||||||||||||||||||||
| 2528 | Provide an 'actions definition' hash to make webdriver use input devices. | ||||||||||||||||||||||||||||||||||||||||||
| 2529 | Given the spec for the structure of this data is 'non normative', | ||||||||||||||||||||||||||||||||||||||||||
| 2530 | it is left as an exercise to the reader what that means as to how to use this function. | ||||||||||||||||||||||||||||||||||||||||||
| 2531 | |||||||||||||||||||||||||||||||||||||||||||
| 2532 | That said, it seems most of the data looks something like this: | ||||||||||||||||||||||||||||||||||||||||||
| 2533 | |||||||||||||||||||||||||||||||||||||||||||
| 2534 | $driver->general_action( actions => [{ | ||||||||||||||||||||||||||||||||||||||||||
| 2535 | type => 'pointer|key|none|somethingElseSuperSpecialDefinedByYourBrowserDriver', | ||||||||||||||||||||||||||||||||||||||||||
| 2536 | id => MUST be mouse|key|none|other. And by 'other' I mean anything else. The first 3 are 'special' in that they are used in the global actions queue. | ||||||||||||||||||||||||||||||||||||||||||
| 2537 | If you want say, another mouse action to execute in parallel to other mouse actions (to simulate multi-touch, for example), call your action 'otherMouseAction' or something. | ||||||||||||||||||||||||||||||||||||||||||
| 2538 | parameters => { | ||||||||||||||||||||||||||||||||||||||||||
| 2539 | someOption => "basically these are global parameters used by all steps in the forthcoming "action chain". | ||||||||||||||||||||||||||||||||||||||||||
| 2540 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 2541 | actions => [ | ||||||||||||||||||||||||||||||||||||||||||
| 2542 | { | ||||||||||||||||||||||||||||||||||||||||||
| 2543 | type => "keyUp|KeyDown if key, pointerUp|pointerDown|pointerMove|pointerCancel if pointer, pause if any type", | ||||||||||||||||||||||||||||||||||||||||||
| 2544 | key => A raw keycode or character from the keyboard if this is a key event, | ||||||||||||||||||||||||||||||||||||||||||
| 2545 | duration => how many 'ticks' this action should take, you probably want this to be 0 all of the time unless you are evading Software debounce. | ||||||||||||||||||||||||||||||||||||||||||
| 2546 | button => what number button if you are using a pointer (this sounds terribly like it might be re-purposed to be a joypad in the future sometime) | ||||||||||||||||||||||||||||||||||||||||||
| 2547 | origin => Point of Origin if moving a pointer around | ||||||||||||||||||||||||||||||||||||||||||
| 2548 | x => unit vector to travel along x-axis if pointerMove event | ||||||||||||||||||||||||||||||||||||||||||
| 2549 | y => unit vector to travel along y-axis if pointerMove event | ||||||||||||||||||||||||||||||||||||||||||
| 2550 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 2551 | ... | ||||||||||||||||||||||||||||||||||||||||||
| 2552 | ] | ||||||||||||||||||||||||||||||||||||||||||
| 2553 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 2554 | ... | ||||||||||||||||||||||||||||||||||||||||||
| 2555 | ] | ||||||||||||||||||||||||||||||||||||||||||
| 2556 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 2557 | |||||||||||||||||||||||||||||||||||||||||||
| 2558 | Only available on WebDriver3 capable selenium servers. | ||||||||||||||||||||||||||||||||||||||||||
| 2559 | |||||||||||||||||||||||||||||||||||||||||||
| 2560 | If you have called any legacy shim, such as mouse_move_to_location() previously, your actions passed will be appended to the existing actions queue. | ||||||||||||||||||||||||||||||||||||||||||
| 2561 | Called with no arguments, it simply executes the existing action queue. | ||||||||||||||||||||||||||||||||||||||||||
| 2562 | |||||||||||||||||||||||||||||||||||||||||||
| 2563 | If you are looking for pre-baked action chains that aren't currently part of L<Selenium::Remote::Driver>, | ||||||||||||||||||||||||||||||||||||||||||
| 2564 | consider L<Selenium::ActionChains>, which is shipped with this distribution instead. | ||||||||||||||||||||||||||||||||||||||||||
| 2565 | |||||||||||||||||||||||||||||||||||||||||||
| 2566 | =head3 COMPATIBILITY | ||||||||||||||||||||||||||||||||||||||||||
| 2567 | |||||||||||||||||||||||||||||||||||||||||||
| 2568 | Like most places, the WC3 standard is openly ignored by the driver binaries. | ||||||||||||||||||||||||||||||||||||||||||
| 2569 | Generally an "actions" object will only accept: | ||||||||||||||||||||||||||||||||||||||||||
| 2570 | |||||||||||||||||||||||||||||||||||||||||||
| 2571 | { type => ..., value => ... } | ||||||||||||||||||||||||||||||||||||||||||
| 2572 | |||||||||||||||||||||||||||||||||||||||||||
| 2573 | When using the direct drivers (E.G. Selenium::Chrome, Selenium::Firefox). | ||||||||||||||||||||||||||||||||||||||||||
| 2574 | This is not documented anywhere but here, as far as I can tell. | ||||||||||||||||||||||||||||||||||||||||||
| 2575 | |||||||||||||||||||||||||||||||||||||||||||
| 2576 | =head2 release_general_action | ||||||||||||||||||||||||||||||||||||||||||
| 2577 | |||||||||||||||||||||||||||||||||||||||||||
| 2578 | Nukes *all* input device state (modifier key up/down, pointer button up/down, pointer location, and other device state) from orbit. | ||||||||||||||||||||||||||||||||||||||||||
| 2579 | Call if you forget to do a *Up event in your provided action chains, or just to save time. | ||||||||||||||||||||||||||||||||||||||||||
| 2580 | |||||||||||||||||||||||||||||||||||||||||||
| 2581 | Also clears the current actions queue. | ||||||||||||||||||||||||||||||||||||||||||
| 2582 | |||||||||||||||||||||||||||||||||||||||||||
| 2583 | Only available on WebDriver3 capable selenium servers. | ||||||||||||||||||||||||||||||||||||||||||
| 2584 | |||||||||||||||||||||||||||||||||||||||||||
| 2585 | =head2 mouse_move_to_location | ||||||||||||||||||||||||||||||||||||||||||
| 2586 | |||||||||||||||||||||||||||||||||||||||||||
| 2587 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2588 | Move the mouse by an offset of the specificed element. If no | ||||||||||||||||||||||||||||||||||||||||||
| 2589 | element is specified, the move is relative to the current mouse | ||||||||||||||||||||||||||||||||||||||||||
| 2590 | cursor. If an element is provided but no offset, the mouse will be | ||||||||||||||||||||||||||||||||||||||||||
| 2591 | moved to the center of the element. If the element is not visible, | ||||||||||||||||||||||||||||||||||||||||||
| 2592 | it will be scrolled into view. | ||||||||||||||||||||||||||||||||||||||||||
| 2593 | |||||||||||||||||||||||||||||||||||||||||||
| 2594 | Compatibility: | ||||||||||||||||||||||||||||||||||||||||||
| 2595 | Due to limitations in the Webdriver 3 API, mouse movements have to be executed 'lazily' e.g. only right before a click() event occurs. | ||||||||||||||||||||||||||||||||||||||||||
| 2596 | This is because there is no longer any persistent mouse location state; mouse movements are now totally atomic. | ||||||||||||||||||||||||||||||||||||||||||
| 2597 | This has several problematic aspects; for one, I can't think of a way to both hover an element and then do another action relying on the element staying hover()ed, | ||||||||||||||||||||||||||||||||||||||||||
| 2598 | Aside from using javascript workarounds. | ||||||||||||||||||||||||||||||||||||||||||
| 2599 | |||||||||||||||||||||||||||||||||||||||||||
| 2600 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 2601 | STRING - | ||||||||||||||||||||||||||||||||||||||||||
| 2602 | |||||||||||||||||||||||||||||||||||||||||||
| 2603 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2604 | # element - the element to move to. If not specified or is null, the offset is relative to current position of the mouse. | ||||||||||||||||||||||||||||||||||||||||||
| 2605 | # xoffset - X offset to move to, relative to the top-left corner of the element. If not specified, the mouse will move to the middle of the element. | ||||||||||||||||||||||||||||||||||||||||||
| 2606 | # yoffset - Y offset to move to, relative to the top-left corner of the element. If not specified, the mouse will move to the middle of the element. | ||||||||||||||||||||||||||||||||||||||||||
| 2607 | |||||||||||||||||||||||||||||||||||||||||||
| 2608 | print $driver->mouse_move_to_location(element => e, xoffset => x, yoffset => y); | ||||||||||||||||||||||||||||||||||||||||||
| 2609 | |||||||||||||||||||||||||||||||||||||||||||
| 2610 | =head2 move_to | ||||||||||||||||||||||||||||||||||||||||||
| 2611 | |||||||||||||||||||||||||||||||||||||||||||
| 2612 | Synonymous with mouse_move_to_location | ||||||||||||||||||||||||||||||||||||||||||
| 2613 | |||||||||||||||||||||||||||||||||||||||||||
| 2614 | =head2 get_capabilities | ||||||||||||||||||||||||||||||||||||||||||
| 2615 | |||||||||||||||||||||||||||||||||||||||||||
| 2616 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2617 | Retrieve the capabilities of the specified session. | ||||||||||||||||||||||||||||||||||||||||||
| 2618 | |||||||||||||||||||||||||||||||||||||||||||
| 2619 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 2620 | HASH of all the capabilities. | ||||||||||||||||||||||||||||||||||||||||||
| 2621 | |||||||||||||||||||||||||||||||||||||||||||
| 2622 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2623 | my $capab = $driver->get_capabilities(); | ||||||||||||||||||||||||||||||||||||||||||
| 2624 | print Dumper($capab); | ||||||||||||||||||||||||||||||||||||||||||
| 2625 | |||||||||||||||||||||||||||||||||||||||||||
| 2626 | =head2 get_timeouts | ||||||||||||||||||||||||||||||||||||||||||
| 2627 | |||||||||||||||||||||||||||||||||||||||||||
| 2628 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2629 | Get the currently configured values (ms) for the page load, script and implicit timeouts. | ||||||||||||||||||||||||||||||||||||||||||
| 2630 | |||||||||||||||||||||||||||||||||||||||||||
| 2631 | Compatibility: | ||||||||||||||||||||||||||||||||||||||||||
| 2632 | Only available on WebDriver3 enabled selenium servers. | ||||||||||||||||||||||||||||||||||||||||||
| 2633 | |||||||||||||||||||||||||||||||||||||||||||
| 2634 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2635 | $driver->get_timeouts(); | ||||||||||||||||||||||||||||||||||||||||||
| 2636 | |||||||||||||||||||||||||||||||||||||||||||
| 2637 | =head2 set_timeout | ||||||||||||||||||||||||||||||||||||||||||
| 2638 | |||||||||||||||||||||||||||||||||||||||||||
| 2639 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2640 | Configure the amount of time that a particular type of operation can execute | ||||||||||||||||||||||||||||||||||||||||||
| 2641 | for before they are aborted and a |Timeout| error is returned to the client. | ||||||||||||||||||||||||||||||||||||||||||
| 2642 | |||||||||||||||||||||||||||||||||||||||||||
| 2643 | Input: | ||||||||||||||||||||||||||||||||||||||||||
| 2644 | type - <STRING> - The type of operation to set the timeout for. | ||||||||||||||||||||||||||||||||||||||||||
| 2645 | Valid values are: | ||||||||||||||||||||||||||||||||||||||||||
| 2646 | "script" : for script timeouts, | ||||||||||||||||||||||||||||||||||||||||||
| 2647 | "implicit" : for modifying the implicit wait timeout | ||||||||||||||||||||||||||||||||||||||||||
| 2648 | "page load" : for setting a page load timeout. | ||||||||||||||||||||||||||||||||||||||||||
| 2649 | ms - <NUMBER> - The amount of time, in milliseconds, that time-limited | ||||||||||||||||||||||||||||||||||||||||||
| 2650 | commands are permitted to run. | ||||||||||||||||||||||||||||||||||||||||||
| 2651 | |||||||||||||||||||||||||||||||||||||||||||
| 2652 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2653 | $driver->set_timeout('script', 1000); | ||||||||||||||||||||||||||||||||||||||||||
| 2654 | |||||||||||||||||||||||||||||||||||||||||||
| 2655 | =head2 set_async_script_timeout | ||||||||||||||||||||||||||||||||||||||||||
| 2656 | |||||||||||||||||||||||||||||||||||||||||||
| 2657 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2658 | Set the amount of time, in milliseconds, that asynchronous scripts executed | ||||||||||||||||||||||||||||||||||||||||||
| 2659 | by execute_async_script() are permitted to run before they are | ||||||||||||||||||||||||||||||||||||||||||
| 2660 | aborted and a |Timeout| error is returned to the client. | ||||||||||||||||||||||||||||||||||||||||||
| 2661 | |||||||||||||||||||||||||||||||||||||||||||
| 2662 | Input: | ||||||||||||||||||||||||||||||||||||||||||
| 2663 | ms - <NUMBER> - The amount of time, in milliseconds, that time-limited | ||||||||||||||||||||||||||||||||||||||||||
| 2664 | commands are permitted to run. | ||||||||||||||||||||||||||||||||||||||||||
| 2665 | |||||||||||||||||||||||||||||||||||||||||||
| 2666 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2667 | $driver->set_async_script_timeout(1000); | ||||||||||||||||||||||||||||||||||||||||||
| 2668 | |||||||||||||||||||||||||||||||||||||||||||
| 2669 | =head2 set_implicit_wait_timeout | ||||||||||||||||||||||||||||||||||||||||||
| 2670 | |||||||||||||||||||||||||||||||||||||||||||
| 2671 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2672 | Set the amount of time the driver should wait when searching for elements. | ||||||||||||||||||||||||||||||||||||||||||
| 2673 | When searching for a single element, the driver will poll the page until | ||||||||||||||||||||||||||||||||||||||||||
| 2674 | an element is found or the timeout expires, whichever occurs first. | ||||||||||||||||||||||||||||||||||||||||||
| 2675 | When searching for multiple elements, the driver should poll the page until | ||||||||||||||||||||||||||||||||||||||||||
| 2676 | at least one element is found or the timeout expires, at which point it | ||||||||||||||||||||||||||||||||||||||||||
| 2677 | will return an empty list. If this method is never called, the driver will | ||||||||||||||||||||||||||||||||||||||||||
| 2678 | default to an implicit wait of 0ms. | ||||||||||||||||||||||||||||||||||||||||||
| 2679 | |||||||||||||||||||||||||||||||||||||||||||
| 2680 | This is exactly equivalent to calling L</set_timeout> with a type | ||||||||||||||||||||||||||||||||||||||||||
| 2681 | arg of C<"implicit">. | ||||||||||||||||||||||||||||||||||||||||||
| 2682 | |||||||||||||||||||||||||||||||||||||||||||
| 2683 | Input: | ||||||||||||||||||||||||||||||||||||||||||
| 2684 | Time in milliseconds. | ||||||||||||||||||||||||||||||||||||||||||
| 2685 | |||||||||||||||||||||||||||||||||||||||||||
| 2686 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 2687 | Server Response Hash with no data returned back from the server. | ||||||||||||||||||||||||||||||||||||||||||
| 2688 | |||||||||||||||||||||||||||||||||||||||||||
| 2689 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2690 | $driver->set_implicit_wait_timeout(10); | ||||||||||||||||||||||||||||||||||||||||||
| 2691 | |||||||||||||||||||||||||||||||||||||||||||
| 2692 | =head2 pause | ||||||||||||||||||||||||||||||||||||||||||
| 2693 | |||||||||||||||||||||||||||||||||||||||||||
| 2694 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2695 | Pause execution for a specified interval of milliseconds. | ||||||||||||||||||||||||||||||||||||||||||
| 2696 | |||||||||||||||||||||||||||||||||||||||||||
| 2697 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2698 | $driver->pause(10000); # 10 second delay | ||||||||||||||||||||||||||||||||||||||||||
| 2699 | $driver->pause(); # 1 second delay default | ||||||||||||||||||||||||||||||||||||||||||
| 2700 | |||||||||||||||||||||||||||||||||||||||||||
| 2701 | DEPRECATED: consider using Time::HiRes instead. | ||||||||||||||||||||||||||||||||||||||||||
| 2702 | |||||||||||||||||||||||||||||||||||||||||||
| 2703 | =head2 close | ||||||||||||||||||||||||||||||||||||||||||
| 2704 | |||||||||||||||||||||||||||||||||||||||||||
| 2705 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2706 | Close the current window. | ||||||||||||||||||||||||||||||||||||||||||
| 2707 | |||||||||||||||||||||||||||||||||||||||||||
| 2708 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2709 | $driver->close(); | ||||||||||||||||||||||||||||||||||||||||||
| 2710 | or | ||||||||||||||||||||||||||||||||||||||||||
| 2711 | #close a popup window | ||||||||||||||||||||||||||||||||||||||||||
| 2712 | my $handles = $driver->get_window_handles; | ||||||||||||||||||||||||||||||||||||||||||
| 2713 | $driver->switch_to_window($handles->[1]); | ||||||||||||||||||||||||||||||||||||||||||
| 2714 | $driver->close(); | ||||||||||||||||||||||||||||||||||||||||||
| 2715 | $driver->switch_to_window($handles->[0]); | ||||||||||||||||||||||||||||||||||||||||||
| 2716 | |||||||||||||||||||||||||||||||||||||||||||
| 2717 | =head2 quit | ||||||||||||||||||||||||||||||||||||||||||
| 2718 | |||||||||||||||||||||||||||||||||||||||||||
| 2719 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2720 | DELETE the session, closing open browsers. We will try to call | ||||||||||||||||||||||||||||||||||||||||||
| 2721 | this on our down when we get destroyed, but in the event that we | ||||||||||||||||||||||||||||||||||||||||||
| 2722 | are demolished during global destruction, we will not be able to | ||||||||||||||||||||||||||||||||||||||||||
| 2723 | close the browser. For your own unattended and/or complicated | ||||||||||||||||||||||||||||||||||||||||||
| 2724 | tests, we recommend explicitly calling quit to make sure you're | ||||||||||||||||||||||||||||||||||||||||||
| 2725 | not leaving orphan browsers around. | ||||||||||||||||||||||||||||||||||||||||||
| 2726 | |||||||||||||||||||||||||||||||||||||||||||
| 2727 | Note that as a Moo class, we use a subroutine called DEMOLISH that | ||||||||||||||||||||||||||||||||||||||||||
| 2728 | takes the place of DESTROY; for more information, see | ||||||||||||||||||||||||||||||||||||||||||
| 2729 | https://metacpan.org/pod/Moo#DEMOLISH. | ||||||||||||||||||||||||||||||||||||||||||
| 2730 | |||||||||||||||||||||||||||||||||||||||||||
| 2731 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2732 | $driver->quit(); | ||||||||||||||||||||||||||||||||||||||||||
| 2733 | |||||||||||||||||||||||||||||||||||||||||||
| 2734 | =head2 get_current_window_handle | ||||||||||||||||||||||||||||||||||||||||||
| 2735 | |||||||||||||||||||||||||||||||||||||||||||
| 2736 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2737 | Retrieve the current window handle. | ||||||||||||||||||||||||||||||||||||||||||
| 2738 | |||||||||||||||||||||||||||||||||||||||||||
| 2739 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 2740 | STRING - the window handle | ||||||||||||||||||||||||||||||||||||||||||
| 2741 | |||||||||||||||||||||||||||||||||||||||||||
| 2742 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2743 | print $driver->get_current_window_handle(); | ||||||||||||||||||||||||||||||||||||||||||
| 2744 | |||||||||||||||||||||||||||||||||||||||||||
| 2745 | =head2 get_window_handles | ||||||||||||||||||||||||||||||||||||||||||
| 2746 | |||||||||||||||||||||||||||||||||||||||||||
| 2747 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2748 | Retrieve the list of window handles used in the session. | ||||||||||||||||||||||||||||||||||||||||||
| 2749 | |||||||||||||||||||||||||||||||||||||||||||
| 2750 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 2751 | ARRAY of STRING - list of the window handles | ||||||||||||||||||||||||||||||||||||||||||
| 2752 | |||||||||||||||||||||||||||||||||||||||||||
| 2753 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2754 | print Dumper $driver->get_window_handles; | ||||||||||||||||||||||||||||||||||||||||||
| 2755 | or | ||||||||||||||||||||||||||||||||||||||||||
| 2756 | # get popup, close, then back | ||||||||||||||||||||||||||||||||||||||||||
| 2757 | my $handles = $driver->get_window_handles; | ||||||||||||||||||||||||||||||||||||||||||
| 2758 | $driver->switch_to_window($handles->[1]); | ||||||||||||||||||||||||||||||||||||||||||
| 2759 | $driver->close; | ||||||||||||||||||||||||||||||||||||||||||
| 2760 | $driver->switch_to_window($handles->[0]); | ||||||||||||||||||||||||||||||||||||||||||
| 2761 | |||||||||||||||||||||||||||||||||||||||||||
| 2762 | =head2 get_window_size | ||||||||||||||||||||||||||||||||||||||||||
| 2763 | |||||||||||||||||||||||||||||||||||||||||||
| 2764 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2765 | Retrieve the window size | ||||||||||||||||||||||||||||||||||||||||||
| 2766 | |||||||||||||||||||||||||||||||||||||||||||
| 2767 | Compatibility: | ||||||||||||||||||||||||||||||||||||||||||
| 2768 | The ability to get the size of arbitrary handles by passing input only exists in WebDriver2. | ||||||||||||||||||||||||||||||||||||||||||
| 2769 | You will have to switch to the window first going forward. | ||||||||||||||||||||||||||||||||||||||||||
| 2770 | |||||||||||||||||||||||||||||||||||||||||||
| 2771 | Input: | ||||||||||||||||||||||||||||||||||||||||||
| 2772 | STRING - <optional> - window handle (default is 'current' window) | ||||||||||||||||||||||||||||||||||||||||||
| 2773 | |||||||||||||||||||||||||||||||||||||||||||
| 2774 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 2775 | HASH - containing keys 'height' & 'width' | ||||||||||||||||||||||||||||||||||||||||||
| 2776 | |||||||||||||||||||||||||||||||||||||||||||
| 2777 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2778 | my $window_size = $driver->get_window_size(); | ||||||||||||||||||||||||||||||||||||||||||
| 2779 | print $window_size->{'height'}, $window_size->{'width'}; | ||||||||||||||||||||||||||||||||||||||||||
| 2780 | |||||||||||||||||||||||||||||||||||||||||||
| 2781 | =head2 get_window_position | ||||||||||||||||||||||||||||||||||||||||||
| 2782 | |||||||||||||||||||||||||||||||||||||||||||
| 2783 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2784 | Retrieve the window position | ||||||||||||||||||||||||||||||||||||||||||
| 2785 | |||||||||||||||||||||||||||||||||||||||||||
| 2786 | Compatibility: | ||||||||||||||||||||||||||||||||||||||||||
| 2787 | The ability to get the size of arbitrary handles by passing input only exists in WebDriver2. | ||||||||||||||||||||||||||||||||||||||||||
| 2788 | You will have to switch to the window first going forward. | ||||||||||||||||||||||||||||||||||||||||||
| 2789 | |||||||||||||||||||||||||||||||||||||||||||
| 2790 | Input: | ||||||||||||||||||||||||||||||||||||||||||
| 2791 | STRING - <optional> - window handle (default is 'current' window) | ||||||||||||||||||||||||||||||||||||||||||
| 2792 | |||||||||||||||||||||||||||||||||||||||||||
| 2793 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 2794 | HASH - containing keys 'x' & 'y' | ||||||||||||||||||||||||||||||||||||||||||
| 2795 | |||||||||||||||||||||||||||||||||||||||||||
| 2796 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2797 | my $window_size = $driver->get_window_position(); | ||||||||||||||||||||||||||||||||||||||||||
| 2798 | print $window_size->{'x'}, $window_size->('y'); | ||||||||||||||||||||||||||||||||||||||||||
| 2799 | |||||||||||||||||||||||||||||||||||||||||||
| 2800 | =head2 get_current_url | ||||||||||||||||||||||||||||||||||||||||||
| 2801 | |||||||||||||||||||||||||||||||||||||||||||
| 2802 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2803 | Retrieve the url of the current page | ||||||||||||||||||||||||||||||||||||||||||
| 2804 | |||||||||||||||||||||||||||||||||||||||||||
| 2805 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 2806 | STRING - url | ||||||||||||||||||||||||||||||||||||||||||
| 2807 | |||||||||||||||||||||||||||||||||||||||||||
| 2808 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2809 | print $driver->get_current_url(); | ||||||||||||||||||||||||||||||||||||||||||
| 2810 | |||||||||||||||||||||||||||||||||||||||||||
| 2811 | =head2 navigate | ||||||||||||||||||||||||||||||||||||||||||
| 2812 | |||||||||||||||||||||||||||||||||||||||||||
| 2813 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2814 | Navigate to a given url. This is same as get() method. | ||||||||||||||||||||||||||||||||||||||||||
| 2815 | |||||||||||||||||||||||||||||||||||||||||||
| 2816 | Input: | ||||||||||||||||||||||||||||||||||||||||||
| 2817 | STRING - url | ||||||||||||||||||||||||||||||||||||||||||
| 2818 | |||||||||||||||||||||||||||||||||||||||||||
| 2819 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2820 | $driver->navigate('http://www.google.com'); | ||||||||||||||||||||||||||||||||||||||||||
| 2821 | |||||||||||||||||||||||||||||||||||||||||||
| 2822 | =head2 get | ||||||||||||||||||||||||||||||||||||||||||
| 2823 | |||||||||||||||||||||||||||||||||||||||||||
| 2824 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2825 | Navigate to a given url | ||||||||||||||||||||||||||||||||||||||||||
| 2826 | |||||||||||||||||||||||||||||||||||||||||||
| 2827 | Input: | ||||||||||||||||||||||||||||||||||||||||||
| 2828 | STRING - url | ||||||||||||||||||||||||||||||||||||||||||
| 2829 | |||||||||||||||||||||||||||||||||||||||||||
| 2830 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2831 | $driver->get('http://www.google.com'); | ||||||||||||||||||||||||||||||||||||||||||
| 2832 | |||||||||||||||||||||||||||||||||||||||||||
| 2833 | =head2 get_title | ||||||||||||||||||||||||||||||||||||||||||
| 2834 | |||||||||||||||||||||||||||||||||||||||||||
| 2835 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2836 | Get the current page title | ||||||||||||||||||||||||||||||||||||||||||
| 2837 | |||||||||||||||||||||||||||||||||||||||||||
| 2838 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 2839 | STRING - Page title | ||||||||||||||||||||||||||||||||||||||||||
| 2840 | |||||||||||||||||||||||||||||||||||||||||||
| 2841 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2842 | print $driver->get_title(); | ||||||||||||||||||||||||||||||||||||||||||
| 2843 | |||||||||||||||||||||||||||||||||||||||||||
| 2844 | =head2 go_back | ||||||||||||||||||||||||||||||||||||||||||
| 2845 | |||||||||||||||||||||||||||||||||||||||||||
| 2846 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2847 | Equivalent to hitting the back button on the browser. | ||||||||||||||||||||||||||||||||||||||||||
| 2848 | |||||||||||||||||||||||||||||||||||||||||||
| 2849 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2850 | $driver->go_back(); | ||||||||||||||||||||||||||||||||||||||||||
| 2851 | |||||||||||||||||||||||||||||||||||||||||||
| 2852 | =head2 go_forward | ||||||||||||||||||||||||||||||||||||||||||
| 2853 | |||||||||||||||||||||||||||||||||||||||||||
| 2854 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2855 | Equivalent to hitting the forward button on the browser. | ||||||||||||||||||||||||||||||||||||||||||
| 2856 | |||||||||||||||||||||||||||||||||||||||||||
| 2857 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2858 | $driver->go_forward(); | ||||||||||||||||||||||||||||||||||||||||||
| 2859 | |||||||||||||||||||||||||||||||||||||||||||
| 2860 | =head2 refresh | ||||||||||||||||||||||||||||||||||||||||||
| 2861 | |||||||||||||||||||||||||||||||||||||||||||
| 2862 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2863 | Reload the current page. | ||||||||||||||||||||||||||||||||||||||||||
| 2864 | |||||||||||||||||||||||||||||||||||||||||||
| 2865 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2866 | $driver->refresh(); | ||||||||||||||||||||||||||||||||||||||||||
| 2867 | |||||||||||||||||||||||||||||||||||||||||||
| 2868 | =head2 has_javascript | ||||||||||||||||||||||||||||||||||||||||||
| 2869 | |||||||||||||||||||||||||||||||||||||||||||
| 2870 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2871 | returns true if javascript is enabled in the driver. | ||||||||||||||||||||||||||||||||||||||||||
| 2872 | |||||||||||||||||||||||||||||||||||||||||||
| 2873 | Compatibility: | ||||||||||||||||||||||||||||||||||||||||||
| 2874 | Can't be false on WebDriver 3. | ||||||||||||||||||||||||||||||||||||||||||
| 2875 | |||||||||||||||||||||||||||||||||||||||||||
| 2876 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2877 | if ($driver->has_javascript) { ...; } | ||||||||||||||||||||||||||||||||||||||||||
| 2878 | |||||||||||||||||||||||||||||||||||||||||||
| 2879 | =head2 execute_async_script | ||||||||||||||||||||||||||||||||||||||||||
| 2880 | |||||||||||||||||||||||||||||||||||||||||||
| 2881 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2882 | Inject a snippet of JavaScript into the page for execution in the context | ||||||||||||||||||||||||||||||||||||||||||
| 2883 | of the currently selected frame. The executed script is assumed to be | ||||||||||||||||||||||||||||||||||||||||||
| 2884 | asynchronous and must signal that is done by invoking the provided | ||||||||||||||||||||||||||||||||||||||||||
| 2885 | callback, which is always provided as the final argument to the function. | ||||||||||||||||||||||||||||||||||||||||||
| 2886 | The value to this callback will be returned to the client. | ||||||||||||||||||||||||||||||||||||||||||
| 2887 | |||||||||||||||||||||||||||||||||||||||||||
| 2888 | Asynchronous script commands may not span page loads. If an unload event | ||||||||||||||||||||||||||||||||||||||||||
| 2889 | is fired while waiting for a script result, an error should be returned | ||||||||||||||||||||||||||||||||||||||||||
| 2890 | to the client. | ||||||||||||||||||||||||||||||||||||||||||
| 2891 | |||||||||||||||||||||||||||||||||||||||||||
| 2892 | Input: 2 (1 optional) | ||||||||||||||||||||||||||||||||||||||||||
| 2893 | Required: | ||||||||||||||||||||||||||||||||||||||||||
| 2894 | STRING - Javascript to execute on the page | ||||||||||||||||||||||||||||||||||||||||||
| 2895 | Optional: | ||||||||||||||||||||||||||||||||||||||||||
| 2896 | ARRAY - list of arguments that need to be passed to the script. | ||||||||||||||||||||||||||||||||||||||||||
| 2897 | |||||||||||||||||||||||||||||||||||||||||||
| 2898 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 2899 | {*} - Varied, depending on the type of result expected back from the script. | ||||||||||||||||||||||||||||||||||||||||||
| 2900 | |||||||||||||||||||||||||||||||||||||||||||
| 2901 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2902 | my $script = q{ | ||||||||||||||||||||||||||||||||||||||||||
| 2903 | var arg1 = arguments[0]; | ||||||||||||||||||||||||||||||||||||||||||
| 2904 | var callback = arguments[arguments.length-1]; | ||||||||||||||||||||||||||||||||||||||||||
| 2905 | var elem = window.document.findElementById(arg1); | ||||||||||||||||||||||||||||||||||||||||||
| 2906 | callback(elem); | ||||||||||||||||||||||||||||||||||||||||||
| 2907 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 2908 | my $elem = $driver->execute_async_script($script,'myid'); | ||||||||||||||||||||||||||||||||||||||||||
| 2909 | $elem->click; | ||||||||||||||||||||||||||||||||||||||||||
| 2910 | |||||||||||||||||||||||||||||||||||||||||||
| 2911 | =head2 execute_script | ||||||||||||||||||||||||||||||||||||||||||
| 2912 | |||||||||||||||||||||||||||||||||||||||||||
| 2913 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2914 | Inject a snippet of JavaScript into the page and return its result. | ||||||||||||||||||||||||||||||||||||||||||
| 2915 | WebElements that should be passed to the script as an argument should be | ||||||||||||||||||||||||||||||||||||||||||
| 2916 | specified in the arguments array as WebElement object. Likewise, | ||||||||||||||||||||||||||||||||||||||||||
| 2917 | any WebElements in the script result will be returned as WebElement object. | ||||||||||||||||||||||||||||||||||||||||||
| 2918 | |||||||||||||||||||||||||||||||||||||||||||
| 2919 | Input: 2 (1 optional) | ||||||||||||||||||||||||||||||||||||||||||
| 2920 | Required: | ||||||||||||||||||||||||||||||||||||||||||
| 2921 | STRING - Javascript to execute on the page | ||||||||||||||||||||||||||||||||||||||||||
| 2922 | Optional: | ||||||||||||||||||||||||||||||||||||||||||
| 2923 | ARRAY - list of arguments that need to be passed to the script. | ||||||||||||||||||||||||||||||||||||||||||
| 2924 | |||||||||||||||||||||||||||||||||||||||||||
| 2925 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 2926 | {*} - Varied, depending on the type of result expected back from the script. | ||||||||||||||||||||||||||||||||||||||||||
| 2927 | |||||||||||||||||||||||||||||||||||||||||||
| 2928 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2929 | my $script = q{ | ||||||||||||||||||||||||||||||||||||||||||
| 2930 | var arg1 = arguments[0]; | ||||||||||||||||||||||||||||||||||||||||||
| 2931 | var elem = window.document.findElementById(arg1); | ||||||||||||||||||||||||||||||||||||||||||
| 2932 | return elem; | ||||||||||||||||||||||||||||||||||||||||||
| 2933 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 2934 | my $elem = $driver->execute_script($script,'myid'); | ||||||||||||||||||||||||||||||||||||||||||
| 2935 | $elem->click; | ||||||||||||||||||||||||||||||||||||||||||
| 2936 | |||||||||||||||||||||||||||||||||||||||||||
| 2937 | =head2 screenshot | ||||||||||||||||||||||||||||||||||||||||||
| 2938 | |||||||||||||||||||||||||||||||||||||||||||
| 2939 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2940 | Get a screenshot of the current page as a base64 encoded image. | ||||||||||||||||||||||||||||||||||||||||||
| 2941 | Optionally pass {'full' => 1} as argument to take a full screenshot and not | ||||||||||||||||||||||||||||||||||||||||||
| 2942 | only the viewport. (Works only with firefox and geckodriver >= 0.24.0) | ||||||||||||||||||||||||||||||||||||||||||
| 2943 | |||||||||||||||||||||||||||||||||||||||||||
| 2944 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 2945 | STRING - base64 encoded image | ||||||||||||||||||||||||||||||||||||||||||
| 2946 | |||||||||||||||||||||||||||||||||||||||||||
| 2947 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2948 | print $driver->screenshot(); | ||||||||||||||||||||||||||||||||||||||||||
| 2949 | print $driver->screenshot({'full' => 1}); | ||||||||||||||||||||||||||||||||||||||||||
| 2950 | |||||||||||||||||||||||||||||||||||||||||||
| 2951 | To conveniently write the screenshot to a file, see L</capture_screenshot>. | ||||||||||||||||||||||||||||||||||||||||||
| 2952 | |||||||||||||||||||||||||||||||||||||||||||
| 2953 | =head2 capture_screenshot | ||||||||||||||||||||||||||||||||||||||||||
| 2954 | |||||||||||||||||||||||||||||||||||||||||||
| 2955 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2956 | Capture a screenshot and save as a PNG to provided file name. | ||||||||||||||||||||||||||||||||||||||||||
| 2957 | (The method is compatible with the WWW::Selenium method of the same name) | ||||||||||||||||||||||||||||||||||||||||||
| 2958 | Optionally pass {'full' => 1} as second argument to take a full screenshot | ||||||||||||||||||||||||||||||||||||||||||
| 2959 | and not only the viewport. (Works only with firefox and geckodriver >= 0.24.0) | ||||||||||||||||||||||||||||||||||||||||||
| 2960 | |||||||||||||||||||||||||||||||||||||||||||
| 2961 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 2962 | TRUE - (Screenshot is written to file) | ||||||||||||||||||||||||||||||||||||||||||
| 2963 | |||||||||||||||||||||||||||||||||||||||||||
| 2964 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2965 | $driver->capture_screenshot($filename); | ||||||||||||||||||||||||||||||||||||||||||
| 2966 | $driver->capture_screenshot($filename, {'full' => 1}); | ||||||||||||||||||||||||||||||||||||||||||
| 2967 | |||||||||||||||||||||||||||||||||||||||||||
| 2968 | =head2 available_engines | ||||||||||||||||||||||||||||||||||||||||||
| 2969 | |||||||||||||||||||||||||||||||||||||||||||
| 2970 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2971 | List all available engines on the machine. To use an engine, it has to be present in this list. | ||||||||||||||||||||||||||||||||||||||||||
| 2972 | |||||||||||||||||||||||||||||||||||||||||||
| 2973 | Compatibility: | ||||||||||||||||||||||||||||||||||||||||||
| 2974 | Does not appear to be available on Webdriver3 enabled selenium servers. | ||||||||||||||||||||||||||||||||||||||||||
| 2975 | |||||||||||||||||||||||||||||||||||||||||||
| 2976 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 2977 | {Array.<string>} A list of available engines | ||||||||||||||||||||||||||||||||||||||||||
| 2978 | |||||||||||||||||||||||||||||||||||||||||||
| 2979 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2980 | print Dumper $driver->available_engines; | ||||||||||||||||||||||||||||||||||||||||||
| 2981 | |||||||||||||||||||||||||||||||||||||||||||
| 2982 | =head2 switch_to_frame | ||||||||||||||||||||||||||||||||||||||||||
| 2983 | |||||||||||||||||||||||||||||||||||||||||||
| 2984 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 2985 | Change focus to another frame on the page. If the frame ID is null, the | ||||||||||||||||||||||||||||||||||||||||||
| 2986 | server will switch to the page's default content. You can also switch to a | ||||||||||||||||||||||||||||||||||||||||||
| 2987 | WebElement, for e.g. you can find an iframe using find_element & then | ||||||||||||||||||||||||||||||||||||||||||
| 2988 | provide that as an input to this method. Also see e.g. | ||||||||||||||||||||||||||||||||||||||||||
| 2989 | |||||||||||||||||||||||||||||||||||||||||||
| 2990 | Input: 1 | ||||||||||||||||||||||||||||||||||||||||||
| 2991 | Required: | ||||||||||||||||||||||||||||||||||||||||||
| 2992 | {STRING | NUMBER | NULL | WebElement} - ID of the frame which can be one of the three | ||||||||||||||||||||||||||||||||||||||||||
| 2993 | mentioned. | ||||||||||||||||||||||||||||||||||||||||||
| 2994 | |||||||||||||||||||||||||||||||||||||||||||
| 2995 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 2996 | $driver->switch_to_frame('frame_1'); | ||||||||||||||||||||||||||||||||||||||||||
| 2997 | or | ||||||||||||||||||||||||||||||||||||||||||
| 2998 | $driver->switch_to_frame($driver->find_element('iframe', 'tag_name')); | ||||||||||||||||||||||||||||||||||||||||||
| 2999 | |||||||||||||||||||||||||||||||||||||||||||
| 3000 | =head3 COMPATIBILITY | ||||||||||||||||||||||||||||||||||||||||||
| 3001 | |||||||||||||||||||||||||||||||||||||||||||
| 3002 | Chromedriver will vomit if you pass anything but a webElement, so you probably should do that from now on. | ||||||||||||||||||||||||||||||||||||||||||
| 3003 | |||||||||||||||||||||||||||||||||||||||||||
| 3004 | =head2 switch_to_parent_frame | ||||||||||||||||||||||||||||||||||||||||||
| 3005 | |||||||||||||||||||||||||||||||||||||||||||
| 3006 | Webdriver 3 equivalent of calling switch_to_frame with no arguments (e.g. NULL frame). | ||||||||||||||||||||||||||||||||||||||||||
| 3007 | This is actually called in that case, supposing you are using WD3 capable servers now. | ||||||||||||||||||||||||||||||||||||||||||
| 3008 | |||||||||||||||||||||||||||||||||||||||||||
| 3009 | =head2 switch_to_window | ||||||||||||||||||||||||||||||||||||||||||
| 3010 | |||||||||||||||||||||||||||||||||||||||||||
| 3011 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3012 | Change focus to another window. The window to change focus to may | ||||||||||||||||||||||||||||||||||||||||||
| 3013 | be specified by its server assigned window handle, or by the value | ||||||||||||||||||||||||||||||||||||||||||
| 3014 | of the page's window.name attribute. | ||||||||||||||||||||||||||||||||||||||||||
| 3015 | |||||||||||||||||||||||||||||||||||||||||||
| 3016 | If you wish to use the window name as the target, you'll need to | ||||||||||||||||||||||||||||||||||||||||||
| 3017 | have set C<window.name> on the page either in app code or via | ||||||||||||||||||||||||||||||||||||||||||
| 3018 | L</execute_script>, or pass a name as the second argument to the | ||||||||||||||||||||||||||||||||||||||||||
| 3019 | C<window.open()> function when opening the new window. Note that | ||||||||||||||||||||||||||||||||||||||||||
| 3020 | the window name used here has nothing to do with the window title, | ||||||||||||||||||||||||||||||||||||||||||
| 3021 | or the C<< <title> >> element on the page. | ||||||||||||||||||||||||||||||||||||||||||
| 3022 | |||||||||||||||||||||||||||||||||||||||||||
| 3023 | Otherwise, use L</get_window_handles> and select a | ||||||||||||||||||||||||||||||||||||||||||
| 3024 | Webdriver-generated handle from the output of that function. | ||||||||||||||||||||||||||||||||||||||||||
| 3025 | |||||||||||||||||||||||||||||||||||||||||||
| 3026 | Input: 1 | ||||||||||||||||||||||||||||||||||||||||||
| 3027 | Required: | ||||||||||||||||||||||||||||||||||||||||||
| 3028 | STRING - Window handle or the Window name | ||||||||||||||||||||||||||||||||||||||||||
| 3029 | |||||||||||||||||||||||||||||||||||||||||||
| 3030 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3031 | $driver->switch_to_window('MY Homepage'); | ||||||||||||||||||||||||||||||||||||||||||
| 3032 | or | ||||||||||||||||||||||||||||||||||||||||||
| 3033 | # close a popup window and switch back | ||||||||||||||||||||||||||||||||||||||||||
| 3034 | my $handles = $driver->get_window_handles; | ||||||||||||||||||||||||||||||||||||||||||
| 3035 | $driver->switch_to_window($handles->[1]); | ||||||||||||||||||||||||||||||||||||||||||
| 3036 | $driver->close; | ||||||||||||||||||||||||||||||||||||||||||
| 3037 | $driver->switch_to_window($handles->[0]); | ||||||||||||||||||||||||||||||||||||||||||
| 3038 | |||||||||||||||||||||||||||||||||||||||||||
| 3039 | =head2 set_window_position | ||||||||||||||||||||||||||||||||||||||||||
| 3040 | |||||||||||||||||||||||||||||||||||||||||||
| 3041 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3042 | Set the position (on screen) where you want your browser to be displayed. | ||||||||||||||||||||||||||||||||||||||||||
| 3043 | |||||||||||||||||||||||||||||||||||||||||||
| 3044 | Compatibility: | ||||||||||||||||||||||||||||||||||||||||||
| 3045 | In webDriver 3 enabled selenium servers, you may only operate on the focused window. | ||||||||||||||||||||||||||||||||||||||||||
| 3046 | As such, the window handle argument below will be ignored in this context. | ||||||||||||||||||||||||||||||||||||||||||
| 3047 | |||||||||||||||||||||||||||||||||||||||||||
| 3048 | Input: | ||||||||||||||||||||||||||||||||||||||||||
| 3049 | INT - x co-ordinate | ||||||||||||||||||||||||||||||||||||||||||
| 3050 | INT - y co-ordinate | ||||||||||||||||||||||||||||||||||||||||||
| 3051 | STRING - <optional> - window handle (default is 'current' window) | ||||||||||||||||||||||||||||||||||||||||||
| 3052 | |||||||||||||||||||||||||||||||||||||||||||
| 3053 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 3054 | BOOLEAN - Success or failure | ||||||||||||||||||||||||||||||||||||||||||
| 3055 | |||||||||||||||||||||||||||||||||||||||||||
| 3056 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3057 | $driver->set_window_position(50, 50); | ||||||||||||||||||||||||||||||||||||||||||
| 3058 | |||||||||||||||||||||||||||||||||||||||||||
| 3059 | =head2 set_window_size | ||||||||||||||||||||||||||||||||||||||||||
| 3060 | |||||||||||||||||||||||||||||||||||||||||||
| 3061 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3062 | Set the size of the browser window | ||||||||||||||||||||||||||||||||||||||||||
| 3063 | |||||||||||||||||||||||||||||||||||||||||||
| 3064 | Compatibility: | ||||||||||||||||||||||||||||||||||||||||||
| 3065 | In webDriver 3 enabled selenium servers, you may only operate on the focused window. | ||||||||||||||||||||||||||||||||||||||||||
| 3066 | As such, the window handle argument below will be ignored in this context. | ||||||||||||||||||||||||||||||||||||||||||
| 3067 | |||||||||||||||||||||||||||||||||||||||||||
| 3068 | Input: | ||||||||||||||||||||||||||||||||||||||||||
| 3069 | INT - height of the window | ||||||||||||||||||||||||||||||||||||||||||
| 3070 | INT - width of the window | ||||||||||||||||||||||||||||||||||||||||||
| 3071 | STRING - <optional> - window handle (default is 'current' window) | ||||||||||||||||||||||||||||||||||||||||||
| 3072 | |||||||||||||||||||||||||||||||||||||||||||
| 3073 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 3074 | BOOLEAN - Success or failure | ||||||||||||||||||||||||||||||||||||||||||
| 3075 | |||||||||||||||||||||||||||||||||||||||||||
| 3076 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3077 | $driver->set_window_size(640, 480); | ||||||||||||||||||||||||||||||||||||||||||
| 3078 | |||||||||||||||||||||||||||||||||||||||||||
| 3079 | =head2 maximize_window | ||||||||||||||||||||||||||||||||||||||||||
| 3080 | |||||||||||||||||||||||||||||||||||||||||||
| 3081 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3082 | Maximizes the browser window | ||||||||||||||||||||||||||||||||||||||||||
| 3083 | |||||||||||||||||||||||||||||||||||||||||||
| 3084 | Compatibility: | ||||||||||||||||||||||||||||||||||||||||||
| 3085 | In webDriver 3 enabled selenium servers, you may only operate on the focused window. | ||||||||||||||||||||||||||||||||||||||||||
| 3086 | As such, the window handle argument below will be ignored in this context. | ||||||||||||||||||||||||||||||||||||||||||
| 3087 | |||||||||||||||||||||||||||||||||||||||||||
| 3088 | Also, on chromedriver maximize is actually just setting the window size to the screen's | ||||||||||||||||||||||||||||||||||||||||||
| 3089 | available height and width. | ||||||||||||||||||||||||||||||||||||||||||
| 3090 | |||||||||||||||||||||||||||||||||||||||||||
| 3091 | Input: | ||||||||||||||||||||||||||||||||||||||||||
| 3092 | STRING - <optional> - window handle (default is 'current' window) | ||||||||||||||||||||||||||||||||||||||||||
| 3093 | |||||||||||||||||||||||||||||||||||||||||||
| 3094 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 3095 | BOOLEAN - Success or failure | ||||||||||||||||||||||||||||||||||||||||||
| 3096 | |||||||||||||||||||||||||||||||||||||||||||
| 3097 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3098 | $driver->maximize_window(); | ||||||||||||||||||||||||||||||||||||||||||
| 3099 | |||||||||||||||||||||||||||||||||||||||||||
| 3100 | =head2 minimize_window | ||||||||||||||||||||||||||||||||||||||||||
| 3101 | |||||||||||||||||||||||||||||||||||||||||||
| 3102 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3103 | Minimizes the currently focused browser window (webdriver3 only) | ||||||||||||||||||||||||||||||||||||||||||
| 3104 | |||||||||||||||||||||||||||||||||||||||||||
| 3105 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 3106 | BOOLEAN - Success or failure | ||||||||||||||||||||||||||||||||||||||||||
| 3107 | |||||||||||||||||||||||||||||||||||||||||||
| 3108 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3109 | $driver->minimize_window(); | ||||||||||||||||||||||||||||||||||||||||||
| 3110 | |||||||||||||||||||||||||||||||||||||||||||
| 3111 | =head2 fullscreen_window | ||||||||||||||||||||||||||||||||||||||||||
| 3112 | |||||||||||||||||||||||||||||||||||||||||||
| 3113 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3114 | Fullscreens the currently focused browser window (webdriver3 only) | ||||||||||||||||||||||||||||||||||||||||||
| 3115 | |||||||||||||||||||||||||||||||||||||||||||
| 3116 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 3117 | BOOLEAN - Success or failure | ||||||||||||||||||||||||||||||||||||||||||
| 3118 | |||||||||||||||||||||||||||||||||||||||||||
| 3119 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3120 | $driver->fullscreen_window(); | ||||||||||||||||||||||||||||||||||||||||||
| 3121 | |||||||||||||||||||||||||||||||||||||||||||
| 3122 | =head2 get_all_cookies | ||||||||||||||||||||||||||||||||||||||||||
| 3123 | |||||||||||||||||||||||||||||||||||||||||||
| 3124 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3125 | Retrieve all cookies visible to the current page. Each cookie will be | ||||||||||||||||||||||||||||||||||||||||||
| 3126 | returned as a HASH reference with the following keys & their value types: | ||||||||||||||||||||||||||||||||||||||||||
| 3127 | |||||||||||||||||||||||||||||||||||||||||||
| 3128 | 'name' - STRING | ||||||||||||||||||||||||||||||||||||||||||
| 3129 | 'value' - STRING | ||||||||||||||||||||||||||||||||||||||||||
| 3130 | 'path' - STRING | ||||||||||||||||||||||||||||||||||||||||||
| 3131 | 'domain' - STRING | ||||||||||||||||||||||||||||||||||||||||||
| 3132 | 'secure' - BOOLEAN | ||||||||||||||||||||||||||||||||||||||||||
| 3133 | |||||||||||||||||||||||||||||||||||||||||||
| 3134 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 3135 | ARRAY of HASHES - list of all the cookie hashes | ||||||||||||||||||||||||||||||||||||||||||
| 3136 | |||||||||||||||||||||||||||||||||||||||||||
| 3137 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3138 | print Dumper($driver->get_all_cookies()); | ||||||||||||||||||||||||||||||||||||||||||
| 3139 | |||||||||||||||||||||||||||||||||||||||||||
| 3140 | =head2 add_cookie | ||||||||||||||||||||||||||||||||||||||||||
| 3141 | |||||||||||||||||||||||||||||||||||||||||||
| 3142 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3143 | Set a cookie on the domain. | ||||||||||||||||||||||||||||||||||||||||||
| 3144 | |||||||||||||||||||||||||||||||||||||||||||
| 3145 | Input: 2 (4 optional) | ||||||||||||||||||||||||||||||||||||||||||
| 3146 | Required: | ||||||||||||||||||||||||||||||||||||||||||
| 3147 | 'name' - STRING | ||||||||||||||||||||||||||||||||||||||||||
| 3148 | 'value' - STRING | ||||||||||||||||||||||||||||||||||||||||||
| 3149 | |||||||||||||||||||||||||||||||||||||||||||
| 3150 | Optional: | ||||||||||||||||||||||||||||||||||||||||||
| 3151 | 'path' - STRING | ||||||||||||||||||||||||||||||||||||||||||
| 3152 | 'domain' - STRING | ||||||||||||||||||||||||||||||||||||||||||
| 3153 | 'secure' - BOOLEAN - default false. | ||||||||||||||||||||||||||||||||||||||||||
| 3154 | 'httponly' - BOOLEAN - default false. | ||||||||||||||||||||||||||||||||||||||||||
| 3155 | 'expiry' - TIME_T - default 20 years in the future | ||||||||||||||||||||||||||||||||||||||||||
| 3156 | |||||||||||||||||||||||||||||||||||||||||||
| 3157 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3158 | $driver->add_cookie('foo', 'bar', '/', '.google.com', 0, 1) | ||||||||||||||||||||||||||||||||||||||||||
| 3159 | |||||||||||||||||||||||||||||||||||||||||||
| 3160 | =head2 delete_all_cookies | ||||||||||||||||||||||||||||||||||||||||||
| 3161 | |||||||||||||||||||||||||||||||||||||||||||
| 3162 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3163 | Delete all cookies visible to the current page. | ||||||||||||||||||||||||||||||||||||||||||
| 3164 | |||||||||||||||||||||||||||||||||||||||||||
| 3165 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3166 | $driver->delete_all_cookies(); | ||||||||||||||||||||||||||||||||||||||||||
| 3167 | |||||||||||||||||||||||||||||||||||||||||||
| 3168 | =head2 get_cookie_named | ||||||||||||||||||||||||||||||||||||||||||
| 3169 | |||||||||||||||||||||||||||||||||||||||||||
| 3170 | Basically get only the cookie with the provided name. | ||||||||||||||||||||||||||||||||||||||||||
| 3171 | Probably preferable to pick it out of the list unless you expect a *really* long list. | ||||||||||||||||||||||||||||||||||||||||||
| 3172 | |||||||||||||||||||||||||||||||||||||||||||
| 3173 | Input: | ||||||||||||||||||||||||||||||||||||||||||
| 3174 | Cookie Name - STRING | ||||||||||||||||||||||||||||||||||||||||||
| 3175 | |||||||||||||||||||||||||||||||||||||||||||
| 3176 | Returns cookie definition hash, much like the elements in get_all_cookies(); | ||||||||||||||||||||||||||||||||||||||||||
| 3177 | |||||||||||||||||||||||||||||||||||||||||||
| 3178 | Compatibility: | ||||||||||||||||||||||||||||||||||||||||||
| 3179 | Only available on webdriver3 enabled selenium servers. | ||||||||||||||||||||||||||||||||||||||||||
| 3180 | |||||||||||||||||||||||||||||||||||||||||||
| 3181 | =head2 delete_cookie_named | ||||||||||||||||||||||||||||||||||||||||||
| 3182 | |||||||||||||||||||||||||||||||||||||||||||
| 3183 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3184 | Delete the cookie with the given name. This command will be a no-op if there | ||||||||||||||||||||||||||||||||||||||||||
| 3185 | is no such cookie visible to the current page. | ||||||||||||||||||||||||||||||||||||||||||
| 3186 | |||||||||||||||||||||||||||||||||||||||||||
| 3187 | Input: 1 | ||||||||||||||||||||||||||||||||||||||||||
| 3188 | Required: | ||||||||||||||||||||||||||||||||||||||||||
| 3189 | STRING - name of cookie to delete | ||||||||||||||||||||||||||||||||||||||||||
| 3190 | |||||||||||||||||||||||||||||||||||||||||||
| 3191 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3192 | $driver->delete_cookie_named('foo'); | ||||||||||||||||||||||||||||||||||||||||||
| 3193 | |||||||||||||||||||||||||||||||||||||||||||
| 3194 | =head2 get_page_source | ||||||||||||||||||||||||||||||||||||||||||
| 3195 | |||||||||||||||||||||||||||||||||||||||||||
| 3196 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3197 | Get the current page source. | ||||||||||||||||||||||||||||||||||||||||||
| 3198 | |||||||||||||||||||||||||||||||||||||||||||
| 3199 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 3200 | STRING - The page source. | ||||||||||||||||||||||||||||||||||||||||||
| 3201 | |||||||||||||||||||||||||||||||||||||||||||
| 3202 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3203 | print $driver->get_page_source(); | ||||||||||||||||||||||||||||||||||||||||||
| 3204 | |||||||||||||||||||||||||||||||||||||||||||
| 3205 | =head2 find_element | ||||||||||||||||||||||||||||||||||||||||||
| 3206 | |||||||||||||||||||||||||||||||||||||||||||
| 3207 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3208 | Search for an element on the page, starting from the document | ||||||||||||||||||||||||||||||||||||||||||
| 3209 | root. The located element will be returned as a WebElement | ||||||||||||||||||||||||||||||||||||||||||
| 3210 | object. If the element cannot be found, we will CROAK, killing | ||||||||||||||||||||||||||||||||||||||||||
| 3211 | your script. If you wish for a warning instead, use the | ||||||||||||||||||||||||||||||||||||||||||
| 3212 | parameterized version of the finders: | ||||||||||||||||||||||||||||||||||||||||||
| 3213 | |||||||||||||||||||||||||||||||||||||||||||
| 3214 | find_element_by_class | ||||||||||||||||||||||||||||||||||||||||||
| 3215 | find_element_by_class_name | ||||||||||||||||||||||||||||||||||||||||||
| 3216 | find_element_by_css | ||||||||||||||||||||||||||||||||||||||||||
| 3217 | find_element_by_id | ||||||||||||||||||||||||||||||||||||||||||
| 3218 | find_element_by_link | ||||||||||||||||||||||||||||||||||||||||||
| 3219 | find_element_by_link_text | ||||||||||||||||||||||||||||||||||||||||||
| 3220 | find_element_by_name | ||||||||||||||||||||||||||||||||||||||||||
| 3221 | find_element_by_partial_link_text | ||||||||||||||||||||||||||||||||||||||||||
| 3222 | find_element_by_tag_name | ||||||||||||||||||||||||||||||||||||||||||
| 3223 | find_element_by_xpath | ||||||||||||||||||||||||||||||||||||||||||
| 3224 | |||||||||||||||||||||||||||||||||||||||||||
| 3225 | These functions all take a single STRING argument: the locator | ||||||||||||||||||||||||||||||||||||||||||
| 3226 | search target of the element you want. If the element is found, we | ||||||||||||||||||||||||||||||||||||||||||
| 3227 | will receive a WebElement. Otherwise, we will return 0. Note that | ||||||||||||||||||||||||||||||||||||||||||
| 3228 | invoking methods on 0 will of course kill your script. | ||||||||||||||||||||||||||||||||||||||||||
| 3229 | |||||||||||||||||||||||||||||||||||||||||||
| 3230 | Input: 2 (1 optional) | ||||||||||||||||||||||||||||||||||||||||||
| 3231 | Required: | ||||||||||||||||||||||||||||||||||||||||||
| 3232 | STRING - The search target. | ||||||||||||||||||||||||||||||||||||||||||
| 3233 | Optional: | ||||||||||||||||||||||||||||||||||||||||||
| 3234 | STRING - Locator scheme to use to search the element, available schemes: | ||||||||||||||||||||||||||||||||||||||||||
| 3235 | {class, class_name, css, id, link, link_text, partial_link_text, | ||||||||||||||||||||||||||||||||||||||||||
| 3236 | tag_name, name, xpath} | ||||||||||||||||||||||||||||||||||||||||||
| 3237 | Defaults to 'xpath' if not configured global during instantiation. | ||||||||||||||||||||||||||||||||||||||||||
| 3238 | |||||||||||||||||||||||||||||||||||||||||||
| 3239 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 3240 | Selenium::Remote::WebElement - WebElement Object | ||||||||||||||||||||||||||||||||||||||||||
| 3241 | (This could be a subclass of L<Selenium::Remote::WebElement> if C<webelement_class> was set. | ||||||||||||||||||||||||||||||||||||||||||
| 3242 | |||||||||||||||||||||||||||||||||||||||||||
| 3243 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3244 | $driver->find_element("//input[\@name='q']"); | ||||||||||||||||||||||||||||||||||||||||||
| 3245 | |||||||||||||||||||||||||||||||||||||||||||
| 3246 | =head2 find_elements | ||||||||||||||||||||||||||||||||||||||||||
| 3247 | |||||||||||||||||||||||||||||||||||||||||||
| 3248 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3249 | Search for multiple elements on the page, starting from the document root. | ||||||||||||||||||||||||||||||||||||||||||
| 3250 | The located elements will be returned as an array of WebElement object. | ||||||||||||||||||||||||||||||||||||||||||
| 3251 | |||||||||||||||||||||||||||||||||||||||||||
| 3252 | Input: 2 (1 optional) | ||||||||||||||||||||||||||||||||||||||||||
| 3253 | Required: | ||||||||||||||||||||||||||||||||||||||||||
| 3254 | STRING - The search target. | ||||||||||||||||||||||||||||||||||||||||||
| 3255 | Optional: | ||||||||||||||||||||||||||||||||||||||||||
| 3256 | STRING - Locator scheme to use to search the element, available schemes: | ||||||||||||||||||||||||||||||||||||||||||
| 3257 | {class, class_name, css, id, link, link_text, partial_link_text, | ||||||||||||||||||||||||||||||||||||||||||
| 3258 | tag_name, name, xpath} | ||||||||||||||||||||||||||||||||||||||||||
| 3259 | Defaults to 'xpath' if not configured global during instantiation. | ||||||||||||||||||||||||||||||||||||||||||
| 3260 | |||||||||||||||||||||||||||||||||||||||||||
| 3261 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 3262 | ARRAY or ARRAYREF of WebElement Objects | ||||||||||||||||||||||||||||||||||||||||||
| 3263 | |||||||||||||||||||||||||||||||||||||||||||
| 3264 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3265 | $driver->find_elements("//input"); | ||||||||||||||||||||||||||||||||||||||||||
| 3266 | |||||||||||||||||||||||||||||||||||||||||||
| 3267 | =head2 find_child_element | ||||||||||||||||||||||||||||||||||||||||||
| 3268 | |||||||||||||||||||||||||||||||||||||||||||
| 3269 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3270 | Search for an element on the page, starting from the identified element. The | ||||||||||||||||||||||||||||||||||||||||||
| 3271 | located element will be returned as a WebElement object. | ||||||||||||||||||||||||||||||||||||||||||
| 3272 | |||||||||||||||||||||||||||||||||||||||||||
| 3273 | Input: 3 (1 optional) | ||||||||||||||||||||||||||||||||||||||||||
| 3274 | Required: | ||||||||||||||||||||||||||||||||||||||||||
| 3275 | Selenium::Remote::WebElement - WebElement object from where you want to | ||||||||||||||||||||||||||||||||||||||||||
| 3276 | start searching. | ||||||||||||||||||||||||||||||||||||||||||
| 3277 | STRING - The search target. (Do not use a double whack('//') | ||||||||||||||||||||||||||||||||||||||||||
| 3278 | in an xpath to search for a child element | ||||||||||||||||||||||||||||||||||||||||||
| 3279 | ex: '//option[@id="something"]' | ||||||||||||||||||||||||||||||||||||||||||
| 3280 | instead use a dot whack ('./') | ||||||||||||||||||||||||||||||||||||||||||
| 3281 | ex: './option[@id="something"]') | ||||||||||||||||||||||||||||||||||||||||||
| 3282 | Optional: | ||||||||||||||||||||||||||||||||||||||||||
| 3283 | STRING - Locator scheme to use to search the element, available schemes: | ||||||||||||||||||||||||||||||||||||||||||
| 3284 | {class, class_name, css, id, link, link_text, partial_link_text, | ||||||||||||||||||||||||||||||||||||||||||
| 3285 | tag_name, name, xpath} | ||||||||||||||||||||||||||||||||||||||||||
| 3286 | Defaults to 'xpath' if not configured global during instantiation. | ||||||||||||||||||||||||||||||||||||||||||
| 3287 | |||||||||||||||||||||||||||||||||||||||||||
| 3288 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 3289 | WebElement Object | ||||||||||||||||||||||||||||||||||||||||||
| 3290 | |||||||||||||||||||||||||||||||||||||||||||
| 3291 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3292 | my $elem1 = $driver->find_element("//select[\@name='ned']"); | ||||||||||||||||||||||||||||||||||||||||||
| 3293 | # note the usage of ./ when searching for a child element instead of // | ||||||||||||||||||||||||||||||||||||||||||
| 3294 | my $child = $driver->find_child_element($elem1, "./option[\@value='es_ar']"); | ||||||||||||||||||||||||||||||||||||||||||
| 3295 | |||||||||||||||||||||||||||||||||||||||||||
| 3296 | =head2 find_child_elements | ||||||||||||||||||||||||||||||||||||||||||
| 3297 | |||||||||||||||||||||||||||||||||||||||||||
| 3298 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3299 | Search for multiple element on the page, starting from the identified | ||||||||||||||||||||||||||||||||||||||||||
| 3300 | element. The located elements will be returned as an array of WebElement | ||||||||||||||||||||||||||||||||||||||||||
| 3301 | objects. | ||||||||||||||||||||||||||||||||||||||||||
| 3302 | |||||||||||||||||||||||||||||||||||||||||||
| 3303 | Input: 3 (1 optional) | ||||||||||||||||||||||||||||||||||||||||||
| 3304 | Required: | ||||||||||||||||||||||||||||||||||||||||||
| 3305 | Selenium::Remote::WebElement - WebElement object from where you want to | ||||||||||||||||||||||||||||||||||||||||||
| 3306 | start searching. | ||||||||||||||||||||||||||||||||||||||||||
| 3307 | STRING - The search target. | ||||||||||||||||||||||||||||||||||||||||||
| 3308 | Optional: | ||||||||||||||||||||||||||||||||||||||||||
| 3309 | STRING - Locator scheme to use to search the element, available schemes: | ||||||||||||||||||||||||||||||||||||||||||
| 3310 | {class, class_name, css, id, link, link_text, partial_link_text, | ||||||||||||||||||||||||||||||||||||||||||
| 3311 | tag_name, name, xpath} | ||||||||||||||||||||||||||||||||||||||||||
| 3312 | Defaults to 'xpath' if not configured global during instantiation. | ||||||||||||||||||||||||||||||||||||||||||
| 3313 | |||||||||||||||||||||||||||||||||||||||||||
| 3314 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 3315 | ARRAY of WebElement Objects. | ||||||||||||||||||||||||||||||||||||||||||
| 3316 | |||||||||||||||||||||||||||||||||||||||||||
| 3317 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3318 | my $elem1 = $driver->find_element("//select[\@name='ned']"); | ||||||||||||||||||||||||||||||||||||||||||
| 3319 | # note the usage of ./ when searching for a child element instead of // | ||||||||||||||||||||||||||||||||||||||||||
| 3320 | my $child = $driver->find_child_elements($elem1, "./option"); | ||||||||||||||||||||||||||||||||||||||||||
| 3321 | |||||||||||||||||||||||||||||||||||||||||||
| 3322 | =head2 find_element_by_class | ||||||||||||||||||||||||||||||||||||||||||
| 3323 | |||||||||||||||||||||||||||||||||||||||||||
| 3324 | See L</find_element>. | ||||||||||||||||||||||||||||||||||||||||||
| 3325 | |||||||||||||||||||||||||||||||||||||||||||
| 3326 | =head2 find_element_by_class_name | ||||||||||||||||||||||||||||||||||||||||||
| 3327 | |||||||||||||||||||||||||||||||||||||||||||
| 3328 | See L</find_element>. | ||||||||||||||||||||||||||||||||||||||||||
| 3329 | |||||||||||||||||||||||||||||||||||||||||||
| 3330 | =head2 find_element_by_css | ||||||||||||||||||||||||||||||||||||||||||
| 3331 | |||||||||||||||||||||||||||||||||||||||||||
| 3332 | See L</find_element>. | ||||||||||||||||||||||||||||||||||||||||||
| 3333 | |||||||||||||||||||||||||||||||||||||||||||
| 3334 | =head2 find_element_by_id | ||||||||||||||||||||||||||||||||||||||||||
| 3335 | |||||||||||||||||||||||||||||||||||||||||||
| 3336 | See L</find_element>. | ||||||||||||||||||||||||||||||||||||||||||
| 3337 | |||||||||||||||||||||||||||||||||||||||||||
| 3338 | =head2 find_element_by_link | ||||||||||||||||||||||||||||||||||||||||||
| 3339 | |||||||||||||||||||||||||||||||||||||||||||
| 3340 | See L</find_element>. | ||||||||||||||||||||||||||||||||||||||||||
| 3341 | |||||||||||||||||||||||||||||||||||||||||||
| 3342 | =head2 find_element_by_link_text | ||||||||||||||||||||||||||||||||||||||||||
| 3343 | |||||||||||||||||||||||||||||||||||||||||||
| 3344 | See L</find_element>. | ||||||||||||||||||||||||||||||||||||||||||
| 3345 | |||||||||||||||||||||||||||||||||||||||||||
| 3346 | =head2 find_element_by_name | ||||||||||||||||||||||||||||||||||||||||||
| 3347 | |||||||||||||||||||||||||||||||||||||||||||
| 3348 | See L</find_element>. | ||||||||||||||||||||||||||||||||||||||||||
| 3349 | |||||||||||||||||||||||||||||||||||||||||||
| 3350 | =head2 find_element_by_partial_link_text | ||||||||||||||||||||||||||||||||||||||||||
| 3351 | |||||||||||||||||||||||||||||||||||||||||||
| 3352 | See L</find_element>. | ||||||||||||||||||||||||||||||||||||||||||
| 3353 | |||||||||||||||||||||||||||||||||||||||||||
| 3354 | =head2 find_element_by_tag_name | ||||||||||||||||||||||||||||||||||||||||||
| 3355 | |||||||||||||||||||||||||||||||||||||||||||
| 3356 | See L</find_element>. | ||||||||||||||||||||||||||||||||||||||||||
| 3357 | |||||||||||||||||||||||||||||||||||||||||||
| 3358 | =head2 find_element_by_xpath | ||||||||||||||||||||||||||||||||||||||||||
| 3359 | |||||||||||||||||||||||||||||||||||||||||||
| 3360 | See L</find_element>. | ||||||||||||||||||||||||||||||||||||||||||
| 3361 | |||||||||||||||||||||||||||||||||||||||||||
| 3362 | =head2 get_active_element | ||||||||||||||||||||||||||||||||||||||||||
| 3363 | |||||||||||||||||||||||||||||||||||||||||||
| 3364 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3365 | Get the element on the page that currently has focus.. The located element | ||||||||||||||||||||||||||||||||||||||||||
| 3366 | will be returned as a WebElement object. | ||||||||||||||||||||||||||||||||||||||||||
| 3367 | |||||||||||||||||||||||||||||||||||||||||||
| 3368 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 3369 | WebElement Object | ||||||||||||||||||||||||||||||||||||||||||
| 3370 | |||||||||||||||||||||||||||||||||||||||||||
| 3371 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3372 | $driver->get_active_element(); | ||||||||||||||||||||||||||||||||||||||||||
| 3373 | |||||||||||||||||||||||||||||||||||||||||||
| 3374 | =head2 cache_status | ||||||||||||||||||||||||||||||||||||||||||
| 3375 | |||||||||||||||||||||||||||||||||||||||||||
| 3376 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3377 | Get the status of the html5 application cache. | ||||||||||||||||||||||||||||||||||||||||||
| 3378 | |||||||||||||||||||||||||||||||||||||||||||
| 3379 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3380 | print $driver->cache_status; | ||||||||||||||||||||||||||||||||||||||||||
| 3381 | |||||||||||||||||||||||||||||||||||||||||||
| 3382 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 3383 | <number> - Status code for application cache: {UNCACHED = 0, IDLE = 1, CHECKING = 2, DOWNLOADING = 3, UPDATE_READY = 4, OBSOLETE = 5} | ||||||||||||||||||||||||||||||||||||||||||
| 3384 | |||||||||||||||||||||||||||||||||||||||||||
| 3385 | =head2 set_geolocation | ||||||||||||||||||||||||||||||||||||||||||
| 3386 | |||||||||||||||||||||||||||||||||||||||||||
| 3387 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3388 | Set the current geographic location - note that your driver must | ||||||||||||||||||||||||||||||||||||||||||
| 3389 | implement this endpoint, or else it will crash your session. At the | ||||||||||||||||||||||||||||||||||||||||||
| 3390 | very least, it works in v2.12 of Chromedriver. | ||||||||||||||||||||||||||||||||||||||||||
| 3391 | |||||||||||||||||||||||||||||||||||||||||||
| 3392 | Input: | ||||||||||||||||||||||||||||||||||||||||||
| 3393 | Required: | ||||||||||||||||||||||||||||||||||||||||||
| 3394 | HASH: A hash with key C<location> whose value is a Location hashref. See | ||||||||||||||||||||||||||||||||||||||||||
| 3395 | usage section for example. | ||||||||||||||||||||||||||||||||||||||||||
| 3396 | |||||||||||||||||||||||||||||||||||||||||||
| 3397 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3398 | $driver->set_geolocation( location => { | ||||||||||||||||||||||||||||||||||||||||||
| 3399 | latitude => 40.714353, | ||||||||||||||||||||||||||||||||||||||||||
| 3400 | longitude => -74.005973, | ||||||||||||||||||||||||||||||||||||||||||
| 3401 | altitude => 0.056747 | ||||||||||||||||||||||||||||||||||||||||||
| 3402 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 3403 | |||||||||||||||||||||||||||||||||||||||||||
| 3404 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 3405 | BOOLEAN - success or failure | ||||||||||||||||||||||||||||||||||||||||||
| 3406 | |||||||||||||||||||||||||||||||||||||||||||
| 3407 | =head2 get_geolocation | ||||||||||||||||||||||||||||||||||||||||||
| 3408 | |||||||||||||||||||||||||||||||||||||||||||
| 3409 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3410 | Get the current geographic location. Note that your webdriver must | ||||||||||||||||||||||||||||||||||||||||||
| 3411 | implement this endpoint - otherwise, it will crash your session. At | ||||||||||||||||||||||||||||||||||||||||||
| 3412 | the time of release, we couldn't get this to work on the desktop | ||||||||||||||||||||||||||||||||||||||||||
| 3413 | FirefoxDriver or desktop Chromedriver. | ||||||||||||||||||||||||||||||||||||||||||
| 3414 | |||||||||||||||||||||||||||||||||||||||||||
| 3415 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3416 | print $driver->get_geolocation; | ||||||||||||||||||||||||||||||||||||||||||
| 3417 | |||||||||||||||||||||||||||||||||||||||||||
| 3418 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 3419 | { latitude: number, longitude: number, altitude: number } - The current geo location. | ||||||||||||||||||||||||||||||||||||||||||
| 3420 | |||||||||||||||||||||||||||||||||||||||||||
| 3421 | =head2 get_log | ||||||||||||||||||||||||||||||||||||||||||
| 3422 | |||||||||||||||||||||||||||||||||||||||||||
| 3423 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3424 | Get the log for a given log type. Log buffer is reset after each request. | ||||||||||||||||||||||||||||||||||||||||||
| 3425 | |||||||||||||||||||||||||||||||||||||||||||
| 3426 | Input: | ||||||||||||||||||||||||||||||||||||||||||
| 3427 | Required: | ||||||||||||||||||||||||||||||||||||||||||
| 3428 | <STRING> - Type of log to retrieve: | ||||||||||||||||||||||||||||||||||||||||||
| 3429 | {client|driver|browser|server}. There may be others available; see | ||||||||||||||||||||||||||||||||||||||||||
| 3430 | get_log_types for a full list for your driver. | ||||||||||||||||||||||||||||||||||||||||||
| 3431 | |||||||||||||||||||||||||||||||||||||||||||
| 3432 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3433 | $driver->get_log( $log_type ); | ||||||||||||||||||||||||||||||||||||||||||
| 3434 | |||||||||||||||||||||||||||||||||||||||||||
| 3435 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 3436 | <ARRAY|ARRAYREF> - An array of log entries since the most recent request. | ||||||||||||||||||||||||||||||||||||||||||
| 3437 | |||||||||||||||||||||||||||||||||||||||||||
| 3438 | =head2 get_log_types | ||||||||||||||||||||||||||||||||||||||||||
| 3439 | |||||||||||||||||||||||||||||||||||||||||||
| 3440 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3441 | Get available log types. By default, every driver should have client, | ||||||||||||||||||||||||||||||||||||||||||
| 3442 | driver, browser, and server types, but there may be more available, | ||||||||||||||||||||||||||||||||||||||||||
| 3443 | depending on your driver. | ||||||||||||||||||||||||||||||||||||||||||
| 3444 | |||||||||||||||||||||||||||||||||||||||||||
| 3445 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3446 | my @types = $driver->get_log_types; | ||||||||||||||||||||||||||||||||||||||||||
| 3447 | $driver->get_log($types[0]); | ||||||||||||||||||||||||||||||||||||||||||
| 3448 | |||||||||||||||||||||||||||||||||||||||||||
| 3449 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 3450 | <ARRAYREF> - The list of log types. | ||||||||||||||||||||||||||||||||||||||||||
| 3451 | |||||||||||||||||||||||||||||||||||||||||||
| 3452 | =head2 set_orientation | ||||||||||||||||||||||||||||||||||||||||||
| 3453 | |||||||||||||||||||||||||||||||||||||||||||
| 3454 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3455 | Set the browser orientation. | ||||||||||||||||||||||||||||||||||||||||||
| 3456 | |||||||||||||||||||||||||||||||||||||||||||
| 3457 | Input: | ||||||||||||||||||||||||||||||||||||||||||
| 3458 | Required: | ||||||||||||||||||||||||||||||||||||||||||
| 3459 | <STRING> - Orientation {LANDSCAPE|PORTRAIT} | ||||||||||||||||||||||||||||||||||||||||||
| 3460 | |||||||||||||||||||||||||||||||||||||||||||
| 3461 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3462 | $driver->set_orientation( $orientation ); | ||||||||||||||||||||||||||||||||||||||||||
| 3463 | |||||||||||||||||||||||||||||||||||||||||||
| 3464 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 3465 | BOOLEAN - success or failure | ||||||||||||||||||||||||||||||||||||||||||
| 3466 | |||||||||||||||||||||||||||||||||||||||||||
| 3467 | =head2 get_orientation | ||||||||||||||||||||||||||||||||||||||||||
| 3468 | |||||||||||||||||||||||||||||||||||||||||||
| 3469 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3470 | Get the current browser orientation. Returns either LANDSCAPE|PORTRAIT. | ||||||||||||||||||||||||||||||||||||||||||
| 3471 | |||||||||||||||||||||||||||||||||||||||||||
| 3472 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3473 | print $driver->get_orientation; | ||||||||||||||||||||||||||||||||||||||||||
| 3474 | |||||||||||||||||||||||||||||||||||||||||||
| 3475 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 3476 | <STRING> - your orientation. | ||||||||||||||||||||||||||||||||||||||||||
| 3477 | |||||||||||||||||||||||||||||||||||||||||||
| 3478 | =head2 send_modifier | ||||||||||||||||||||||||||||||||||||||||||
| 3479 | |||||||||||||||||||||||||||||||||||||||||||
| 3480 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3481 | Send an event to the active element to depress or release a modifier key. | ||||||||||||||||||||||||||||||||||||||||||
| 3482 | |||||||||||||||||||||||||||||||||||||||||||
| 3483 | Input: 2 | ||||||||||||||||||||||||||||||||||||||||||
| 3484 | Required: | ||||||||||||||||||||||||||||||||||||||||||
| 3485 | value - String - The modifier key event to be sent. This key must be one 'Ctrl','Shift','Alt',' or 'Command'/'Meta' as defined by the send keys command | ||||||||||||||||||||||||||||||||||||||||||
| 3486 | isdown - Boolean/String - Whether to generate a key down or key up | ||||||||||||||||||||||||||||||||||||||||||
| 3487 | |||||||||||||||||||||||||||||||||||||||||||
| 3488 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3489 | $driver->send_modifier('Alt','down'); | ||||||||||||||||||||||||||||||||||||||||||
| 3490 | $elem->send_keys('c'); | ||||||||||||||||||||||||||||||||||||||||||
| 3491 | $driver->send_modifier('Alt','up'); | ||||||||||||||||||||||||||||||||||||||||||
| 3492 | |||||||||||||||||||||||||||||||||||||||||||
| 3493 | or | ||||||||||||||||||||||||||||||||||||||||||
| 3494 | |||||||||||||||||||||||||||||||||||||||||||
| 3495 | $driver->send_modifier('Alt',1); | ||||||||||||||||||||||||||||||||||||||||||
| 3496 | $elem->send_keys('c'); | ||||||||||||||||||||||||||||||||||||||||||
| 3497 | $driver->send_modifier('Alt',0); | ||||||||||||||||||||||||||||||||||||||||||
| 3498 | |||||||||||||||||||||||||||||||||||||||||||
| 3499 | =head2 compare_elements | ||||||||||||||||||||||||||||||||||||||||||
| 3500 | |||||||||||||||||||||||||||||||||||||||||||
| 3501 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3502 | Test if two element IDs refer to the same DOM element. | ||||||||||||||||||||||||||||||||||||||||||
| 3503 | |||||||||||||||||||||||||||||||||||||||||||
| 3504 | Input: 2 | ||||||||||||||||||||||||||||||||||||||||||
| 3505 | Required: | ||||||||||||||||||||||||||||||||||||||||||
| 3506 | Selenium::Remote::WebElement - WebElement Object | ||||||||||||||||||||||||||||||||||||||||||
| 3507 | Selenium::Remote::WebElement - WebElement Object | ||||||||||||||||||||||||||||||||||||||||||
| 3508 | |||||||||||||||||||||||||||||||||||||||||||
| 3509 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 3510 | BOOLEAN | ||||||||||||||||||||||||||||||||||||||||||
| 3511 | |||||||||||||||||||||||||||||||||||||||||||
| 3512 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3513 | $driver->compare_elements($elem_obj1, $elem_obj2); | ||||||||||||||||||||||||||||||||||||||||||
| 3514 | |||||||||||||||||||||||||||||||||||||||||||
| 3515 | =head2 click | ||||||||||||||||||||||||||||||||||||||||||
| 3516 | |||||||||||||||||||||||||||||||||||||||||||
| 3517 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3518 | Click any mouse button (at the coordinates set by the last move_to command). | ||||||||||||||||||||||||||||||||||||||||||
| 3519 | |||||||||||||||||||||||||||||||||||||||||||
| 3520 | Input: | ||||||||||||||||||||||||||||||||||||||||||
| 3521 | button - any one of 'LEFT'/0 'MIDDLE'/1 'RIGHT'/2 | ||||||||||||||||||||||||||||||||||||||||||
| 3522 | defaults to 'LEFT' | ||||||||||||||||||||||||||||||||||||||||||
| 3523 | queue - (optional) queue the click, rather than executing it. WD3 only. | ||||||||||||||||||||||||||||||||||||||||||
| 3524 | |||||||||||||||||||||||||||||||||||||||||||
| 3525 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3526 | $driver->click('LEFT'); | ||||||||||||||||||||||||||||||||||||||||||
| 3527 | $driver->click(1); #MIDDLE | ||||||||||||||||||||||||||||||||||||||||||
| 3528 | $driver->click('RIGHT'); | ||||||||||||||||||||||||||||||||||||||||||
| 3529 | $driver->click; #Defaults to left | ||||||||||||||||||||||||||||||||||||||||||
| 3530 | |||||||||||||||||||||||||||||||||||||||||||
| 3531 | =head2 double_click | ||||||||||||||||||||||||||||||||||||||||||
| 3532 | |||||||||||||||||||||||||||||||||||||||||||
| 3533 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3534 | Double-clicks at the current mouse coordinates (set by move_to). | ||||||||||||||||||||||||||||||||||||||||||
| 3535 | |||||||||||||||||||||||||||||||||||||||||||
| 3536 | Compatibility: | ||||||||||||||||||||||||||||||||||||||||||
| 3537 | On webdriver3 enabled servers, you can double click arbitrary mouse buttons. | ||||||||||||||||||||||||||||||||||||||||||
| 3538 | |||||||||||||||||||||||||||||||||||||||||||
| 3539 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3540 | $driver->double_click(button); | ||||||||||||||||||||||||||||||||||||||||||
| 3541 | |||||||||||||||||||||||||||||||||||||||||||
| 3542 | =head2 button_down | ||||||||||||||||||||||||||||||||||||||||||
| 3543 | |||||||||||||||||||||||||||||||||||||||||||
| 3544 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3545 | Click and hold the left mouse button (at the coordinates set by the | ||||||||||||||||||||||||||||||||||||||||||
| 3546 | last move_to command). Note that the next mouse-related command that | ||||||||||||||||||||||||||||||||||||||||||
| 3547 | should follow is buttonup . Any other mouse command (such as click | ||||||||||||||||||||||||||||||||||||||||||
| 3548 | or another call to buttondown) will yield undefined behaviour. | ||||||||||||||||||||||||||||||||||||||||||
| 3549 | |||||||||||||||||||||||||||||||||||||||||||
| 3550 | Compatibility: | ||||||||||||||||||||||||||||||||||||||||||
| 3551 | On WebDriver 3 enabled servers, all this does is queue a button down action. | ||||||||||||||||||||||||||||||||||||||||||
| 3552 | You will either have to call general_action() to perform the queue, or an action like click() which also clears the queue. | ||||||||||||||||||||||||||||||||||||||||||
| 3553 | |||||||||||||||||||||||||||||||||||||||||||
| 3554 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3555 | $self->button_down; | ||||||||||||||||||||||||||||||||||||||||||
| 3556 | |||||||||||||||||||||||||||||||||||||||||||
| 3557 | =head2 button_up | ||||||||||||||||||||||||||||||||||||||||||
| 3558 | |||||||||||||||||||||||||||||||||||||||||||
| 3559 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3560 | Releases the mouse button previously held (where the mouse is | ||||||||||||||||||||||||||||||||||||||||||
| 3561 | currently at). Must be called once for every buttondown command | ||||||||||||||||||||||||||||||||||||||||||
| 3562 | issued. See the note in click and buttondown about implications of | ||||||||||||||||||||||||||||||||||||||||||
| 3563 | out-of-order commands. | ||||||||||||||||||||||||||||||||||||||||||
| 3564 | |||||||||||||||||||||||||||||||||||||||||||
| 3565 | Compatibility: | ||||||||||||||||||||||||||||||||||||||||||
| 3566 | On WebDriver 3 enabled servers, all this does is queue a button down action. | ||||||||||||||||||||||||||||||||||||||||||
| 3567 | You will either have to call general_action() to perform the queue, or an action like click() which also clears the queue. | ||||||||||||||||||||||||||||||||||||||||||
| 3568 | |||||||||||||||||||||||||||||||||||||||||||
| 3569 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3570 | $self->button_up; | ||||||||||||||||||||||||||||||||||||||||||
| 3571 | |||||||||||||||||||||||||||||||||||||||||||
| 3572 | =head2 upload_file | ||||||||||||||||||||||||||||||||||||||||||
| 3573 | |||||||||||||||||||||||||||||||||||||||||||
| 3574 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3575 | Upload a file from the local machine to the selenium server | ||||||||||||||||||||||||||||||||||||||||||
| 3576 | machine. That file then can be used for testing file upload on web | ||||||||||||||||||||||||||||||||||||||||||
| 3577 | forms. Returns the remote-server's path to the file. | ||||||||||||||||||||||||||||||||||||||||||
| 3578 | |||||||||||||||||||||||||||||||||||||||||||
| 3579 | Passing raw data as an argument past the filename will upload | ||||||||||||||||||||||||||||||||||||||||||
| 3580 | that rather than the file's contents. | ||||||||||||||||||||||||||||||||||||||||||
| 3581 | |||||||||||||||||||||||||||||||||||||||||||
| 3582 | When passing raw data, be advised that it expects a zipped | ||||||||||||||||||||||||||||||||||||||||||
| 3583 | and then base64 encoded version of a single file. | ||||||||||||||||||||||||||||||||||||||||||
| 3584 | Multiple files and/or directories are not supported by the remote server. | ||||||||||||||||||||||||||||||||||||||||||
| 3585 | |||||||||||||||||||||||||||||||||||||||||||
| 3586 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3587 | my $remote_fname = $driver->upload_file( $fname ); | ||||||||||||||||||||||||||||||||||||||||||
| 3588 | my $element = $driver->find_element( '//input[@id="file"]' ); | ||||||||||||||||||||||||||||||||||||||||||
| 3589 | $element->send_keys( $remote_fname ); | ||||||||||||||||||||||||||||||||||||||||||
| 3590 | |||||||||||||||||||||||||||||||||||||||||||
| 3591 | =head2 get_text | ||||||||||||||||||||||||||||||||||||||||||
| 3592 | |||||||||||||||||||||||||||||||||||||||||||
| 3593 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3594 | Get the text of a particular element. Wrapper around L</find_element> | ||||||||||||||||||||||||||||||||||||||||||
| 3595 | |||||||||||||||||||||||||||||||||||||||||||
| 3596 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3597 | $text = $driver->get_text("//div[\@name='q']"); | ||||||||||||||||||||||||||||||||||||||||||
| 3598 | |||||||||||||||||||||||||||||||||||||||||||
| 3599 | =head2 get_body | ||||||||||||||||||||||||||||||||||||||||||
| 3600 | |||||||||||||||||||||||||||||||||||||||||||
| 3601 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3602 | Get the current text for the whole body. If you want the entire raw HTML instead, | ||||||||||||||||||||||||||||||||||||||||||
| 3603 | See L</get_page_source>. | ||||||||||||||||||||||||||||||||||||||||||
| 3604 | |||||||||||||||||||||||||||||||||||||||||||
| 3605 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3606 | $body_text = $driver->get_body(); | ||||||||||||||||||||||||||||||||||||||||||
| 3607 | |||||||||||||||||||||||||||||||||||||||||||
| 3608 | =head2 get_path | ||||||||||||||||||||||||||||||||||||||||||
| 3609 | |||||||||||||||||||||||||||||||||||||||||||
| 3610 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3611 | Get the path part of the current browser location. | ||||||||||||||||||||||||||||||||||||||||||
| 3612 | |||||||||||||||||||||||||||||||||||||||||||
| 3613 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3614 | $path = $driver->get_path(); | ||||||||||||||||||||||||||||||||||||||||||
| 3615 | |||||||||||||||||||||||||||||||||||||||||||
| 3616 | =head2 get_user_agent | ||||||||||||||||||||||||||||||||||||||||||
| 3617 | |||||||||||||||||||||||||||||||||||||||||||
| 3618 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3619 | Convenience method to get the user agent string, according to the | ||||||||||||||||||||||||||||||||||||||||||
| 3620 | browser's value for window.navigator.userAgent. | ||||||||||||||||||||||||||||||||||||||||||
| 3621 | |||||||||||||||||||||||||||||||||||||||||||
| 3622 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3623 | $user_agent = $driver->get_user_agent() | ||||||||||||||||||||||||||||||||||||||||||
| 3624 | |||||||||||||||||||||||||||||||||||||||||||
| 3625 | =head2 set_inner_window_size | ||||||||||||||||||||||||||||||||||||||||||
| 3626 | |||||||||||||||||||||||||||||||||||||||||||
| 3627 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3628 | Set the inner window size by closing the current window and | ||||||||||||||||||||||||||||||||||||||||||
| 3629 | reopening the current page in a new window. This can be useful | ||||||||||||||||||||||||||||||||||||||||||
| 3630 | when using browsers to mock as mobile devices. | ||||||||||||||||||||||||||||||||||||||||||
| 3631 | |||||||||||||||||||||||||||||||||||||||||||
| 3632 | This sub will be fired automatically if you set the | ||||||||||||||||||||||||||||||||||||||||||
| 3633 | C<inner_window_size> hash key option during instantiation. | ||||||||||||||||||||||||||||||||||||||||||
| 3634 | |||||||||||||||||||||||||||||||||||||||||||
| 3635 | Input: | ||||||||||||||||||||||||||||||||||||||||||
| 3636 | INT - height of the window | ||||||||||||||||||||||||||||||||||||||||||
| 3637 | INT - width of the window | ||||||||||||||||||||||||||||||||||||||||||
| 3638 | |||||||||||||||||||||||||||||||||||||||||||
| 3639 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 3640 | BOOLEAN - Success or failure | ||||||||||||||||||||||||||||||||||||||||||
| 3641 | |||||||||||||||||||||||||||||||||||||||||||
| 3642 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3643 | $driver->set_inner_window_size(640, 480) | ||||||||||||||||||||||||||||||||||||||||||
| 3644 | |||||||||||||||||||||||||||||||||||||||||||
| 3645 | =head2 get_local_storage_item | ||||||||||||||||||||||||||||||||||||||||||
| 3646 | |||||||||||||||||||||||||||||||||||||||||||
| 3647 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3648 | Get the value of a local storage item specified by the given key. | ||||||||||||||||||||||||||||||||||||||||||
| 3649 | |||||||||||||||||||||||||||||||||||||||||||
| 3650 | Input: 1 | ||||||||||||||||||||||||||||||||||||||||||
| 3651 | Required: | ||||||||||||||||||||||||||||||||||||||||||
| 3652 | STRING - name of the key to be retrieved | ||||||||||||||||||||||||||||||||||||||||||
| 3653 | |||||||||||||||||||||||||||||||||||||||||||
| 3654 | Output: | ||||||||||||||||||||||||||||||||||||||||||
| 3655 | STRING - value of the local storage item | ||||||||||||||||||||||||||||||||||||||||||
| 3656 | |||||||||||||||||||||||||||||||||||||||||||
| 3657 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3658 | $driver->get_local_storage_item('key') | ||||||||||||||||||||||||||||||||||||||||||
| 3659 | |||||||||||||||||||||||||||||||||||||||||||
| 3660 | =head2 delete_local_storage_item | ||||||||||||||||||||||||||||||||||||||||||
| 3661 | |||||||||||||||||||||||||||||||||||||||||||
| 3662 | Description: | ||||||||||||||||||||||||||||||||||||||||||
| 3663 | Get the value of a local storage item specified by the given key. | ||||||||||||||||||||||||||||||||||||||||||
| 3664 | |||||||||||||||||||||||||||||||||||||||||||
| 3665 | Input: 1 | ||||||||||||||||||||||||||||||||||||||||||
| 3666 | Required | ||||||||||||||||||||||||||||||||||||||||||
| 3667 | STRING - name of the key to be deleted | ||||||||||||||||||||||||||||||||||||||||||
| 3668 | |||||||||||||||||||||||||||||||||||||||||||
| 3669 | Usage: | ||||||||||||||||||||||||||||||||||||||||||
| 3670 | $driver->delete_local_storage_item('key') | ||||||||||||||||||||||||||||||||||||||||||
| 3671 | |||||||||||||||||||||||||||||||||||||||||||
| 3672 | =head1 AUTHORS | ||||||||||||||||||||||||||||||||||||||||||
| 3673 | |||||||||||||||||||||||||||||||||||||||||||
| 3674 | Current Maintainers: | ||||||||||||||||||||||||||||||||||||||||||
| 3675 | |||||||||||||||||||||||||||||||||||||||||||
| 3676 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 3677 | |||||||||||||||||||||||||||||||||||||||||||
| 3678 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3679 | |||||||||||||||||||||||||||||||||||||||||||
| 3680 | George S. Baugh <george@troglodyne.net> | ||||||||||||||||||||||||||||||||||||||||||
| 3681 | |||||||||||||||||||||||||||||||||||||||||||
| 3682 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 3683 | |||||||||||||||||||||||||||||||||||||||||||
| 3684 | Previous maintainers: | ||||||||||||||||||||||||||||||||||||||||||
| 3685 | |||||||||||||||||||||||||||||||||||||||||||
| 3686 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 3687 | |||||||||||||||||||||||||||||||||||||||||||
| 3688 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3689 | |||||||||||||||||||||||||||||||||||||||||||
| 3690 | Daniel Gempesaw <gempesaw@gmail.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3691 | |||||||||||||||||||||||||||||||||||||||||||
| 3692 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3693 | |||||||||||||||||||||||||||||||||||||||||||
| 3694 | Emmanuel Peroumalnaïk <peroumalnaik.emmanuel@gmail.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3695 | |||||||||||||||||||||||||||||||||||||||||||
| 3696 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3697 | |||||||||||||||||||||||||||||||||||||||||||
| 3698 | Luke Closs <cpan@5thplane.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3699 | |||||||||||||||||||||||||||||||||||||||||||
| 3700 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3701 | |||||||||||||||||||||||||||||||||||||||||||
| 3702 | Mark Stosberg <mark@stosberg.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3703 | |||||||||||||||||||||||||||||||||||||||||||
| 3704 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 3705 | |||||||||||||||||||||||||||||||||||||||||||
| 3706 | Original authors: | ||||||||||||||||||||||||||||||||||||||||||
| 3707 | |||||||||||||||||||||||||||||||||||||||||||
| 3708 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 3709 | |||||||||||||||||||||||||||||||||||||||||||
| 3710 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3711 | |||||||||||||||||||||||||||||||||||||||||||
| 3712 | Aditya Ivaturi <ivaturi@gmail.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3713 | |||||||||||||||||||||||||||||||||||||||||||
| 3714 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 3715 | |||||||||||||||||||||||||||||||||||||||||||
| 3716 | =head1 CONTRIBUTORS | ||||||||||||||||||||||||||||||||||||||||||
| 3717 | |||||||||||||||||||||||||||||||||||||||||||
| 3718 | =for stopwords Allen Lew A.MacLeay Andy Jack Bas Bloemsaat bernhard Blake GH Brian Horakh Charles Howes Chris Davies Daniel Fackrell Dave Rolsky Dmitry Karasik Doug Bell Dylan Streb Eric Johnson Gabor Szabo George S. Baugh Gerhard Jungwirth Gordon Child GreatFlamingFoo Ivan Kurmanov Joe Higton Jon Hermansen Keita Sugama Ken Swanson lembark Luke Closs Martin Gruner Matthew Spahr Max O'Cull Michael Prokop mk654321 Peter Mottram (SysPete) Phil Kania Mitchell Prateek Goyal Richard Sailer Robert Utter rouzier Tetsuya Tatsumi Tod Hagan Tom Hukins Vangelis Katsikaros Vishwanath Janmanchi Viťas Strádal Yuki Kimoto Yves Lavoie | ||||||||||||||||||||||||||||||||||||||||||
| 3719 | |||||||||||||||||||||||||||||||||||||||||||
| 3720 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 3721 | |||||||||||||||||||||||||||||||||||||||||||
| 3722 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3723 | |||||||||||||||||||||||||||||||||||||||||||
| 3724 | Allen Lew <allen@alew.org> | ||||||||||||||||||||||||||||||||||||||||||
| 3725 | |||||||||||||||||||||||||||||||||||||||||||
| 3726 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3727 | |||||||||||||||||||||||||||||||||||||||||||
| 3728 | A.MacLeay <a.macleay@gmail.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3729 | |||||||||||||||||||||||||||||||||||||||||||
| 3730 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3731 | |||||||||||||||||||||||||||||||||||||||||||
| 3732 | Andy Jack <andyjack@users.noreply.github.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3733 | |||||||||||||||||||||||||||||||||||||||||||
| 3734 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3735 | |||||||||||||||||||||||||||||||||||||||||||
| 3736 | Andy Jack <github@veracity.ca> | ||||||||||||||||||||||||||||||||||||||||||
| 3737 | |||||||||||||||||||||||||||||||||||||||||||
| 3738 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3739 | |||||||||||||||||||||||||||||||||||||||||||
| 3740 | Bas Bloemsaat <bas@bloemsaat.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3741 | |||||||||||||||||||||||||||||||||||||||||||
| 3742 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3743 | |||||||||||||||||||||||||||||||||||||||||||
| 3744 | bernhard <Bernhard.Schmalhofer@gmx.de> | ||||||||||||||||||||||||||||||||||||||||||
| 3745 | |||||||||||||||||||||||||||||||||||||||||||
| 3746 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3747 | |||||||||||||||||||||||||||||||||||||||||||
| 3748 | Blake GH <blake@mobiusconsortium.org> | ||||||||||||||||||||||||||||||||||||||||||
| 3749 | |||||||||||||||||||||||||||||||||||||||||||
| 3750 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3751 | |||||||||||||||||||||||||||||||||||||||||||
| 3752 | Brian Horakh <brianh@zoovy.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3753 | |||||||||||||||||||||||||||||||||||||||||||
| 3754 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3755 | |||||||||||||||||||||||||||||||||||||||||||
| 3756 | Charles Howes <charles.howes@globalrelay.net> | ||||||||||||||||||||||||||||||||||||||||||
| 3757 | |||||||||||||||||||||||||||||||||||||||||||
| 3758 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3759 | |||||||||||||||||||||||||||||||||||||||||||
| 3760 | Chris Davies <FMQA@users.noreply.github.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3761 | |||||||||||||||||||||||||||||||||||||||||||
| 3762 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3763 | |||||||||||||||||||||||||||||||||||||||||||
| 3764 | Daniel Fackrell <dfackrell@bluehost.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3765 | |||||||||||||||||||||||||||||||||||||||||||
| 3766 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3767 | |||||||||||||||||||||||||||||||||||||||||||
| 3768 | Dave Rolsky <autarch@urth.org> | ||||||||||||||||||||||||||||||||||||||||||
| 3769 | |||||||||||||||||||||||||||||||||||||||||||
| 3770 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3771 | |||||||||||||||||||||||||||||||||||||||||||
| 3772 | Dmitry Karasik <dmitry@karasik.eu.org> | ||||||||||||||||||||||||||||||||||||||||||
| 3773 | |||||||||||||||||||||||||||||||||||||||||||
| 3774 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3775 | |||||||||||||||||||||||||||||||||||||||||||
| 3776 | Doug Bell <doug@preaction.me> | ||||||||||||||||||||||||||||||||||||||||||
| 3777 | |||||||||||||||||||||||||||||||||||||||||||
| 3778 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3779 | |||||||||||||||||||||||||||||||||||||||||||
| 3780 | Dylan Streb <dylan.streb@oneil.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3781 | |||||||||||||||||||||||||||||||||||||||||||
| 3782 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3783 | |||||||||||||||||||||||||||||||||||||||||||
| 3784 | Eric Johnson <eric.git@iijo.org> | ||||||||||||||||||||||||||||||||||||||||||
| 3785 | |||||||||||||||||||||||||||||||||||||||||||
| 3786 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3787 | |||||||||||||||||||||||||||||||||||||||||||
| 3788 | Gabor Szabo <gabor@szabgab.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3789 | |||||||||||||||||||||||||||||||||||||||||||
| 3790 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3791 | |||||||||||||||||||||||||||||||||||||||||||
| 3792 | George S. Baugh <george.b@cpanel.net> | ||||||||||||||||||||||||||||||||||||||||||
| 3793 | |||||||||||||||||||||||||||||||||||||||||||
| 3794 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3795 | |||||||||||||||||||||||||||||||||||||||||||
| 3796 | Gerhard Jungwirth <gjungwirth@sipwise.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3797 | |||||||||||||||||||||||||||||||||||||||||||
| 3798 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3799 | |||||||||||||||||||||||||||||||||||||||||||
| 3800 | Gordon Child <gordon@gordonchild.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3801 | |||||||||||||||||||||||||||||||||||||||||||
| 3802 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3803 | |||||||||||||||||||||||||||||||||||||||||||
| 3804 | GreatFlamingFoo <greatflamingfoo@gmail.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3805 | |||||||||||||||||||||||||||||||||||||||||||
| 3806 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3807 | |||||||||||||||||||||||||||||||||||||||||||
| 3808 | Ivan Kurmanov <duraley@gmail.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3809 | |||||||||||||||||||||||||||||||||||||||||||
| 3810 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3811 | |||||||||||||||||||||||||||||||||||||||||||
| 3812 | Joe Higton <draxil@gmail.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3813 | |||||||||||||||||||||||||||||||||||||||||||
| 3814 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3815 | |||||||||||||||||||||||||||||||||||||||||||
| 3816 | Jon Hermansen <jon.hermansen@gmail.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3817 | |||||||||||||||||||||||||||||||||||||||||||
| 3818 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3819 | |||||||||||||||||||||||||||||||||||||||||||
| 3820 | Keita Sugama <sugama@jamadam.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3821 | |||||||||||||||||||||||||||||||||||||||||||
| 3822 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3823 | |||||||||||||||||||||||||||||||||||||||||||
| 3824 | Ken Swanson <kswanson@genome.wustl.edu> | ||||||||||||||||||||||||||||||||||||||||||
| 3825 | |||||||||||||||||||||||||||||||||||||||||||
| 3826 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3827 | |||||||||||||||||||||||||||||||||||||||||||
| 3828 | lembark <lembark@wrkhors.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3829 | |||||||||||||||||||||||||||||||||||||||||||
| 3830 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3831 | |||||||||||||||||||||||||||||||||||||||||||
| 3832 | Luke Closs <lukec@users.noreply.github.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3833 | |||||||||||||||||||||||||||||||||||||||||||
| 3834 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3835 | |||||||||||||||||||||||||||||||||||||||||||
| 3836 | Martin Gruner <martin.gruner@otrs.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3837 | |||||||||||||||||||||||||||||||||||||||||||
| 3838 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3839 | |||||||||||||||||||||||||||||||||||||||||||
| 3840 | Matthew Spahr <matthew.spahr@cpanel.net> | ||||||||||||||||||||||||||||||||||||||||||
| 3841 | |||||||||||||||||||||||||||||||||||||||||||
| 3842 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3843 | |||||||||||||||||||||||||||||||||||||||||||
| 3844 | Max O'Cull <maxattax97@gmail.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3845 | |||||||||||||||||||||||||||||||||||||||||||
| 3846 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3847 | |||||||||||||||||||||||||||||||||||||||||||
| 3848 | Michael Prokop <mprokop@sipwise.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3849 | |||||||||||||||||||||||||||||||||||||||||||
| 3850 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3851 | |||||||||||||||||||||||||||||||||||||||||||
| 3852 | mk654321 <kosmichal@gmail.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3853 | |||||||||||||||||||||||||||||||||||||||||||
| 3854 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3855 | |||||||||||||||||||||||||||||||||||||||||||
| 3856 | Peter Mottram (SysPete) <peter@sysnix.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3857 | |||||||||||||||||||||||||||||||||||||||||||
| 3858 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3859 | |||||||||||||||||||||||||||||||||||||||||||
| 3860 | Phil Kania <phil@vivox.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3861 | |||||||||||||||||||||||||||||||||||||||||||
| 3862 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3863 | |||||||||||||||||||||||||||||||||||||||||||
| 3864 | Phil Mitchell <phil.mitchell@pobox.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3865 | |||||||||||||||||||||||||||||||||||||||||||
| 3866 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3867 | |||||||||||||||||||||||||||||||||||||||||||
| 3868 | Prateek Goyal <prateek.goyal5@gmail.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3869 | |||||||||||||||||||||||||||||||||||||||||||
| 3870 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3871 | |||||||||||||||||||||||||||||||||||||||||||
| 3872 | Richard Sailer <richard@weltraumpflege.org> | ||||||||||||||||||||||||||||||||||||||||||
| 3873 | |||||||||||||||||||||||||||||||||||||||||||
| 3874 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3875 | |||||||||||||||||||||||||||||||||||||||||||
| 3876 | Robert Utter <utter.robert@gmail.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3877 | |||||||||||||||||||||||||||||||||||||||||||
| 3878 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3879 | |||||||||||||||||||||||||||||||||||||||||||
| 3880 | rouzier <rouzier@gmail.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3881 | |||||||||||||||||||||||||||||||||||||||||||
| 3882 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3883 | |||||||||||||||||||||||||||||||||||||||||||
| 3884 | Tetsuya Tatsumi <ttatsumi@ra2.so-net.ne.jp> | ||||||||||||||||||||||||||||||||||||||||||
| 3885 | |||||||||||||||||||||||||||||||||||||||||||
| 3886 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3887 | |||||||||||||||||||||||||||||||||||||||||||
| 3888 | Tod Hagan <42418406+tod222@users.noreply.github.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3889 | |||||||||||||||||||||||||||||||||||||||||||
| 3890 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3891 | |||||||||||||||||||||||||||||||||||||||||||
| 3892 | Tom Hukins <tom@eborcom.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3893 | |||||||||||||||||||||||||||||||||||||||||||
| 3894 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3895 | |||||||||||||||||||||||||||||||||||||||||||
| 3896 | Vangelis Katsikaros <vangelis@adzuna.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3897 | |||||||||||||||||||||||||||||||||||||||||||
| 3898 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3899 | |||||||||||||||||||||||||||||||||||||||||||
| 3900 | Vangelis Katsikaros <vkatsikaros@gmail.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3901 | |||||||||||||||||||||||||||||||||||||||||||
| 3902 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3903 | |||||||||||||||||||||||||||||||||||||||||||
| 3904 | Vishwanath Janmanchi <jvishwanath@gmail.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3905 | |||||||||||||||||||||||||||||||||||||||||||
| 3906 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3907 | |||||||||||||||||||||||||||||||||||||||||||
| 3908 | Viťas Strádal <vitas@matfyz.cz> | ||||||||||||||||||||||||||||||||||||||||||
| 3909 | |||||||||||||||||||||||||||||||||||||||||||
| 3910 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3911 | |||||||||||||||||||||||||||||||||||||||||||
| 3912 | Yuki Kimoto <kimoto.yuki@gmail.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3913 | |||||||||||||||||||||||||||||||||||||||||||
| 3914 | =item * | ||||||||||||||||||||||||||||||||||||||||||
| 3915 | |||||||||||||||||||||||||||||||||||||||||||
| 3916 | Yves Lavoie <ylavoie@yveslavoie.com> | ||||||||||||||||||||||||||||||||||||||||||
| 3917 | |||||||||||||||||||||||||||||||||||||||||||
| 3918 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 3919 | |||||||||||||||||||||||||||||||||||||||||||
| 3920 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||||||||||||||||
| 3921 | |||||||||||||||||||||||||||||||||||||||||||
| 3922 | Copyright (c) 2010-2011 Aditya Ivaturi, Gordon Child | ||||||||||||||||||||||||||||||||||||||||||
| 3923 | |||||||||||||||||||||||||||||||||||||||||||
| 3924 | Copyright (c) 2014-2017 Daniel Gempesaw | ||||||||||||||||||||||||||||||||||||||||||
| 3925 | |||||||||||||||||||||||||||||||||||||||||||
| 3926 | Copyright (c) 2018-2021 George S. Baugh | ||||||||||||||||||||||||||||||||||||||||||
| 3927 | |||||||||||||||||||||||||||||||||||||||||||
| 3928 | Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||||||||||||||||||||||||||||||||
| 3929 | you may not use this file except in compliance with the License. | ||||||||||||||||||||||||||||||||||||||||||
| 3930 | You may obtain a copy of the License at | ||||||||||||||||||||||||||||||||||||||||||
| 3931 | |||||||||||||||||||||||||||||||||||||||||||
| 3932 | http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||||||||||||||||||||||||||||||||||
| 3933 | |||||||||||||||||||||||||||||||||||||||||||
| 3934 | Unless required by applicable law or agreed to in writing, software | ||||||||||||||||||||||||||||||||||||||||||
| 3935 | distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||||||||||||||||||||||||||||||||||
| 3936 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||||||||||||||||||||||||||||||||||
| 3937 | See the License for the specific language governing permissions and | ||||||||||||||||||||||||||||||||||||||||||
| 3938 | limitations under the License. | ||||||||||||||||||||||||||||||||||||||||||
| 3939 | |||||||||||||||||||||||||||||||||||||||||||
| 3940 | =cut | ||||||||||||||||||||||||||||||||||||||||||