Selenium/Firefox.pm

filter: Statementstmt 50.7% 32 / 63 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 46.6% 7 / 15 Podpod 100% 2 / 2 totaltotal 43.6% 41 / 94 CC 8 SCAR 18.6
CC
8
Cov
42%
set_context
20.0
__ANON__
6.0
_build__binary_args
6.0
CRAP 6.4
« Selenium/Remote/Mock/RemoteConnection.pm ↑ Summary Selenium/Remote/Commands.pm »
1 package Selenium::Firefox;
2 3 $Selenium::Firefox::VERSION = '1.50';
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 # ABSTRACT: Use FirefoxDriver without a Selenium server
7 3 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use Selenium::Firefox::Binary qw/firefox_path/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 use Selenium::CanStartBinary::FindBinary
11 3 ▶ qw/coerce_simple_binary coerce_firefox_binary/;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 3 extends 'Selenium::Remote::Driver';
13  
14  
15 has '+browser_name' => (
16 is => 'ro',
17 2 ▶ default => sub { 'firefox' }
Subroutine __ANON__: called CC=1 SCAR=0.0
18 3 );
19  
20  
21 has 'binary' => (
22 is => 'lazy',
23 coerce => \&coerce_simple_binary,
24 0 ▶ default => sub { 'geckodriver' },
Subroutine __ANON__: not called CC=1 SCAR=6.9
25 3 predicate => 1
26 );
27  
28  
29 has 'binary_port' => (
30 is => 'lazy',
31 0 ▶ default => sub { 9090 }
Subroutine __ANON__: not called CC=1 SCAR=6.9
32 3 );
33  
34  
35 has '_binary_args' => (
36 is => 'lazy',
37 0 ▶ builder => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
Subroutine _build__binary_args: not called CC=2 SCAR=17.9
38 0 my ($self) = @_;
39  
40 0 ▶ if ( $self->marionette_enabled ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->marionette_enabled) { } 0 0 0
if ($self->marionette_enabled) { } 0 0 0
41 0 my $args =
42 ' --port '
43 . $self->port
44 . ' --marionette-port '
45 . $self->marionette_port
46 . ' --binary "'
47 . $self->firefox_binary . '"';
48  
49 0 return $args;
50 }
51 else {
52 0 return ' -no-remote';
53 }
54 }
55 3 );
56  
57 has '+wd_context_prefix' => (
58 is => 'ro',
59 0 ▶ default => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
60 0 my ($self) = @_;
61  
62 0 ▶ if ( $self->marionette_enabled ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->marionette_enabled) { } 0 0 0
63 0 return '';
64 }
65 else {
66 0 return '/hub';
67 }
68  
69 }
70 3 );
71  
72  
73 has 'marionette_binary_port' => (
74 is => 'lazy',
75 0 ▶ default => sub { 2828 }
Subroutine __ANON__: not called CC=1 SCAR=6.9
76 3 );
77  
78  
79 3 has 'marionette_enabled' => (
80 is => 'lazy',
81 default => 1
82 );
83  
84  
85 3 has 'firefox_binary' => (
86 is => 'lazy',
87 coerce => \&coerce_firefox_binary,
88 predicate => 1,
89 builder => 'firefox_path'
90 );
91  
92 3 has '_execute_script_suffix' => (
93 is => 'lazy',
94 default => 'Gecko'
95 );
96  
97  
98 0 ▶sub get_context {
Subroutine get_context: not called CC=2 SCAR=17.9
Pod documented
99 0 my $self = shift;
100  
101 0 ▶ if ( $self->_is_old_ff ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_is_old_ff) 0 0 0
102 0 return 0;
103 }
104 0 my $res = { 'command' => 'getContext' };
105 0 return $self->_execute_command($res);
106 }
107  
108  
109 0 ▶sub set_context {
Subroutine set_context: not called CC=4 SCAR=30.0
Pod documented
110 0 my ( $self, $context ) = @_;
111  
112 0 ▶ if ( $self->_is_old_ff ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_is_old_ff) 0 0 0
113 0 return 0;
114 }
115 0 ▶ if ( not defined $context ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $context) 0 0 0
116 0 croak "Expecting context";
117 }
118 0 ▶ if ( $context !~ m/chrome|content/i ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($context =~ /chrome|content/i) 0 0 0
119 0 croak "Expecting context value: chrome or content";
120 }
121 0 my $res = { 'command' => 'setContext' };
122 0 return $self->_execute_command( $res, { context => $context } );
123 }
124  
125 3 with 'Selenium::CanStartBinary';
126  
127  
128 3 1;
129  
130 __END__
« Selenium/Remote/Mock/RemoteConnection.pm ↑ Summary Selenium/Remote/Commands.pm »