| 1 | package Selenium::Remote::Spec; | ||||||||||||||||||||||||||||
| 2 | 28 | $Selenium::Remote::Spec::VERSION = '1.49'; | |||||||||||||||||||||||||||
| 3 | 28 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 28 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | # ABSTRACT: Implement commands for Selenium::Remote::Driver | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 28 | ▶ | use Carp qw{croak}; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 28 | ▶ | use List::Util qw{any}; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 28 | ▶ | use Moo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 28 | extends 'Selenium::Remote::Commands'; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | #Ripped from the headlines: https://w3c.github.io/webdriver/webdriver-spec.html | ||||||||||||||||||||||||||||
| 16 | #then add 2 params for our use | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | #Method URI Template no_content_success internal_name Command | ||||||||||||||||||||||||||||
| 19 | 28 | our $spec = qq{ | |||||||||||||||||||||||||||
| 20 | POST session 0 newSession New Session | ||||||||||||||||||||||||||||
| 21 | POST session 0 getCapabilities Get Capabilities (v2->v3 shim) | ||||||||||||||||||||||||||||
| 22 | DELETE session/:sessionId 1 quit Delete Session | ||||||||||||||||||||||||||||
| 23 | GET status 0 status Status | ||||||||||||||||||||||||||||
| 24 | GET session/:sessionId/timeouts 0 getTimeouts Get Timeouts | ||||||||||||||||||||||||||||
| 25 | POST session/:sessionId/timeouts 1 setTimeout Set Page Load timeout (v2->v3 shim) | ||||||||||||||||||||||||||||
| 26 | POST session/:sessionId/timeouts/async_script 1 setAsyncScriptTimeout Set Async script timeout (v2->v3 shim) | ||||||||||||||||||||||||||||
| 27 | POST session/:sessionId/timeouts/implicit_wait 1 setImplicitWaitTimeout Set Implicit wait timeout (v2->v3 shim) | ||||||||||||||||||||||||||||
| 28 | POST session/:sessionId/url 1 get Navigate To | ||||||||||||||||||||||||||||
| 29 | GET session/:sessionId/url 0 getCurrentUrl Get Current URL | ||||||||||||||||||||||||||||
| 30 | POST session/:sessionId/back 1 goBack Back | ||||||||||||||||||||||||||||
| 31 | POST session/:sessionId/forward 1 goForward Forward | ||||||||||||||||||||||||||||
| 32 | POST session/:sessionId/refresh 1 refresh Refresh | ||||||||||||||||||||||||||||
| 33 | GET session/:sessionId/title 0 getTitle Get Title | ||||||||||||||||||||||||||||
| 34 | GET session/:sessionId/window 0 getCurrentWindowHandle Get Currently Focused Window Handle | ||||||||||||||||||||||||||||
| 35 | DELETE session/:sessionId/window 1 close Close Currently Focused Window | ||||||||||||||||||||||||||||
| 36 | POST session/:sessionId/window 1 switchToWindow Switch To Window | ||||||||||||||||||||||||||||
| 37 | GET session/:sessionId/window/handles 0 getWindowHandles Get Window Handles | ||||||||||||||||||||||||||||
| 38 | POST session/:sessionId/frame 1 switchToFrame Switch To Frame | ||||||||||||||||||||||||||||
| 39 | POST session/:sessionId/frame/parent 1 switchToParentFrame Switch To Parent Frame | ||||||||||||||||||||||||||||
| 40 | GET session/:sessionId/window/rect 0 getWindowRect Get Window Size/Position (v2->v3 shim) | ||||||||||||||||||||||||||||
| 41 | POST session/:sessionId/window/rect 1 setWindowRect Set Window Size/Position (v2->v3 shim) | ||||||||||||||||||||||||||||
| 42 | POST session/:sessionId/window/maximize 1 maximizeWindow Maximize Window | ||||||||||||||||||||||||||||
| 43 | POST session/:sessionId/window/minimize 1 minimizeWindow Minimize Window | ||||||||||||||||||||||||||||
| 44 | POST session/:sessionId/window/fullscreen 1 fullscreenWindow Fullscreen Window | ||||||||||||||||||||||||||||
| 45 | GET session/:sessionId/element/active 0 getActiveElement Get Active Element | ||||||||||||||||||||||||||||
| 46 | POST session/:sessionId/element 0 findElement Find Element | ||||||||||||||||||||||||||||
| 47 | POST session/:sessionId/elements 0 findElements Find Elements | ||||||||||||||||||||||||||||
| 48 | POST session/:sessionId/element/:id/element 0 findChildElement Find Element From Element | ||||||||||||||||||||||||||||
| 49 | POST session/:sessionId/element/:id/elements 0 findChildElements Find Elements From Element | ||||||||||||||||||||||||||||
| 50 | GET session/:sessionId/element/:id/selected 0 isElementSelected Is Element Selected | ||||||||||||||||||||||||||||
| 51 | GET session/:sessionId/element/:id/attribute/:name 0 getElementAttribute Get Element Attribute | ||||||||||||||||||||||||||||
| 52 | GET session/:sessionId/element/:id/property/:name 0 getElementProperty Get Element Property | ||||||||||||||||||||||||||||
| 53 | GET session/:sessionId/element/:id/css/:propertyName 0 getElementValueOfCssProperty Get Element CSS Value | ||||||||||||||||||||||||||||
| 54 | GET session/:sessionId/element/:id/text 0 getElementText Get Element Text | ||||||||||||||||||||||||||||
| 55 | GET session/:sessionId/element/:id/name 0 getElementTagName Get Element Tag Name | ||||||||||||||||||||||||||||
| 56 | GET session/:sessionId/element/:id/rect 0 getElementRect Get Element Rect | ||||||||||||||||||||||||||||
| 57 | GET session/:sessionId/element/:id/enabled 0 isElementEnabled Is Element Enabled | ||||||||||||||||||||||||||||
| 58 | POST session/:sessionId/element/:id/click 1 clickElement Element Click | ||||||||||||||||||||||||||||
| 59 | POST session/:sessionId/element/:id/clear 1 clearElement Element Clear | ||||||||||||||||||||||||||||
| 60 | POST session/:sessionId/element/:id/value 1 sendKeysToElement Element Send Keys | ||||||||||||||||||||||||||||
| 61 | GET session/:sessionId/source 0 getPageSource Get Page Source | ||||||||||||||||||||||||||||
| 62 | POST session/:sessionId/execute/sync 0 executeScript Execute Script | ||||||||||||||||||||||||||||
| 63 | POST session/:sessionId/execute/async 0 executeAsyncScript Execute Async Script | ||||||||||||||||||||||||||||
| 64 | GET session/:sessionId/cookie 0 getAllCookies Get All Cookies | ||||||||||||||||||||||||||||
| 65 | GET session/:sessionId/cookie/:name 0 getCookieNamed Get Named Cookie | ||||||||||||||||||||||||||||
| 66 | POST session/:sessionId/cookie 1 addCookie Add Cookie | ||||||||||||||||||||||||||||
| 67 | DELETE session/:sessionId/cookie/:name 1 deleteCookieNamed Delete Cookie | ||||||||||||||||||||||||||||
| 68 | DELETE session/:sessionId/cookie 1 deleteAllCookies Delete All Cookies | ||||||||||||||||||||||||||||
| 69 | POST session/:sessionId/actions 1 generalAction Perform Actions | ||||||||||||||||||||||||||||
| 70 | DELETE session/:sessionId/actions 1 releaseGeneralAction Release Actions | ||||||||||||||||||||||||||||
| 71 | POST session/:sessionId/alert/dismiss 1 dismissAlert Dismiss Alert | ||||||||||||||||||||||||||||
| 72 | POST session/:sessionId/alert/accept 1 acceptAlert Accept Alert | ||||||||||||||||||||||||||||
| 73 | GET session/:sessionId/alert/text 0 getAlertText Get Alert Text | ||||||||||||||||||||||||||||
| 74 | POST session/:sessionId/alert/text 1 sendKeysToPrompt Send Alert Text | ||||||||||||||||||||||||||||
| 75 | GET session/:sessionId/screenshot 0 screenshot Take Screenshot | ||||||||||||||||||||||||||||
| 76 | GET session/:sessionId/moz/screenshot/full 0 mozScreenshotFull Take Full Screenshot | ||||||||||||||||||||||||||||
| 77 | GET session/:sessionId/element/:id/screenshot 0 elementScreenshot Take Element Screenshot | ||||||||||||||||||||||||||||
| 78 | }; | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | 28 | our $spec_parsed; | |||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | sub get_spec { | ||||||||||||||||||||||||||||
| 83 | 2 | ▶ | return $spec_parsed if $spec_parsed; | ||||||||||||||||||||||||||
|
Subroutine
_build__cmds: called CC=4 SCAR=13.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 84 | 1 | my @split = split( /\n/, $spec ); | |||||||||||||||||||||||||||
| 85 | 1 | foreach my $line (@split) { | |||||||||||||||||||||||||||
| 86 | 59 | ▶ | next unless $line; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 87 | 58 | my ( $method, $uri, $nc_success, $key, @description ) = | |||||||||||||||||||||||||||
| 88 | split( / +/, $line ); | ||||||||||||||||||||||||||||
| 89 | 58 | $spec_parsed->{$key} = { | |||||||||||||||||||||||||||
| 90 | method => $method, | ||||||||||||||||||||||||||||
| 91 | url => $uri, | ||||||||||||||||||||||||||||
| 92 | no_content_success => int($nc_success) | ||||||||||||||||||||||||||||
| 93 | , #XXX this *should* always be 0, but specs lie | ||||||||||||||||||||||||||||
| 94 | description => join( ' ', @description ), | ||||||||||||||||||||||||||||
| 95 | }; | ||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||
| 97 | 1 | return $spec_parsed; | |||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 28 | has '_cmds' => ( | |||||||||||||||||||||||||||
| 101 | is => 'lazy', | ||||||||||||||||||||||||||||
| 102 | reader => 'get_cmds', | ||||||||||||||||||||||||||||
| 103 | builder => \&get_spec, | ||||||||||||||||||||||||||||
| 104 | ); | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | has '_caps' => ( | ||||||||||||||||||||||||||||
| 108 | is => 'lazy', | ||||||||||||||||||||||||||||
| 109 | reader => 'get_caps', | ||||||||||||||||||||||||||||
| 110 | builder => sub { | ||||||||||||||||||||||||||||
| 111 | return [ | ||||||||||||||||||||||||||||
| 112 | 3 | ▶ | 'browserName', 'acceptInsecureCerts', | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
_build__caps: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 113 | 'browserVersion', 'platformName', | ||||||||||||||||||||||||||||
| 114 | 'proxy', 'pageLoadStrategy', | ||||||||||||||||||||||||||||
| 115 | 'setWindowRect', 'timeouts', | ||||||||||||||||||||||||||||
| 116 | 'unhandledPromptBehavior', 'moz:firefoxOptions', | ||||||||||||||||||||||||||||
| 117 | 'goog:chromeOptions', 'goog:loggingPrefs', | ||||||||||||||||||||||||||||
| 118 | ]; | ||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||
| 120 | 28 | ); | |||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | has '_caps_map' => ( | ||||||||||||||||||||||||||||
| 123 | is => 'lazy', | ||||||||||||||||||||||||||||
| 124 | reader => 'get_caps_map', | ||||||||||||||||||||||||||||
| 125 | builder => sub { | ||||||||||||||||||||||||||||
| 126 | return { | ||||||||||||||||||||||||||||
| 127 | 5 | ▶ | browserName => 'browserName', | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Subroutine
_build__caps_map: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 128 | acceptSslCerts => 'acceptInsecureCerts', | ||||||||||||||||||||||||||||
| 129 | version => 'browserVersion', | ||||||||||||||||||||||||||||
| 130 | platform => 'platformName', | ||||||||||||||||||||||||||||
| 131 | proxy => 'proxy', | ||||||||||||||||||||||||||||
| 132 | }; | ||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||
| 134 | 28 | ); | |||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | sub get_params { | ||||||||||||||||||||||||||||
| 137 | 8 | ▶ | my ( $self, $args ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
get_params: called CC=21 SCAR=30.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 138 | 8 | ▶ | if ( !( defined $args->{'session_id'} ) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 139 | 0 | return; | |||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | #Allow fall-back in the event the command passed doesn't exist | ||||||||||||||||||||||||||||
| 143 | 8 | ▶ | return unless $self->get_cmds()->{ $args->{command} }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | 8 | my $url = $self->get_url( $args->{command} ); | |||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | 8 | my $data = {}; | |||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | # Do the var substitutions. | ||||||||||||||||||||||||||||
| 150 | 8 | $url =~ s/:sessionId/$args->{'session_id'}/; | |||||||||||||||||||||||||||
| 151 | 8 | $url =~ s/:id/$args->{'id'}/; | |||||||||||||||||||||||||||
| 152 | 8 | $url =~ s/:name/$args->{'name'}/; | |||||||||||||||||||||||||||
| 153 | 8 | $url =~ s/:propertyName/$args->{'property_name'}/; | |||||||||||||||||||||||||||
| 154 | 8 | $url =~ s/:other/$args->{'other'}/; | |||||||||||||||||||||||||||
| 155 | 8 | $url =~ s/:windowHandle/$args->{'window_handle'}/; | |||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||
| 157 | 8 | $data->{'method'} = $self->get_method( $args->{command} ); | |||||||||||||||||||||||||||
| 158 | $data->{'no_content_success'} = | ||||||||||||||||||||||||||||
| 159 | 8 | $self->get_no_content_success( $args->{command} ); | |||||||||||||||||||||||||||
| 160 | 8 | $data->{'url'} = $url; | |||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | #URL & data polyfills for the way selenium2 used to do things, etc | ||||||||||||||||||||||||||||
| 163 | 8 | $data->{payload} = {}; | |||||||||||||||||||||||||||
| 164 | 8 | ▶ | if ( $args->{type} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 165 | $data->{payload}->{pageLoad} = $args->{ms} | ||||||||||||||||||||||||||||
| 166 | 8 | ▶ | if $data->{url} =~ m/timeouts$/ && $args->{type} eq 'page load'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$data->{"url"} =~ /timeouts$/ and $args->{"type"} eq "page load"
MC/DC100%2/2
$data->{"url"} =~ /timeouts$/ and $args->{"type"} eq "page load"
$data->{"url"} =~ /timeouts$/
$args->{"type"} eq "page load"
Truth table100%3/3
A and B
A= $data->{"url"} =~ /timeouts$/B= $args->{"type"} eq "page load"
| |||||||||||||||||||||||||||||
| 167 | $data->{payload}->{script} = $args->{ms} | ||||||||||||||||||||||||||||
| 168 | 8 | ▶ | if $data->{url} =~ m/timeouts$/ && $args->{type} eq 'script'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$data->{"url"} =~ /timeouts$/ and $args->{"type"} eq "script"
MC/DC100%2/2
$data->{"url"} =~ /timeouts$/ and $args->{"type"} eq "script"
$data->{"url"} =~ /timeouts$/
$args->{"type"} eq "script"
Truth table100%3/3
A and B
A= $data->{"url"} =~ /timeouts$/B= $args->{"type"} eq "script"
| |||||||||||||||||||||||||||||
| 169 | $data->{payload}->{implicit} = $args->{ms} | ||||||||||||||||||||||||||||
| 170 | 8 | ▶ | if $data->{url} =~ m/timeouts$/ && $args->{type} eq 'implicit'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$data->{"url"} =~ /timeouts$/ and $args->{"type"} eq "implicit"
MC/DC100%2/2
$data->{"url"} =~ /timeouts$/ and $args->{"type"} eq "implicit"
$data->{"url"} =~ /timeouts$/
$args->{"type"} eq "implicit"
Truth table100%3/3
A and B
A= $data->{"url"} =~ /timeouts$/B= $args->{"type"} eq "implicit"
| |||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||
| 173 | #finder polyfills | ||||||||||||||||||||||||||||
| 174 | #orig: class, class_name, css, id, link, link_text, partial_link_text, tag_name, name, xpath | ||||||||||||||||||||||||||||
| 175 | #new: "css selector", "link text", "partial link text", "tag name", "xpath" | ||||||||||||||||||||||||||||
| 176 | #map: class, class_name, id, name, link = 'css selector' | ||||||||||||||||||||||||||||
| 177 | 8 | ▶ | if ( $args->{using} && $args->{value} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$args->{"using"} and $args->{"value"}
MC/DC0%0/2
$args->{"using"} and $args->{"value"}
$args->{"using"}
$args->{"value"}
Truth table33%1/3
A and B
A= $args->{"using"}B= $args->{"value"}
| |||||||||||||||||||||||||||||
| 178 | $data->{payload}->{using} = 'css selector' | ||||||||||||||||||||||||||||
| 179 | 8 | ▶ | if grep { $args->{using} eq $_ } ( 'id', 'class name', 'name' ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 180 | $data->{payload}->{value} = "[id='$args->{value}']" | ||||||||||||||||||||||||||||
| 181 | 8 | ▶ | if $args->{using} eq 'id'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 182 | $data->{payload}->{value} = ".$args->{value}" | ||||||||||||||||||||||||||||
| 183 | 8 | ▶ | if $args->{using} eq 'class name'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 184 | $data->{payload}->{value} = "[name='$args->{value}']" | ||||||||||||||||||||||||||||
| 185 | 8 | ▶ | if $args->{using} eq 'name'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||
| 187 | 8 | ▶ | if ( $data->{url} =~ s/timeouts\/async_script$/timeouts/g ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 188 | 1 | $data->{payload}->{script} = $args->{ms}; | |||||||||||||||||||||||||||
| 189 | 1 | $data->{payload}->{type} = 'script'; #XXX chrome doesn't follow the spec | |||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||
| 191 | 8 | ▶ | if ( $data->{url} =~ s/timeouts\/implicit_wait$/timeouts/g ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 192 | 4 | $data->{payload}->{implicit} = $args->{ms}; | |||||||||||||||||||||||||||
| 193 | $data->{payload}->{type} = | ||||||||||||||||||||||||||||
| 194 | 4 | 'implicit'; #XXX chrome doesn't follow the spec | |||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||
| 196 | $data->{payload}->{value} = $args->{text} | ||||||||||||||||||||||||||||
| 197 | 8 | ▶ | if $args->{text} && $args->{command} ne 'sendKeysToElement'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$args->{"text"} and $args->{"command"} ne "sendKeysToElement"
MC/DC50%1/2
$args->{"text"} and $args->{"command"} ne "sendKeysToElement"
$args->{"text"}
$args->{"command"} ne "sendKeysToElement"
Truth table66%2/3
A and B
A= $args->{"text"}B= $args->{"command"} ne "sendKeysToElement"
| |||||||||||||||||||||||||||||
| 198 | $data->{payload}->{handle} = $args->{window_handle} | ||||||||||||||||||||||||||||
| 199 | 8 | ▶ | if grep { $args->{command} eq $_ } | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 200 | qw{fullscreenWindow minimizeWindow maximizeWindow}; | ||||||||||||||||||||||||||||
| 201 | 8 | return $data; | |||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | sub parse_response { | ||||||||||||||||||||||||||||
| 205 | 2 | ▶ | my ( $self, undef, $resp ) = @_; | ||||||||||||||||||||||||||
|
Subroutine
parse_response: called CC=7 SCAR=21.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | 2 | ▶ | if ( ref($resp) eq 'HASH' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 208 | 2 | ▶ | if ( $resp->{cmd_status} && $resp->{cmd_status} eq 'OK' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$resp->{"cmd_status"} and $resp->{"cmd_status"} eq "OK"
MC/DC50%1/2
$resp->{"cmd_status"} and $resp->{"cmd_status"} eq "OK"
$resp->{"cmd_status"}
$resp->{"cmd_status"} eq "OK"
Truth table66%2/3
A and B
A= $resp->{"cmd_status"}B= $resp->{"cmd_status"} eq "OK"
| |||||||||||||||||||||||||||||
| 209 | 1 | return $resp->{cmd_return}; | |||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||
| 211 | 1 | my $msg = "Error while executing command"; | |||||||||||||||||||||||||||
| 212 | 1 | ▶ | if ( ref $resp->{cmd_return} eq 'HASH' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 213 | $msg .= ": $resp->{cmd_return}{error}" | ||||||||||||||||||||||||||||
| 214 | 1 | ▶ | if $resp->{cmd_return}{error}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 215 | $msg .= ": $resp->{cmd_return}{message}" | ||||||||||||||||||||||||||||
| 216 | 1 | ▶ | if $resp->{cmd_return}{message}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||
| 218 | else { | ||||||||||||||||||||||||||||
| 219 | 0 | $msg .= ": $resp->{cmd_return}"; | |||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||
| 221 | 1 | croak $msg; | |||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | 0 | return $resp; | |||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||
| 227 | #Utility | ||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||
| 229 | sub get_spec_differences { | ||||||||||||||||||||||||||||
| 230 | 0 | ▶ | my $v2_spec = Selenium::Remote::Commands->new()->get_cmds(); | ||||||||||||||||||||||||||
|
Subroutine
get_spec_differences: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 231 | 0 | my $v3_spec = Selenium::Remote::Spec->new()->get_cmds(); | |||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | 0 | foreach my $key ( keys(%$v2_spec) ) { | |||||||||||||||||||||||||||
| 234 | print "v2 $key NOT present in v3 spec!!!\n" | ||||||||||||||||||||||||||||
| 235 | 0 | ▶ | unless any { $_ eq $key } keys(%$v3_spec); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||
| 237 | 0 | foreach my $key ( keys(%$v3_spec) ) { | |||||||||||||||||||||||||||
| 238 | print "v3 $key NOT present in v2 spec!!!\n" | ||||||||||||||||||||||||||||
| 239 | 0 | ▶ | unless any { $_ eq $key } keys(%$v2_spec); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | 28 | 1; | |||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||
| 245 | __END__ | ||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | =pod | ||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | =encoding UTF-8 | ||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | =head1 NAME | ||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | Selenium::Remote::Spec - Implement commands for Selenium::Remote::Driver | ||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||
| 255 | =head1 VERSION | ||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||
| 257 | version 1.49 | ||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||
| 261 | Defines all the HTTP endpoints available to execute on a selenium server. | ||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||
| 263 | If you have either a customized Selenium Server, or want new features | ||||||||||||||||||||||||||||
| 264 | you should update the _cmds hash. | ||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||
| 266 | =for Pod::Coverage *EVERYTHING* | ||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | =head1 Webdriver 3 capabilities | ||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||
| 270 | WD3 giveth and taketh away some caps. Here's all you get: | ||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | Browser name: "browserName" string Identifies the user agent. | ||||||||||||||||||||||||||||
| 273 | Browser version: "browserVersion" string Identifies the version of the user agent. | ||||||||||||||||||||||||||||
| 274 | Platform name: "platformName" string Identifies the operating system of the endpoint node. | ||||||||||||||||||||||||||||
| 275 | Accept insecure TLS certificates: "acceptInsecureCerts" boolean Indicates whether untrusted and self-signed TLS certificates are implicitly trusted on navigation for the duration of the session. | ||||||||||||||||||||||||||||
| 276 | Proxy configuration: "proxy" JSON Defines the current session’s proxy configuration. | ||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||
| 278 | New Stuff: | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | Page load strategy: "pageLoadStrategy" string Defines the current session’s page load strategy. | ||||||||||||||||||||||||||||
| 281 | Window dimensioning/positioning: "setWindowRect" boolean Indicates whether the remote end supports all of the commands in Resizing and Positioning Windows. | ||||||||||||||||||||||||||||
| 282 | Session timeouts configuration: "timeouts" JSON Describes the timeouts imposed on certain session operations. | ||||||||||||||||||||||||||||
| 283 | Unhandled prompt behavior: "unhandledPromptBehavior" string Describes the current session’s user prompt handler. | ||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | =head1 AUTHORS | ||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | Current Maintainers: | ||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||
| 289 | =over 4 | ||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | =item * | ||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||
| 293 | George S. Baugh <george@troglodyne.net> | ||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||
| 295 | =back | ||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||
| 297 | Previous maintainers: | ||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||
| 299 | =over 4 | ||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | =item * | ||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||
| 303 | Daniel Gempesaw <gempesaw@gmail.com> | ||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | =item * | ||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||
| 307 | Emmanuel Peroumalnaïk <peroumalnaik.emmanuel@gmail.com> | ||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||
| 309 | =item * | ||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | Luke Closs <cpan@5thplane.com> | ||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||
| 313 | =item * | ||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | Mark Stosberg <mark@stosberg.com> | ||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | =back | ||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||
| 319 | Original authors: | ||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||
| 321 | =over 4 | ||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | =item * | ||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||
| 325 | Aditya Ivaturi <ivaturi@gmail.com> | ||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||
| 327 | =back | ||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||
| 329 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | Copyright (c) 2010-2011 Aditya Ivaturi, Gordon Child | ||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||
| 333 | Copyright (c) 2014-2017 Daniel Gempesaw | ||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||
| 335 | Copyright (c) 2018-2021 George S. Baugh | ||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||
| 337 | Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||||||||||||||||||
| 338 | you may not use this file except in compliance with the License. | ||||||||||||||||||||||||||||
| 339 | You may obtain a copy of the License at | ||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||
| 341 | http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||
| 343 | Unless required by applicable law or agreed to in writing, software | ||||||||||||||||||||||||||||
| 344 | distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||||||||||||||||||||
| 345 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||||||||||||||||||||
| 346 | See the License for the specific language governing permissions and | ||||||||||||||||||||||||||||
| 347 | limitations under the License. | ||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||
| 349 | =cut | ||||||||||||||||||||||||||||