| 1 | package Selenium::Driver::Gecko; | ||||||||||||
| 2 | 1 | $Selenium::Driver::Gecko::VERSION = '1.06'; | |||||||||||
| 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 v5.28; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | |||||||||||||
| 8 | 1 | ▶ | no warnings 'experimental'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | 1 | ▶ | use feature qw/signatures/; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | |||||||||||||
| 11 | 1 | ▶ | use Carp qw{confess}; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 12 | 1 | ▶ | use File::Which; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 13 | |||||||||||||
| 14 | #ABSTRACT: Tell Selenium::Client how to spawn geckodriver | ||||||||||||
| 15 | |||||||||||||
| 16 | |||||||||||||
| 17 | ▶ | sub build_spawn_opts($class,$object) { | |||||||||||
|
Subroutine
build_spawn_opts: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||
| 18 | 0 | $object->{driver_class} = $class; | |||||||||||
| 19 | 0 | ▶ | $object->{driver_version} //= ''; | ||||||||||
|
Condition0%0/2
$object->{"driver_version"} //= ""
MC/DC0%0/1
$object->{"driver_version"} //= ""
$object->{"driver_version"}
Truth table0%0/2
A
A= $object->{"driver_version"}
| |||||||||||||
| 20 | 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]
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"}
| |||||||||||||
| 21 | 0 | $object->{driver_file} = File::Which::which('geckodriver'); | |||||||||||
| 22 | 0 | ▶ | die "Could not find driver!" unless $object->{driver_file}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 23 | |||||||||||||
| 24 | 0 | my @config = ('--port', $object->{port}); | |||||||||||
| 25 | |||||||||||||
| 26 | # Build command string | ||||||||||||
| 27 | $object->{command} //= [ | ||||||||||||
| 28 | $object->{driver_file}, | ||||||||||||
| 29 | 0 | ▶ | @config, | ||||||||||
|
Condition0%0/2
$object->{"command"} //= [$object->{"driver_file"}, @config]
MC/DC0%0/1
$object->{"command"} //= [$object->{"driver_file"}, @config]
$object->{"command"}
Truth table0%0/2
A
A= $object->{"command"}
| |||||||||||||
| 30 | ]; | ||||||||||||
| 31 | 0 | return $object; | |||||||||||
| 32 | } | ||||||||||||
| 33 | |||||||||||||
| 34 | 1 | 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 1.06 | ||||||||||||
| 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 AUTHOR | ||||||||||||
| 64 | |||||||||||||
| 65 | George S. Baugh <george@troglodyne.net> | ||||||||||||
| 66 | |||||||||||||
| 67 | =head1 COPYRIGHT AND LICENSE | ||||||||||||
| 68 | |||||||||||||
| 69 | This software is Copyright (c) 2023 by George S. Baugh. | ||||||||||||
| 70 | |||||||||||||
| 71 | This is free software, licensed under: | ||||||||||||
| 72 | |||||||||||||
| 73 | The MIT (X11) License | ||||||||||||
| 74 | |||||||||||||
| 75 | =cut | ||||||||||||