lib/Selenium/Driver/Chrome.pm

filter: Statementstmt 70.9% 22 / 31 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 77.7% 7 / 9 Podpod 100% 1 / 1 totaltotal 57.6% 30 / 52 CC 5 SCAR 25.0
CC
5
Cov
56%
build_spawn_opts
30.0
_driver
2.0
BEGIN
1.0
CRAP 12.2
« lib/Selenium/Driver/Gecko.pm ↑ Summary lib/Selenium/Driver/Safari.pm »
1 package Selenium::Driver::Chrome;
2 2 $Selenium::Driver::Chrome::VERSION = '1.06';
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use v5.28;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 ▶no warnings 'experimental';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use feature qw/signatures/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 ▶use Carp qw{confess};
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use File::Which;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 #ABSTRACT: Tell Selenium::Client how to spawn chromedriver
15  
16  
17 sub _driver {
18 0 ▶ return 'chromedriver';
Subroutine _driver: not called CC=1 SCAR=6.9
19 }
20  
21 ▶sub build_spawn_opts($class,$object) {
Subroutine build_spawn_opts: not called CC=5 SCAR=34.0
Pod documented
22 0 $object->{driver_class} = $class;
23 0 ▶ $object->{driver_version} //= '';
Condition0%0/2
$object->{"driver_version"} //= ""
l!l
00
MC/DC0%0/1
$object->{"driver_version"} //= ""
$object->{"driver_version"}
Truth table0%0/2
A
A= $object->{"driver_version"}
Aresult
11
00
24 0 ▶ $object->{log_file} //= "$object->{client_dir}/perl-client/selenium-$object->{port}.log";
Condition0%0/2
$object->{"log_file"} //= qq[$object->{"client_dir"}/perl-client/selenium-$object->{"port"}.log]
l!l
00
MC/DC0%0/1
$object->{"log_file"} //= qq[$object->{"client_dir"}/perl-client/selenium-$object->{"port"}.log]
$object->{"log_file"}
Truth table0%0/2
A
A= $object->{"log_file"}
Aresult
11
00
25 0 $object->{driver_file} = File::Which::which($class->_driver());
26 0 ▶ die "Could not find driver!" unless $object->{driver_file};
Branch: 1 branch
BranchTrueFalseTotal
unless $object->{"driver_file"} 0 0 0
27  
28 0 my @config = ('--port='.$object->{port});
29  
30 # Build command string
31 $object->{command} //= [
32 $object->{driver_file},
33 0 ▶ @config,
Condition0%0/2
$object->{"command"} //= [$object->{"driver_file"}, @config]
l!l
00
MC/DC0%0/1
$object->{"command"} //= [$object->{"driver_file"}, @config]
$object->{"command"}
Truth table0%0/2
A
A= $object->{"command"}
Aresult
11
00
34 ];
35 0 return $object;
36 }
37  
38 2 1;
39  
40 __END__
41  
42 =pod
43  
44 =encoding UTF-8
45  
46 =head1 NAME
47  
48 Selenium::Driver::Chrome - Tell Selenium::Client how to spawn chromedriver
49  
50 =head1 VERSION
51  
52 version 1.06
53  
54 =head1 Mode of Operation
55  
56 Spawns a chromedriver server on the provided port (which the caller will assign randomly)
57 Relies on chromedriver being in your $PATH
58 Pipes log output to ~/.selenium/perl-client/$port.log
59  
60 =head1 SUBROUTINES
61  
62 =head2 build_spawn_opts($class,$object)
63  
64 Builds a command string which can run the driver binary.
65 All driver classes must build this.
66  
67 =head1 AUTHOR
68  
69 George S. Baugh <george@troglodyne.net>
70  
71 =head1 COPYRIGHT AND LICENSE
72  
73 This software is Copyright (c) 2023 by George S. Baugh.
74  
75 This is free software, licensed under:
76  
77 The MIT (X11) License
78  
79 =cut
« lib/Selenium/Driver/Gecko.pm ↑ Summary lib/Selenium/Driver/Safari.pm »