| 1 | package Selenium::Remote::WebElement; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 28 | $Selenium::Remote::WebElement::VERSION = '1.50'; | |||||||||||||||||||||||||||||||||||||||||
| 3 | # ABSTRACT: Representation of an HTML Element used by Selenium Remote Driver | ||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 28 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 28 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 28 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 28 | ▶ | use Carp qw(carp croak); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | has 'id' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 13 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 14 | required => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 15 | 79 | ▶ | coerce => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 79 | my ($value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 17 | 79 | ▶ | if ( ref($value) eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 77 | ▶ | if ( exists $value->{ELEMENT} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | # The JSONWireProtocol web element object looks like | ||||||||||||||||||||||||||||||||||||||||||
| 21 | # | ||||||||||||||||||||||||||||||||||||||||||
| 22 | # { "ELEMENT": $INTEGER_ID } | ||||||||||||||||||||||||||||||||||||||||||
| 23 | 76 | return $value->{ELEMENT}; | |||||||||||||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||||||||||||
| 25 | elsif ( exists $value->{'element-6066-11e4-a52e-4f735466cecf'} ) { | ||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | # but the WebDriver spec web element uses a magic | ||||||||||||||||||||||||||||||||||||||||||
| 28 | # string. See the spec for more information: | ||||||||||||||||||||||||||||||||||||||||||
| 29 | # | ||||||||||||||||||||||||||||||||||||||||||
| 30 | # https://www.w3.org/TR/webdriver/#elements | ||||||||||||||||||||||||||||||||||||||||||
| 31 | 1 | return $value->{'element-6066-11e4-a52e-4f735466cecf'}; | |||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||
| 33 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | croak | |||||||||||||||||||||||||||||||||||||||||
| 35 | 'When passing in an object to the WebElement id attribute, it must have at least one of the ELEMENT or element-6066-11e4-a52e-4f735466cecf keys.'; | ||||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||
| 38 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 2 | return $value; | |||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||
| 42 | 28 | ); | |||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | 28 | has 'driver' => ( | |||||||||||||||||||||||||||||||||||||||||
| 45 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 46 | required => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 47 | handles => [qw(_execute_command)], | ||||||||||||||||||||||||||||||||||||||||||
| 48 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | sub child { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
child: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | return $_[0]->{driver}->find_child_element(@_); | |||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | sub children { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
children: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | return $_[0]->{driver}->find_child_elements(@_); | |||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | 9 | ▶ | sub click { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
click: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 9 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 62 | 9 | my $res = { 'command' => 'clickElement', 'id' => $self->id }; | |||||||||||||||||||||||||||||||||||||||||
| 63 | 9 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | sub execute_script { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
execute_script: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | my ($self, $script, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 69 | return $self->driver->execute_script( | ||||||||||||||||||||||||||||||||||||||||||
| 70 | $script, | ||||||||||||||||||||||||||||||||||||||||||
| 71 | { 'element-6066-11e4-a52e-4f735466cecf' => $self->{id} }, | ||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | @args ); | |||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | sub execute_async_script { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
execute_async_script: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | my ($self, $script, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 77 | return $self->driver->execute_async_script( | ||||||||||||||||||||||||||||||||||||||||||
| 78 | $script, | ||||||||||||||||||||||||||||||||||||||||||
| 79 | { 'element-6066-11e4-a52e-4f735466cecf' => $self->{id} }, | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | @args ); | |||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | 1 | ▶ | sub submit { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
submit: called CC=4 SCAR=20.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 86 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 87 | 1 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->driver->{"is_wd3"} and not grep({$self->driver->browser_name eq $_;} "MicrosoftEdge")
MC/DC0%0/2
$self->driver->{"is_wd3"} and not grep({$self->driver->browser_name eq $_;} "MicrosoftEdge")
$self->driver->{"is_wd3"}
not grep({$self->driver->browser_name eq $_;} "MicrosoftEdge")
Truth table33%1/3
A and not(B)
A= $self->driver->{"is_wd3"}B= not grep({$self->driver->browser_name eq $_;} "MicrosoftEdge")
| |||||||||||||||||||||||||||||||||||||||||||
| 88 | $self->driver->{is_wd3} | ||||||||||||||||||||||||||||||||||||||||||
| 89 | && !( | ||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | grep { $self->driver->browser_name eq $_ } qw{MicrosoftEdge} | |||||||||||||||||||||||||||||||||||||||||
| 91 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 92 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 93 | { | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | if ( $self->get_tag_name() ne 'form' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | return $self->driver->execute_script( | ||||||||||||||||||||||||||||||||||||||||||
| 96 | "return arguments[0].form.submit();", | ||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | { 'element-6066-11e4-a52e-4f735466cecf' => $self->{id} } ); | |||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 100 | return $self->driver->execute_script( | ||||||||||||||||||||||||||||||||||||||||||
| 101 | "return arguments[0].submit();", | ||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | { 'element-6066-11e4-a52e-4f735466cecf' => $self->{id} } ); | |||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||
| 105 | 1 | my $res = { 'command' => 'submitElement', 'id' => $self->id }; | |||||||||||||||||||||||||||||||||||||||||
| 106 | 1 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | 3 | ▶ | sub send_keys { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
send_keys: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | 3 | my ( $self, @strings ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 112 | 3 | ▶ | croak "no keys to send" unless scalar @strings >= 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | 3 | my $res = { 'command' => 'sendKeysToElement', 'id' => $self->id }; | |||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||
| 115 | # We need to send an array of single characters to be WebDriver | ||||||||||||||||||||||||||||||||||||||||||
| 116 | # spec compatible. That is, for @strings = ('hel', 'lo'), the | ||||||||||||||||||||||||||||||||||||||||||
| 117 | # corresponding value must be ('h', 'e', 'l', 'l', 'o' ). This | ||||||||||||||||||||||||||||||||||||||||||
| 118 | # format conforms with the Spec AND works with the Selenium | ||||||||||||||||||||||||||||||||||||||||||
| 119 | # standalone server. | ||||||||||||||||||||||||||||||||||||||||||
| 120 | 3 | my $strings = join( '', map { $_ . "" } @strings ); | |||||||||||||||||||||||||||||||||||||||||
| 121 | 3 | my $params = { | |||||||||||||||||||||||||||||||||||||||||
| 122 | 'value' => [ split( '', $strings ) ], | ||||||||||||||||||||||||||||||||||||||||||
| 123 | text => $strings, | ||||||||||||||||||||||||||||||||||||||||||
| 124 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 125 | 3 | return $self->_execute_command( $res, $params ); | |||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | 4 | ▶ | sub is_selected { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_selected: called CC=4 SCAR=15.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | 4 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | 4 | ▶ | my $to_check = $self->get_tag_name() eq 'option' ? 'selected' : 'checked'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | return $self->get_property($to_check) | ||||||||||||||||||||||||||||||||||||||||||
| 134 | if $self->driver->{is_wd3} | ||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | && !( grep { $self->driver->browser_name eq $_ } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->driver->{"is_wd3"} and not grep({$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge")
MC/DC0%0/2
$self->driver->{"is_wd3"} and not grep({$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge")
$self->driver->{"is_wd3"}
not grep({$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge")
Truth table33%1/3
A and not(B)
A= $self->driver->{"is_wd3"}B= not grep({$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge")
| |||||||||||||||||||||||||||||||||||||||||||
| 136 | qw{chrome MicrosoftEdge} ); | ||||||||||||||||||||||||||||||||||||||||||
| 137 | 4 | my $res = { 'command' => 'isElementSelected', 'id' => $self->id }; | |||||||||||||||||||||||||||||||||||||||||
| 138 | 4 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | sub set_selected { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_selected: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | if ( $self->driver->{is_wd3} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | return if $self->is_selected(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | return $self->click(); | |||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | my $res = { 'command' => 'setElementSelected', 'id' => $self->id }; | |||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | 1 | ▶ | sub toggle { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
toggle: called CC=3 SCAR=14.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 155 | 1 | ▶ | if ( $self->driver->{is_wd3} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | return $self->click() unless $self->is_selected(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | return $self->driver->execute_script( | ||||||||||||||||||||||||||||||||||||||||||
| 158 | qq/ if (arguments[0].checked) { arguments[0].checked = 0 }; return arguments[0].checked; /, | ||||||||||||||||||||||||||||||||||||||||||
| 159 | { 'element-6066-11e4-a52e-4f735466cecf' => $self->{id} } | ||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||
| 162 | 1 | my $res = { 'command' => 'toggleElement', 'id' => $self->id }; | |||||||||||||||||||||||||||||||||||||||||
| 163 | 1 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | 2 | ▶ | sub is_enabled { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_enabled: called CC=5 SCAR=24.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 169 | 2 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->driver->{"is_wd3"} and not grep({$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge")
MC/DC0%0/2
$self->driver->{"is_wd3"} and not grep({$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge")
$self->driver->{"is_wd3"}
not grep({$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge")
Truth table33%1/3
A and not(B)
A= $self->driver->{"is_wd3"}B= not grep({$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge")
| |||||||||||||||||||||||||||||||||||||||||||
| 170 | $self->driver->{is_wd3} | ||||||||||||||||||||||||||||||||||||||||||
| 171 | && !( | ||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | grep { $self->driver->browser_name eq $_ } qw{chrome MicrosoftEdge} | |||||||||||||||||||||||||||||||||||||||||
| 173 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 174 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 175 | { | ||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | ▶ | return 1 if $self->get_tag_name() ne 'input'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | return $self->get_property('disabled') ? 0 : 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||
| 179 | 2 | my $res = { 'command' => 'isElementEnabled', 'id' => $self->id }; | |||||||||||||||||||||||||||||||||||||||||
| 180 | 2 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | 1 | ▶ | sub get_element_location { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_element_location: called CC=3 SCAR=15.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 185 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 186 | 1 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->driver->{"is_wd3"} and not grep({$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge")
MC/DC0%0/2
$self->driver->{"is_wd3"} and not grep({$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge")
$self->driver->{"is_wd3"}
not grep({$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge")
Truth table33%1/3
A and not(B)
A= $self->driver->{"is_wd3"}B= not grep({$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge")
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | $self->driver->{is_wd3} | ||||||||||||||||||||||||||||||||||||||||||
| 188 | && !( | ||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | grep { $self->driver->browser_name eq $_ } qw{chrome MicrosoftEdge} | |||||||||||||||||||||||||||||||||||||||||
| 190 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 191 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 192 | { | ||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | my $data = $self->get_element_rect(); | |||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | delete $data->{height}; | |||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | delete $data->{width}; | |||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | return $data; | |||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||
| 198 | 1 | my $res = { 'command' => 'getElementLocation', 'id' => $self->id }; | |||||||||||||||||||||||||||||||||||||||||
| 199 | 1 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | 1 | ▶ | sub get_size { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_size: called CC=3 SCAR=15.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 204 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 205 | 1 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->driver->{"is_wd3"} and not grep({$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge")
MC/DC0%0/2
$self->driver->{"is_wd3"} and not grep({$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge")
$self->driver->{"is_wd3"}
not grep({$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge")
Truth table33%1/3
A and not(B)
A= $self->driver->{"is_wd3"}B= not grep({$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge")
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | $self->driver->{is_wd3} | ||||||||||||||||||||||||||||||||||||||||||
| 207 | && !( | ||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | grep { $self->driver->browser_name eq $_ } qw{chrome MicrosoftEdge} | |||||||||||||||||||||||||||||||||||||||||
| 209 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 210 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 211 | { | ||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | my $data = $self->get_element_rect(); | |||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | delete $data->{x}; | |||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | delete $data->{y}; | |||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | return $data; | |||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||
| 217 | 1 | my $res = { 'command' => 'getElementSize', 'id' => $self->id }; | |||||||||||||||||||||||||||||||||||||||||
| 218 | 1 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | sub get_element_rect { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_element_rect: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | my $res = { 'command' => 'getElementRect', 'id' => $self->id }; | |||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | sub get_element_location_in_view { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_element_location_in_view: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | #XXX chrome is dopey here | ||||||||||||||||||||||||||||||||||||||||||
| 233 | return $self->driver->execute_script( | ||||||||||||||||||||||||||||||||||||||||||
| 234 | qq{ | ||||||||||||||||||||||||||||||||||||||||||
| 235 | if (typeof(arguments[0]) !== 'undefined' && arguments[0].nodeType === Node.ELEMENT_NODE) { | ||||||||||||||||||||||||||||||||||||||||||
| 236 | arguments[0].scrollIntoView(); | ||||||||||||||||||||||||||||||||||||||||||
| 237 | var pos = arguments[0].getBoundingClientRect(); | ||||||||||||||||||||||||||||||||||||||||||
| 238 | return {y:pos.top,x:pos.left}; | ||||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||
| 240 | return {}; | ||||||||||||||||||||||||||||||||||||||||||
| 241 | }, { 'element-6066-11e4-a52e-4f735466cecf' => $self->{id} } | ||||||||||||||||||||||||||||||||||||||||||
| 242 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | ▶ | if $self->driver->{is_wd3} && grep { $self->driver->browser_name eq $_ } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->driver->{"is_wd3"} and grep {$self->driver->browser_name eq $_;} "firefox", "internet explorer", "chrome"
MC/DC0%0/2
$self->driver->{"is_wd3"} and grep {$self->driver->browser_name eq $_;} "firefox", "internet explorer", "chrome"
$self->driver->{"is_wd3"}
grep {$self->driver->browser_name eq $_;} "firefox", "internet explorer", "chrome"
Truth table0%0/3
A and B
A= $self->driver->{"is_wd3"}B= grep {$self->driver->browser_name eq $_;} "firefox", "internet explorer", "chrome"
| |||||||||||||||||||||||||||||||||||||||||||
| 244 | ( 'firefox', 'internet explorer', 'chrome' ); | ||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | my $res = { 'command' => 'getElementLocationInView', 'id' => $self->id }; | |||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||
| 250 | 5 | ▶ | sub get_tag_name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_tag_name: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 251 | 5 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 252 | 5 | my $res = { 'command' => 'getElementTagName', 'id' => $self->id }; | |||||||||||||||||||||||||||||||||||||||||
| 253 | 5 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | 2 | ▶ | sub clear { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clear: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 258 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 259 | 2 | my $res = { 'command' => 'clearElement', 'id' => $self->id }; | |||||||||||||||||||||||||||||||||||||||||
| 260 | 2 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||
| 264 | 17 | ▶ | sub get_attribute { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_attribute: called CC=6 SCAR=22.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 265 | 17 | my ( $self, $attr_name, $no_i_really_mean_it ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 266 | 17 | ▶ | if ( not defined $attr_name ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | croak 'Attribute name not provided'; | |||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||
| 270 | #Handle global JSONWire emulation flag | ||||||||||||||||||||||||||||||||||||||||||
| 271 | 17 | ▶ | $no_i_really_mean_it = 1 unless $self->{driver}->{emulate_jsonwire}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||
| 273 | return $self->get_property($attr_name) | ||||||||||||||||||||||||||||||||||||||||||
| 274 | if $self->driver->{is_wd3} | ||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | ▶ | && !( grep { $self->driver->browser_name eq $_ } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$self->driver->{"is_wd3"} and not grep({$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge") and not $no_i_really_mean_it
$self->driver->{"is_wd3"} and not grep({$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge")
MC/DC0%0/3
$self->driver->{"is_wd3"} and not grep({$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge") and not $no_i_really_mean_it
$self->driver->{"is_wd3"}
not grep({$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge")
not $no_i_really_mean_it
Truth table25%1/4
A and not(B) and not(C)
A= $self->driver->{"is_wd3"}B= not grep({$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge")C= not $no_i_really_mean_it
| |||||||||||||||||||||||||||||||||||||||||||
| 276 | qw{chrome MicrosoftEdge} ) | ||||||||||||||||||||||||||||||||||||||||||
| 277 | && !$no_i_really_mean_it; | ||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||
| 279 | 17 | my $res = { | |||||||||||||||||||||||||||||||||||||||||
| 280 | 'command' => 'getElementAttribute', | ||||||||||||||||||||||||||||||||||||||||||
| 281 | 'id' => $self->id, | ||||||||||||||||||||||||||||||||||||||||||
| 282 | 'name' => $attr_name, | ||||||||||||||||||||||||||||||||||||||||||
| 283 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 284 | 17 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | ▶ | sub get_property { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_property: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | my ( $self, $prop ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 290 | return $self->get_attribute($prop) | ||||||||||||||||||||||||||||||||||||||||||
| 291 | if $self->driver->{is_wd3} | ||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | && ( grep { $self->driver->browser_name eq $_ } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->driver->{"is_wd3"} and grep {$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge"
MC/DC0%0/2
$self->driver->{"is_wd3"} and grep {$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge"
$self->driver->{"is_wd3"}
grep {$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge"
Truth table0%0/3
A and B
A= $self->driver->{"is_wd3"}B= grep {$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge"
| |||||||||||||||||||||||||||||||||||||||||||
| 293 | qw{chrome MicrosoftEdge} ); | ||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | my $res = | |||||||||||||||||||||||||||||||||||||||||
| 295 | { 'command' => 'getElementProperty', id => $self->id, name => $prop }; | ||||||||||||||||||||||||||||||||||||||||||
| 296 | 0 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||
| 300 | 9 | ▶ | sub get_value { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_value: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 301 | 9 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 302 | 9 | return $self->get_attribute('value'); | |||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||
| 306 | 6 | ▶ | sub is_displayed { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_displayed: called CC=6 SCAR=29.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 307 | 6 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 308 | 6 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->driver->{"is_wd3"} and not grep({$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge")
MC/DC0%0/2
$self->driver->{"is_wd3"} and not grep({$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge")
$self->driver->{"is_wd3"}
not grep({$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge")
Truth table33%1/3
A and not(B)
A= $self->driver->{"is_wd3"}B= not grep({$self->driver->browser_name eq $_;} "chrome", "MicrosoftEdge")
| |||||||||||||||||||||||||||||||||||||||||||
| 309 | $self->driver->{is_wd3} | ||||||||||||||||||||||||||||||||||||||||||
| 310 | && !( | ||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | grep { $self->driver->browser_name eq $_ } qw{chrome MicrosoftEdge} | |||||||||||||||||||||||||||||||||||||||||
| 312 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 313 | ) | ||||||||||||||||||||||||||||||||||||||||||
| 314 | { | ||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | ▶ | return 0 | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->get_tag_name eq "input" and $self->get_property("type") eq "hidden"
MC/DC0%0/2
$self->get_tag_name eq "input" and $self->get_property("type") eq "hidden"
$self->get_tag_name eq "input"
$self->get_property("type") eq "hidden"
Truth table0%0/3
A and B
A= $self->get_tag_name eq "input"B= $self->get_property("type") eq "hidden"
| |||||||||||||||||||||||||||||||||||||||||||
| 316 | if $self->get_tag_name() eq 'input' | ||||||||||||||||||||||||||||||||||||||||||
| 317 | && $self->get_property('type') eq 'hidden'; #hidden type inputs | ||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | ▶ | return 0 unless $self->_is_in_viewport(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | return int( $self->get_css_attribute('display') ne 'none' ); | |||||||||||||||||||||||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||||||||||||||||||||||
| 321 | 6 | my $res = { 'command' => 'isElementDisplayed', 'id' => $self->id }; | |||||||||||||||||||||||||||||||||||||||||
| 322 | 6 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | ▶ | sub _is_in_viewport { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_is_in_viewport: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 327 | return $self->driver->execute_script( | ||||||||||||||||||||||||||||||||||||||||||
| 328 | qq{ | ||||||||||||||||||||||||||||||||||||||||||
| 329 | var rect = arguments[0].getBoundingClientRect(); | ||||||||||||||||||||||||||||||||||||||||||
| 330 | return ( | ||||||||||||||||||||||||||||||||||||||||||
| 331 | rect.top >= 0 && | ||||||||||||||||||||||||||||||||||||||||||
| 332 | rect.left >= 0 && | ||||||||||||||||||||||||||||||||||||||||||
| 333 | rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && | ||||||||||||||||||||||||||||||||||||||||||
| 334 | rect.right <= (window.innerWidth || document.documentElement.clientWidth) | ||||||||||||||||||||||||||||||||||||||||||
| 335 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 336 | }, { 'element-6066-11e4-a52e-4f735466cecf' => $self->{id} } | ||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||
| 341 | 2 | ▶ | sub is_hidden { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_hidden: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 342 | 2 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 343 | 2 | return !$self->is_displayed(); | |||||||||||||||||||||||||||||||||||||||||
| 344 | } | ||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | sub drag { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
drag: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | my ( $self, $target ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | require Selenium::ActionChains; | |||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | my $chain = Selenium::ActionChains->new( driver => $self->driver ); | |||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | return $chain->drag_and_drop( $self, $target )->perform(); | |||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||
| 355 | 21 | ▶ | sub get_text { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_text: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 356 | 21 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 357 | 21 | my $res = { 'command' => 'getElementText', 'id' => $self->id }; | |||||||||||||||||||||||||||||||||||||||||
| 358 | 21 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | ▶ | sub get_css_attribute { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_css_attribute: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | my ( $self, $attr_name ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | ▶ | if ( not defined $attr_name ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | croak 'CSS attribute name not provided'; | |||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | my $res = { | |||||||||||||||||||||||||||||||||||||||||
| 368 | 'command' => 'getElementValueOfCssProperty', | ||||||||||||||||||||||||||||||||||||||||||
| 369 | 'id' => $self->id, | ||||||||||||||||||||||||||||||||||||||||||
| 370 | 'property_name' => $attr_name, | ||||||||||||||||||||||||||||||||||||||||||
| 371 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | ▶ | sub describe { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
describe: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | my $res = { 'command' => 'describeElement', 'id' => $self->id }; | |||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | return $self->_execute_command($res); | |||||||||||||||||||||||||||||||||||||||||
| 380 | } | ||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | ▶ | sub screenshot { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
screenshot: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | my ( $self, $scroll ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 385 | 0 | ▶ | $scroll //= 1; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$scroll //= 1
MC/DC0%0/1
$scroll //= 1
$scroll
Truth table0%0/2
A
A= $scroll
| |||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | my $res = { 'command' => 'elementScreenshot', id => $self->id }; | |||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | my $input = { scroll => int($scroll) }; | |||||||||||||||||||||||||||||||||||||||||
| 388 | 0 | return $self->_execute_command( $res, $input ); | |||||||||||||||||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | ▶ | sub capture_screenshot { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
capture_screenshot: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | my ( $self, $filename, $scroll ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | ▶ | croak '$filename is required' unless $filename; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | open( my $fh, '>', $filename ); | |||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | binmode $fh; | |||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | print $fh MIME::Base64::decode_base64( $self->screenshot($scroll) ); | |||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | CORE::close $fh; | |||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||
| 403 | 28 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||
| 405 | __END__ | ||||||||||||||||||||||||||||||||||||||||||