File Coverage

blib/lib/Selenium/Driver/Chrome.pm
Criterion Covered Total %
statement 20 33 60.6
branch 0 2 0.0
condition 0 7 0.0
subroutine 7 9 77.7
pod 1 1 100.0
total 28 52 53.8


line stmt bran cond sub pod time code
1             package Selenium::Driver::Chrome;
2             $Selenium::Driver::Chrome::VERSION = '2.01';
3 2     2   268218 use strict;
  2         5  
  2         2112  
4 2     2   20 use warnings;
  2         5  
  2         167  
5              
6 2     2   32 use v5.28;
  2         30  
7              
8 2     2   13 no warnings 'experimental';
  2         5  
  2         172  
9 2     2   15 use feature qw/signatures/;
  2         4  
  2         397  
10              
11 2     2   18 use Carp qw{confess};
  2         5  
  2         186  
12 2     2   1335 use File::Which;
  2         3745  
  2         678  
13              
14             #ABSTRACT: Tell Selenium::Client how to spawn chromedriver
15              
16              
17             sub _driver {
18 0     0     return 'chromedriver';
19             }
20              
21 0     0 1   sub build_spawn_opts ( $class, $object ) {
  0            
  0            
  0            
22 0           $object->{driver_class} = $class;
23 0   0       $object->{driver_version} //= '';
24 0   0       $object->{log_file} //= "$object->{client_dir}/perl-client/selenium-$object->{port}.log";
25 0           $object->{driver_file} = File::Which::which( $class->_driver() );
26 0 0         die "Could not find driver!" unless $object->{driver_file};
27              
28 0           my @config = ( '--port=' . $object->{port} );
29              
30             # Build command string
31             $object->{command} //= [
32             $object->{driver_file},
33 0   0       @config,
34             ];
35 0           return $object;
36             }
37              
38             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 2.01
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 SEE ALSO
68              
69             Please see those modules/websites for more information related to this module.
70              
71             =over 4
72              
73             =item *
74              
75             L<Selenium::Client|Selenium::Client>
76              
77             =back
78              
79             =head1 BUGS
80              
81             Please report any bugs or feature requests on the bugtracker website
82             L<https://github.com/troglodyne-internet-widgets/selenium-client-perl/issues>
83              
84             When submitting a bug or request, please include a test-file or a
85             patch to an existing test-file that illustrates the bug or desired
86             feature.
87              
88             =head1 AUTHORS
89              
90             Current Maintainers:
91              
92             =over 4
93              
94             =item *
95              
96             George S. Baugh <george@troglodyne.net>
97              
98             =back
99              
100             =head1 COPYRIGHT AND LICENSE
101              
102             Copyright (c) 2024 Troglodyne LLC
103              
104              
105             Permission is hereby granted, free of charge, to any person obtaining a copy
106             of this software and associated documentation files (the "Software"), to deal
107             in the Software without restriction, including without limitation the rights
108             to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
109             copies of the Software, and to permit persons to whom the Software is
110             furnished to do so, subject to the following conditions:
111             The above copyright notice and this permission notice shall be included in all
112             copies or substantial portions of the Software.
113             THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
114             IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
115             FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
116             AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
117             LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
118             OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
119             SOFTWARE.
120              
121             =cut