| 1 | package Selenium::Client::Driver; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 1 | $Selenium::Client::Driver::VERSION = '2.01'; | |||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use parent qw{Selenium::Remote::Driver}; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | ▶ | no warnings qw{experimental}; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use feature qw{signatures state}; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | # ABSTRACT: Drop-In replacement for Selenium::Remote::Driver that supports selenium 4 | ||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use Scalar::Util; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use Carp::Always; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use JSON; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | ▶ | use Selenium::Client; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 1 | ▶ | use Selenium::Client::Commands; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | ▶ | use Selenium::Client::WebElement; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use Selenium::Client::WDKeys; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | #Getters/Setters | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | sub _param ( $self, $default, $param, $value = undef ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_param: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | ▶ | $self->{$param} //= $default; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{$param} //= $default
MC/DC0%0/2
$self->{$param} //= $default
$self->{$param}
$default
Truth table0%0/3
A //= B
A= $self->{$param}B= $default
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | $self->{$param} = $value if defined $value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | return $self->{$param}; | |||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | sub driver ( $self, $driver = undef ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
driver: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | return $self->_param( undef, 'driver', $driver ); | |||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | sub base_url ( $self, $url = undef ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
base_url: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | return $self->_param( '', 'base_url', $url ); | |||||||||||||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | sub remote_server_addr ( $self, $addr = undef ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
remote_server_addr: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | return $self->_param( 'localhost', 'remote_server_addr', $addr ); | |||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | sub port ( $self, $port = undef ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
port: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | return $self->_param( 4444, 'port', $port ); | |||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | sub browser_name ( $self, $name = undef ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
browser_name: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | return $self->_param( 'firefox', 'browser_name', $name ); | |||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | sub platform ( $self, $platform = undef ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
platform: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | return $self->_param( 'ANY', 'platform', $platform ); | |||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | sub version ( $self, $version = undef ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
version: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | return $self->_param( '', 'version', $version ); | |||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | sub webelement_class ( $self, $class = undef ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
webelement_class: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | return $self->_param( 'Selenium::Client::WebElement', 'webelement_class', $class ); | |||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | sub default_finder ( $self, $finder = undef ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
default_finder: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | return $self->_param( 'xpath', 'default_finder', $finder ); | |||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | sub session ( $self, $session = undef ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
session: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | return $self->_param( undef, 'session', $session ); | |||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | sub session_id ( $self, $id = undef ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
session_id: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | return $self->session->{sessionId}; | |||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | sub remote_conn ( $self, $conn = undef ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
remote_conn: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | return $self->_param( undef, 'remote_conn', $conn ); | |||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | sub error_handler ( $self, $handler = undef ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
error_handler: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | ▶ | $handler //= sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | my ( undef, $msg, $params ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | die "Internal Death: $msg\n" . Dumper($params); | |||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | }; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$handler //= sub {
my(undef, $msg, $params) = @_;
die "Internal Death: $msg\n" . Dumper($params);
}
MC/DC0%0/2
$handler //= sub {
my(undef, $msg, $params) = @_;
die "Internal Death: $msg\n" . Dumper($params);
}
$handler
sub {
my(undef, $msg, $params) = @_;
die "Internal Death: $msg\n" . Dumper($params);
}
Truth table0%0/3
A //= B
A= $handlerB= sub {
my(undef, $msg, $params) = @_;
die "Internal Death: $msg\n" . Dumper($params);
}
| |||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | die "error handler must be subroutine ref" unless ref $handler eq 'CODE'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | return $self->_param( sub { }, 'error_handler', $handler ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | sub ua ( $self, $ua = undef ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ua: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | return $self->_param( undef, 'ua', $ua ); | |||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | sub commands ($self) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
commands: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | $self->{commands} //= Selenium::Client::Commands->new; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"commands"} //= "Selenium::Client::Commands"->new
MC/DC0%0/2
$self->{"commands"} //= "Selenium::Client::Commands"->new
$self->{"commands"}
"Selenium::Client::Commands"->new
Truth table0%0/3
A //= B
A= $self->{"commands"}B= "Selenium::Client::Commands"->new
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | return $self->{commands}; | |||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | sub auto_close ( $self, $ac = undef ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
auto_close: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | return $self->_param( JSON::true, 'auto_close', $ac ? JSON::true : JSON::false ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | # Only here for compatibility | ||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | sub pid { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pid: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | return $$; | |||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | #TODO these bools may need JSONizing | ||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | ▶ | sub javascript ( $self, $js = undef ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
javascript: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | return $self->_param( JSON::true, 'javascript', $js ? JSON::true : JSON::false ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | ▶ | sub accept_ssl_certs ( $self, $ssl = undef ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
accept_ssl_certs: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | return $self->_param( JSON::true, 'accept_ssl_certs', $ssl ? JSON::true : JSON::false ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | sub proxy ( $self, $proxy = undef ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
proxy: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | ▶ | if ($proxy) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | die "Proxy must be a hashref" unless ref $proxy eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | if ( $proxy->{proxyType} =~ /^pac$/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | if ( not defined $proxy->{proxyAutoconfigUrl} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | die "proxyAutoconfigUrl not provided\n"; | |||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||
| 123 | elsif ( not( $proxy->{proxyAutoconfigUrl} =~ /^(http|file)/g ) ) { | ||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | die "proxyAutoconfigUrl should be of format http:// or file://"; | |||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | if ( $proxy->{proxyAutoconfigUrl} =~ /^file/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | my $pac_url = $proxy->{proxyAutoconfigUrl}; | |||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | my $file = $pac_url; | |||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | $file =~ s{^file://}{}; | |||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | if ( !-e $file ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | die "proxyAutoConfigUrl file does not exist: '$pac_url'"; | |||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | return $self->_param( undef, 'proxy', $proxy ); | |||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | #TODO what the hell is the difference between these two in practice? | ||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | sub extra_capabilities ( $self, $caps = undef ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
extra_capabilities: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | return $self->_param( undef, 'extra_capabilities', $caps ); | |||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | sub desired_capabilities ( $self, $caps = undef ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
desired_capabilities: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | return $self->_param( undef, 'desired_capabilities', $caps ); | |||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | sub capabilities ( $self, $caps = undef ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
capabilities: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | return $self->_param( undef, 'desired_capabilities', $caps ); | |||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | ▶ | sub firefox_profile ( $self, $profile = undef ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
firefox_profile: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | if ($profile) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | unless ( Scalar::Util::blessed($profile) && $profile->isa('Selenium::Firefox::Profile') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/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 table0%0/3
A and B
A= builtin::blessed($profile)B= $profile->isa("Selenium::Firefox::Profile")
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | die "firefox_profile must be a Selenium::Firefox::Profile"; | |||||||||||||||||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | return $self->_param( undef, 'firefox_profile', $profile ); | |||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | ▶ | sub debug ( $self, $debug = undef ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
debug: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | return $self->_param( 0, 'debug', $debug ); | |||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | sub headless ( $self, $headless = 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
headless: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | return $self->_param( 0, 'headless', $headless ); | |||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | ▶ | sub inner_window_size ( $self, $size = undef ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inner_window_size: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | if ( ref $size eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | die "inner_window_size must have two elements: [ height, width ]" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | unless scalar @$size == 2; | ||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | foreach my $dim (@$size) { | |||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | die 'inner_window_size only accepts integers, not: ' . $dim | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | unless Scalar::Util::looks_like_number($dim); | ||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | return $self->_param( undef, 'inner_window_size', $size ); | |||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | # TODO do we care about this at all? | ||||||||||||||||||||||||||||||||||||||||||
| 186 | # At the time of writing, Geckodriver uses a different endpoint than | ||||||||||||||||||||||||||||||||||||||||||
| 187 | # the java bindings for executing synchronous and asynchronous | ||||||||||||||||||||||||||||||||||||||||||
| 188 | # scripts. As a matter of fact, Geckodriver does conform to the W3C | ||||||||||||||||||||||||||||||||||||||||||
| 189 | # spec, but as are bound to support both while the java bindings | ||||||||||||||||||||||||||||||||||||||||||
| 190 | # transition to full spec support, we need some way to handle the | ||||||||||||||||||||||||||||||||||||||||||
| 191 | # difference. | ||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | sub _execute_script_suffix ( $self, $suffix = undef ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_execute_script_suffix: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | return $self->_param( undef, '_execute_script_suffix', $suffix ); | |||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | #TODO generate find_element_by crap statically | ||||||||||||||||||||||||||||||||||||||||||
| 197 | #with 'Selenium::Remote::Finders'; | ||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | sub new ( $class, %options ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | my $self = bless( { %options, is_wd3 => 1 }, $class ); | |||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||
| 202 | # map the options | ||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | my %optmap = ( | |||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | # SRD / common options | ||||||||||||||||||||||||||||||||||||||||||
| 206 | browser_name => 'browser', | ||||||||||||||||||||||||||||||||||||||||||
| 207 | debug => 'debug', | ||||||||||||||||||||||||||||||||||||||||||
| 208 | remote_server_addr => 'host', | ||||||||||||||||||||||||||||||||||||||||||
| 209 | port => 'port', | ||||||||||||||||||||||||||||||||||||||||||
| 210 | auto_close => 'auto_close', | ||||||||||||||||||||||||||||||||||||||||||
| 211 | ua => 'ua', | ||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | # Stuff that does not work from SRD: | ||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | # version - good luck getting random versions of browsers to work!!! LOL!!!! | ||||||||||||||||||||||||||||||||||||||||||
| 216 | # platform - TODO currently unsupported | ||||||||||||||||||||||||||||||||||||||||||
| 217 | # accept_ssl_certs - NOT IN THE SPEC, U CAN POUND SAND IF U AINT AN INTERMEDIATE SIGNER, HA HA HA HA. | ||||||||||||||||||||||||||||||||||||||||||
| 218 | # firefox_provile - NOT IN THE SPEC | ||||||||||||||||||||||||||||||||||||||||||
| 219 | # javascript - piss off, use mechanize if you want this off | ||||||||||||||||||||||||||||||||||||||||||
| 220 | # default_finder - TODO currently unsupported | ||||||||||||||||||||||||||||||||||||||||||
| 221 | # session_id - TODO currently unsupported | ||||||||||||||||||||||||||||||||||||||||||
| 222 | # pageLoadStrategy - NOT IN THE SPEC | ||||||||||||||||||||||||||||||||||||||||||
| 223 | # extra_capabilities - NOT IN THE SPEC | ||||||||||||||||||||||||||||||||||||||||||
| 224 | # base_url - TODO currently unsupported | ||||||||||||||||||||||||||||||||||||||||||
| 225 | # inner window size - XXX well, this function doesn't even work on selenium 4 so we *can't* support it. | ||||||||||||||||||||||||||||||||||||||||||
| 226 | # error_handler - TODO will probably have to shim this, may not be possible idk | ||||||||||||||||||||||||||||||||||||||||||
| 227 | # webelement_class- just no. | ||||||||||||||||||||||||||||||||||||||||||
| 228 | # proxy - TODO currently unsupported, not sure this is even in the spec. | ||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||
| 230 | # SCD exclusive options | ||||||||||||||||||||||||||||||||||||||||||
| 231 | driver => 'driver', | ||||||||||||||||||||||||||||||||||||||||||
| 232 | driver_version => 'driver_version', | ||||||||||||||||||||||||||||||||||||||||||
| 233 | headless => 'headless', | ||||||||||||||||||||||||||||||||||||||||||
| 234 | fatal => 'fatal', | ||||||||||||||||||||||||||||||||||||||||||
| 235 | post_callbacks => 'post_callbacks', | ||||||||||||||||||||||||||||||||||||||||||
| 236 | normalize => 'normalize', | ||||||||||||||||||||||||||||||||||||||||||
| 237 | prefix => 'prefix', | ||||||||||||||||||||||||||||||||||||||||||
| 238 | scheme => 'scheme', | ||||||||||||||||||||||||||||||||||||||||||
| 239 | nofetch => 'nofetch', | ||||||||||||||||||||||||||||||||||||||||||
| 240 | client_dir => 'client_dir', | ||||||||||||||||||||||||||||||||||||||||||
| 241 | post_callbacks => 'post_callbacks', # TODO see error_handler note above | ||||||||||||||||||||||||||||||||||||||||||
| 242 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | my $driver = $self->driver(); | |||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | ▶ | if ( !$driver ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | my %actual; | |||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | foreach my $option ( keys(%options) ) { | |||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | ▶ | if ( !exists $optmap{$option} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | warn "Passed unsupported option '$option', which has been dropped."; | |||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | $actual{ $optmap{$option} } = $options{$option}; | |||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||
| 256 | # Set the version explicitly, as these are conflicting names between the two modules. | ||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | $actual{version} = 'stable'; | |||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | $driver = Selenium::Client->new(%actual); | |||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | $self->driver($driver); | |||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | my $status = $driver->Status(); | |||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | ▶ | die "Got bad status back from server!" unless $status->{ready}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | if ( !$self->session ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | ▶ | if ( $self->desired_capabilities ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | $self->new_desired_session( $self->desired_capabilities ); | |||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||
| 269 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 270 | # Connect to remote server & establish a new session | ||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | $self->new_session( $self->extra_capabilities ); | |||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | ▶ | if ( !( defined $self->session ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | die "Could not establish a session with the remote server\n"; | |||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | ▶ | if ( $self->inner_window_size ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | my $size = $self->inner_window_size; | |||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | $self->set_inner_window_size(@$size); | |||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||
| 284 | #Set debug if needed | ||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | $self->debug_on() if $self->debug; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | ▶ | sub new_from_caps ( $self, %args ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new_from_caps: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | ▶ | if ( not exists $args{desired_capabilities} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | $args{desired_capabilities} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | return $self->new(%args); | |||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | #TODO do we need this? | ||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | sub DESTROY { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | # This is an internal method used the Driver & is not supposed to be used by | ||||||||||||||||||||||||||||||||||||||||||
| 302 | # end user. This method is used by Driver to set up all the parameters | ||||||||||||||||||||||||||||||||||||||||||
| 303 | # (url & JSON), send commands & receive processed response from the server. | ||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | ▶ | sub _execute_command ( $self, $res, $params = {} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_execute_command: not called CC=10 SCAR=47.0
| |||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | ▶ | print "Executing $res->{command}\n" if $self->{debug}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||
| 307 | #XXX Sometimes the params are in $res. Whee. | ||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | foreach my $key ( keys(%$res) ) { | |||||||||||||||||||||||||||||||||||||||||
| 309 | 0 | ▶ | $params->{$key} = $res->{$key} unless grep { $key eq $_ } qw{command sessionid elementid}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | ▶ | my $macguffin = $self->commands->needs_driver( $res->{command} ) ? $self->driver : $self->session; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | ▶ | $macguffin = $self->commands->needs_scd( $res->{command} ) ? $self : $macguffin; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | ▶ | die "Could not acquire driver/session!" unless $macguffin; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | local $@; | |||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | my $result; | |||||||||||||||||||||||||||||||||||||||||
| 317 | eval { | ||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | my $resp = $self->commands->request( $macguffin, $res->{command}, $params ); | |||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | $result = $self->commands->parse_response( $macguffin, $res->{command}, $resp ); | |||||||||||||||||||||||||||||||||||||||||
| 320 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | ▶ | } or do { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | ▶ | return $self->error_handler->( $macguffin, $@, { %$params, %$res } ) if $self->error_handler; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | die $@; | |||||||||||||||||||||||||||||||||||||||||
| 324 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | return $result; | |||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | ▶ | sub has_javascript { 1 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_javascript: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | ▶ | sub new_session ( $self, $extra_capabilities = {} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new_session: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | ▶ | $extra_capabilities //= {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$extra_capabilities //= {}
MC/DC0%0/1
$extra_capabilities //= {}
$extra_capabilities
Truth table0%0/2
A
A= $extra_capabilities
| |||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | ▶ | my $caps = { | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->version // ""
MC/DC0%0/1
$self->version // ""
$self->version
Truth table0%0/2
A
A= $self->version
| |||||||||||||||||||||||||||||||||||||||||||
| 333 | 'platformName' => $self->platform, | ||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||
| 335 | #'javascriptEnabled' => $self->javascript, | ||||||||||||||||||||||||||||||||||||||||||
| 336 | 'version' => $self->version // '', | ||||||||||||||||||||||||||||||||||||||||||
| 337 | 'acceptInsecureCerts' => $self->accept_ssl_certs, | ||||||||||||||||||||||||||||||||||||||||||
| 338 | %$extra_capabilities, | ||||||||||||||||||||||||||||||||||||||||||
| 339 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | $caps->{browserName} //= $self->browser_name; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$caps->{"browserName"} //= $self->browser_name
MC/DC0%0/2
$caps->{"browserName"} //= $self->browser_name
$caps->{"browserName"}
$self->browser_name
Truth table0%0/3
A //= B
A= $caps->{"browserName"}B= $self->browser_name
| |||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | ▶ | if ( defined $self->proxy ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | $caps->{proxy} = $self->proxy; | |||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | if ( $caps->{browserName} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$caps->{"browserName"} and $caps->{"browserName"} =~ /firefox/i and $self->firefox_profile
$caps->{"browserName"} and $caps->{"browserName"} =~ /firefox/i
MC/DC0%0/3
$caps->{"browserName"} and $caps->{"browserName"} =~ /firefox/i and $self->firefox_profile
$caps->{"browserName"}
$caps->{"browserName"} =~ /firefox/i
$self->firefox_profile
Truth table0%0/4
A and B and C
A= $caps->{"browserName"}B= $caps->{"browserName"} =~ /firefox/iC= $self->firefox_profile
| |||||||||||||||||||||||||||||||||||||||||||
| 348 | && $caps->{browserName} =~ /firefox/i | ||||||||||||||||||||||||||||||||||||||||||
| 349 | && $self->firefox_profile ) { | ||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | $caps->{firefox_profile} = $self->firefox_profile->_encode; | |||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | my %options = ( driver => 'auto', browser => $self->browser_name, debug => $self->debug, headless => $self->headless, capabilities => $caps ); | |||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | return $self->_request_new_session( \%options ); | |||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | ▶ | sub new_desired_session { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new_desired_session: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | my ( $self, $caps ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | return $self->new_session($caps); | |||||||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | ▶ | sub _request_new_session { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_request_new_session: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | my ( $self, $args ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | my $ret = $self->_execute_command( { command => 'newSession' }, $args->{capabilities} ); | |||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | my ( $capabilities, $session ) = ( $ret->{capabilities}, $ret->{session} ); | |||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||
| 369 | #die "Failed to get caps back from newSession" unless $capabilities->isa("Selenium::Capabilities"); | ||||||||||||||||||||||||||||||||||||||||||
| 370 | #die "Failed to get session back from newSession" unless $session->isa("Selenium::Session"); | ||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | $self->session($session); | |||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | $self->capabilities($capabilities); | |||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | ▶ | sub is_webdriver_3 { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_webdriver_3: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | return $self->{is_wd3}; | |||||||||||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | ▶ | sub debug_on ($self) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
debug_on: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | $self->{debug} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | $self->driver->{debug} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | ▶ | sub debug_off { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
debug_off: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | $self->{debug} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 390 | 0 | $self->driver->{debug} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | ▶ | sub get_sessions { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_sessions: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | return $self->driver->{sessions}; | |||||||||||||||||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | ▶ | sub get_capabilities { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_capabilities: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | return $self->capabilities; | |||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||
| 403 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||
| 405 | __END__ | ||||||||||||||||||||||||||||||||||||||||||