File Coverage

blib/lib/Selenium/Driver/WinApp.pm
Criterion Covered Total %
statement 18 32 56.2
branch 0 2 0.0
condition 0 7 0.0
subroutine 6 8 75.0
pod 1 1 100.0
total 25 50 50.0


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