lib/Selenium/Client/WebElement.pm

filter: Statementstmt 48.7% 20 / 41 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 46.1% 6 / 13 Podpod 60.0% 3 / 5 totaltotal 38.6% 29 / 75 CC 11 SCAR 22.4
CC
11
Cov
38%
_param
20.0
_execute_command
20.0
element
6.0
CRAP 9.4
« lib/Selenium/Driver/Chrome.pm ↑ Summary lib/Selenium/Driver/Safari.pm »
1 package Selenium::Client::WebElement;
2 2 $Selenium::Client::WebElement::VERSION = '2.01';
3 # ABSTRACT: Representation of an HTML Element used by Selenium Client Driver
4  
5 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 ▶use parent qw{Selenium::Remote::WebElement};
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 ▶no warnings qw{experimental};
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use feature qw{signatures};
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 2 ▶use Carp::Always;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15  
16 0 ▶sub _param ( $self, $default, $param, $value = undef ) {
Subroutine _param: not called CC=4 SCAR=30.0
17 0 ▶ $self->{$param} //= $default;
Condition0%0/3
$self->{$param} //= $default
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->{$param} //= $default
$self->{$param} $default
Truth table0%0/3
A //= B
A= $self->{$param}B= $default
ABresult
1X1
011
000
18 0 ▶ $self->{$param} = $value if defined $value;
Branch: 1 branch
BranchTrueFalseTotal
if defined $value 0 0 0
19 0 return $self->{$param};
20 }
21  
22 0 ▶sub element ( $self, $element = undef ) {
Subroutine element: not called CC=2 SCAR=17.9
Pod undocumented
23 0 return $self->_param( undef, 'element', $element );
24 }
25  
26 0 ▶sub driver ( $self, $driver = undef ) {
Subroutine driver: not called CC=2 SCAR=17.9
Pod documented
27 0 return $self->_param( undef, 'driver', $driver );
28 }
29  
30 0 ▶sub session ( $self, $session = undef ) {
Subroutine session: not called CC=2 SCAR=17.9
Pod undocumented
31 0 return $self->_param( undef, 'session', $session );
32 }
33  
34 0 ▶sub new ( $class, %options ) {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
35 0 my $self = bless( $options{id}, $class );
36 0 $self->id( $self->{elementid} );
37 0 $self->driver( $options{driver} );
38 0 $self->session( $options{driver}->session );
39 0 return $self;
40 }
41  
42 0 ▶sub id ( $self, $value = undef ) {
Subroutine id: not called CC=2 SCAR=17.9
Pod documented
43 0 return $self->_param( undef, 'id', $value );
44 }
45  
46 # We need to inject the element ID due to this nonstandard wrapper.
47 0 ▶sub _execute_command ( $self, $res, $params = {} ) {
Subroutine _execute_command: not called CC=4 SCAR=30.0
48  
49 #XXX sigh, some day spec authors will stop LYING
50 0 ▶ $params->{propertyname} //= delete $params->{property_name} // delete $res->{property_name};
Condition0%0/6
$params->{"propertyname"} //= delete $params->{"property_name"} // delete $res->{"property_name"}
l!l&&r!l&&!r
000
delete $params->{"property_name"} // delete $res->{"property_name"}
l!l&&r!l&&!r
000
MC/DC0%0/3
$params->{"propertyname"} //= delete $params->{"property_name"} // delete $res->{"property_name"}
$params->{"propertyname"} delete $params->{"property_name"} delete $res->{"property_name"}
Truth table0%0/4
A //= B // C
A= $params->{"propertyname"}B= delete $params->{"property_name"}C= delete $res->{"property_name"}
ABCresult
1XX1
01X1
0011
0000
51  
52 0 my $params_modified = {
53 %$params,
54 elementid => $self->id,
55 };
56 0 return $self->driver->_execute_command( $res, $params_modified );
57 }
58  
59 2 1;
60  
61 __END__
« lib/Selenium/Driver/Chrome.pm ↑ Summary lib/Selenium/Driver/Safari.pm »