Branch Coverage

blib/lib/WWW/Mechanize/PhantomJS.pm
Criterion Covered Total %
branch 12 318 3.7


line true false branch
137 1 0 if ($options->{'port'})
143 0 1 if (my $cookie_file = delete $options->{'cookie_file'})
147 0 1 if (my $ignore_ssl_errors = delete $options->{'ignore_ssl_errors'})
153 0 1 $^O =~ /mswin/i && $options->{'launch_exe'} =~ /\s/ ? :
156 0 1 if ($^O =~ /mswin/i)
169 1 0 unless (defined $options{'port'} and not $options{'pid'})
179 0 1 if ($sock)
190 0 1 unless (exists $options{'autodie'})
192 1 0 unless (exists $options{'frames'})
195 1 0 unless ($options{'pid'})
198 1 0 if (@cmd > 1) { }
201 1 0 unless $options{'pid'} = open($options{'fh'}, $mode, @cmd)
206 0 0 unless $options{'pid'} = open($options{'fh'}, $cmd[0])
219 0 0 if ($socket)
224 0 0 if &WWW::Mechanize::PhantomJS::time() - $t < 1
250 0 0 if ($@)
251 0 0 if $options{'kill_pid'}
327 0 0 if @_ == 2
335 0 0 if ('javascript' eq $opt) { }
416 0 0 unless defined $affirmative
417 0 0 $affirmative ? :
498 0 0 if (my $child_out = $_[0]{'fh'})
508 0 0 if ($pid)
571 0 0 if ref $phantom_res eq '' and $phantom_res eq '1'
581 0 0 unless ($phantom_res->{'status'})
628 0 0 'File::Spec'->file_name_is_absolute($htmlfile) ? :
636 0 0 if ($^O =~ /mswin/i) { }
643 0 0 if (0 + $res->headers->header_field_names and [$res->headers->header_field_names]->[0] ne 'x-www-mechanize-phantomjs-fake-success' || $self->uri ne 'about:blank') { }
702 0 0 unless ($options{'data'})
826 0 0 if ($self->{'autodie'}) { }
836 0 0 if ($self->{'autodie'}) { }
837 0 0 if ($self->status and not $self->status =~ /^2/ and $self->status != 0)
861 0 0 if $res
975 0 0 if ('html' eq $format) { }
0 0 elsif ($format eq 'text') { }
1014 0 0 if (my($meta) = $self->xpath(q[//meta[translate(@http-equiv,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')="content-type"]], 'first', 1))
1016 0 0 if $ct
1053 0 0 if $base
1072 0 0 if (my($meta) = $self->xpath(q[//meta[translate(@http-equiv,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')="content-type"]], 'first', 1))
1075 0 0 if (not $ct and my $r = $self->response)
1079 0 0 if defined $ct
1144 0 0 if ($tag)
1145 0 0 if (not exists $link_spec{$tag}) { }
1153 0 0 if ($tag eq 'meta')
1155 0 0 if ($content =~ /^\d+\s*;\s*url\s*=\s*(\S+)/i) { }
1157 0 0 unless $url =~ s/^"(.+)"$/$1/
1164 0 0 if (defined $url) { }
1290 0 0 unless $xpath_quote{$1}
1299 0 0 unless keys %$p
1301 0 0 if defined $p->{'url'} and not $link->url eq $p->{'url'}
1302 0 0 if defined $p->{'url_regex'} and not $link->url =~ /$p->{'url_regex'}/
1303 0 0 if defined $p->{'url_abs'} and not $link->url_abs eq $p->{'url_abs'}
1304 0 0 if defined $p->{'url_abs_regex'} and not $link->url_abs =~ /$p->{'url_abs_regex'}/
1305 0 0 if defined $p->{'text'} and not defined $link->text && $link->text eq $p->{'text'}
1306 0 0 if defined $p->{'text_regex'} and not defined $link->text && $link->text =~ /$p->{'text_regex'}/
1307 0 0 if defined $p->{'name'} and not defined $link->name && $link->name eq $p->{'name'}
1308 0 0 if defined $p->{'name_regex'} and not defined $link->name && $link->name =~ /$p->{'name_regex'}/
1309 0 0 if defined $p->{'tag'} and not $link->tag && $link->tag eq $p->{'tag'}
1310 0 0 if defined $p->{'tag_regex'} and not $link->tag && $link->tag =~ /$p->{'tag_regex'}/
1312 0 0 if defined $p->{'id'} and not $link->attrs->{'id'} && $link->attrs->{'id'} eq $p->{'id'}
1313 0 0 if defined $p->{'id_regex'} and not $link->attrs->{'id'} && $link->attrs->{'id'} =~ /$p->{'id_regex'}/
1314 0 0 if defined $p->{'class'} and not $link->attrs->{'class'} && $link->attrs->{'class'} eq $p->{'class'}
1315 0 0 if defined $p->{'class_regex'} and not $link->attrs->{'class'} && $link->attrs->{'class'} =~ /$p->{'class_regex'}/
1327 0 0 if (exists $opts{$_})
1334 0 0 if ($single and exists $opts{'n'})
1338 0 0 if $n ne 'all'
1357 0 0 if length $op
1360 0 0 if (exists $opts{$key})
1367 0 0 if (my $p = delete $opts{'url'})
1371 0 0 if (my $p = delete $opts{'tag'})
1374 0 0 if (my $p = delete $opts{'tag_regex'})
1379 0 0 exists $link_spec{$_} ? :
1381 0 0 if (@full) { }
1391 0 0 if (keys %opts)
1402 0 0 if ($one)
1403 0 0 if (0 == @res)
1404 0 0 if ($single)
1405 0 0 if (1 < @res)
1414 0 0 if ($n eq 'all')
1438 0 0 if 'all' eq ($opts{'n'} || '')
1439 0 0 if (my $link = $self->find_link_dom('frames', 0, %opts)) { }
1468 0 0 if wantarray
1491 0 0 if wantarray
1511 0 0 if (@_ == 2) { }
1535 0 0 unless ($doc->{'__path'})
1552 0 0 unless ($just_parent)
1559 0 0 if ('html' ne $tag and '' ne $tag)
1569 0 0 if ($body)
1678 0 0 if ('ARRAY' ne (ref $query || ''))
1682 0 0 unless (exists $options{'frames'})
1699 0 0 unless (exists $options{'all'} or $return_first_element)
1700 0 0 if defined wantarray and not wantarray
1711 0 0 if ($options{'document'})
1737 0 0 if ($options{'node'}) { }
1752 0 0 unless (@found)
1777 0 0 if ($options{'frames'} and not $options{'node'})
1797 0 0 if (not $zero_allowed and @res == 0)
1800 0 0 if (not $two_allowed and @res > 1)
1806 0 0 $return_first_element ? :
1829 0 0 if ('ARRAY' ne (ref $query || ''))
1895 0 0 if (not defined $name) { }
0 0 elsif (ref $name and &blessed($name) and $name->can('click')) { }
0 0 elsif (ref $name eq 'HASH') { }
1905 0 0 if (exists $options{'name'})
1910 0 0 if ($options{'name'} eq '')
1918 0 0 if ($options{'dom'}) { }
1927 0 0 if (defined wantarray)
1945 0 0 if (exists $options{$meth})
1951 0 0 unless $method
1959 0 0 unless (grep {exists $options->{$_};} 'single', 'one', 'maybe', 'all', 'any')
2008 0 0 if (exists $options{'input'}) { }
0 0 elsif (exists $options{'name'}) { }
0 0 elsif (exists $options{'value'}) { }
0 0 elsif (exists $options{'id'}) { }
0 0 elsif (exists $options{'number'}) { }
2032 0 0 if ($node) { }
2062 0 0 unless $self->{'current_form'}
2075 0 0 unless ($focus)
2107 0 0 if ($type = $f->get_attribute('type') || '')
2198 0 0 if (ref $fields[0] eq 'HASH')
2235 0 0 wantarray ? :
2296 0 0 if (@_ == 3) { }
2328 0 0 if ($name =~ s/^\^//) { }
0 0 elsif ($name =~ s/^#//) { }
0 0 elsif ($name =~ s/^\.//) { }
2335 0 0 if (&blessed($name)) { }
2366 0 0 unless ref $pre
2368 0 0 unless ref $post
2371 0 0 if ($fields[0]) { }
2373 0 0 if ($set_value)
2380 0 0 $value ? :
2399 0 0 unless defined wantarray
2403 0 0 if ('SELECT' eq uc $tag) { }
2406 0 0 if (wantarray) { }
2435 0 0 if ($dom_form) { }
2499 0 0 unless ($form)
2500 0 0 if ($fields = delete $options{'with_fields'}) { }
2503 0 0 unless ($form)
2513 0 0 unless ($form)
2520 0 0 if ($options{'button'}) { }
2548 0 0 unless ($f)
2560 0 0 if (ref $v)
2562 0 0 unless $num == 1
2585 0 0 ref $spec ? :
2588 0 0 if (not ref $spec || $spec =~ /\D/ and $spec == 1)
2595 0 0 if (not grep({ref $_;} @spec)) { }
2604 0 0 ref $_ ? :
2689 0 0 if &blessed($e) and $e->isa('Selenium::Remote::WebElement')
2693 0 0 unless $res->{'id'}
2732 0 0 if (scalar keys %$rect)
2803 0 0 unless my $element = delete $options{'element'}
2872 0 0 unless ($outname)
2889 0 0 if ($wantresult)
2890 0 0 unless open my $fh, '<', $outname
2898 0 0 unless unlink $_
2982 0 0 if ($self->{'report_js_errors'})
2983 0 0 if (my(@errors) = $self->js_errors)
2996 0 0 @{$_->{'trace'};} ? :
0 0 @{$_->{'trace'};} && $_->{'trace'}[-1]{'function'} ? :