File Coverage

blib/lib/Selenium/Driver/Gecko.pm
Criterion Covered Total %
statement 20 32 62.5
branch 0 2 0.0
condition 0 7 0.0
subroutine 7 8 87.5
pod 1 1 100.0
total 28 50 56.0


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