Branch Coverage

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


line true false branch
139 1 0 if ($options->{'port'})
145 0 1 if (my $cookie_file = delete $options->{'cookie_file'})
149 0 1 if (my $ignore_ssl_errors = delete $options->{'ignore_ssl_errors'})
155 0 1 $^O =~ /mswin/i && $options->{'launch_exe'} =~ /\s/ ? :
158 0 1 if ($^O =~ /mswin/i)
171 1 0 unless (defined $options{'port'} and not $options{'pid'})
181 0 1 if ($sock)
192 0 1 unless (exists $options{'autodie'})
194 1 0 unless (exists $options{'frames'})
197 1 0 unless ($options{'pid'})
200 1 0 if (@cmd > 1) { }
203 1 0 unless $options{'pid'} = open($options{'fh'}, $mode, @cmd)
208 0 0 unless $options{'pid'} = open($options{'fh'}, $cmd[0])
221 0 0 if ($socket)
226 0 0 if &WWW::Mechanize::PhantomJS::time() - $t < 1
252 0 0 if ($@)
253 0 0 if $options{'kill_pid'}
329 0 0 if @_ == 2
337 0 0 if ('javascript' eq $opt) { }
418 0 0 unless defined $affirmative
419 0 0 $affirmative ? :
500 0 0 if (my $child_out = $_[0]{'fh'})
510 0 0 if ($pid)
573 0 0 if ref $phantom_res eq "" and $phantom_res eq 1
583 0 0 unless ($phantom_res->{'status'})
630 0 0 'File::Spec'->file_name_is_absolute($htmlfile) ? :
638 0 0 if ($^O =~ /mswin/i) { }
645 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') { }
704 0 0 unless ($options{'data'})
828 0 0 if ($self->{'autodie'}) { }
838 0 0 if ($self->{'autodie'}) { }
839 0 0 if ($self->status and not $self->status =~ /^2/ and $self->status != 0)
863 0 0 if $res
977 0 0 if ('html' eq $format) { }
0 0 elsif ($format eq 'text') { }
1016 0 0 if (my($meta) = $self->xpath("//meta[translate(\@http-equiv,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')=\"content-type\"]", "first", 1))
1018 0 0 if $ct
1055 0 0 if $base
1074 0 0 if (my($meta) = $self->xpath("//meta[translate(\@http-equiv,'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')=\"content-type\"]", "first", 1))
1077 0 0 if (not $ct and my $r = $self->response)
1081 0 0 if defined $ct
1146 0 0 if ($tag)
1147 0 0 if (not exists $link_spec{$tag}) { }
1155 0 0 if ($tag eq "meta")
1157 0 0 if ($content =~ /^\d+\s*;\s*url\s*=\s*(\S+)/i) { }
1159 0 0 unless $url =~ s/^"(.+)"$/$1/
1166 0 0 if (defined $url) { }
1292 0 0 unless $xpath_quote{$1}
1301 0 0 unless keys %$p
1303 0 0 if defined $p->{'url'} and not $link->url eq $p->{'url'}
1304 0 0 if defined $p->{'url_regex'} and not $link->url =~ /$p->{'url_regex'}/
1305 0 0 if defined $p->{'url_abs'} and not $link->url_abs eq $p->{'url_abs'}
1306 0 0 if defined $p->{'url_abs_regex'} and not $link->url_abs =~ /$p->{'url_abs_regex'}/
1307 0 0 if defined $p->{'text'} and not defined $link->text && $link->text eq $p->{'text'}
1308 0 0 if defined $p->{'text_regex'} and not defined $link->text && $link->text =~ /$p->{'text_regex'}/
1309 0 0 if defined $p->{'name'} and not defined $link->name && $link->name eq $p->{'name'}
1310 0 0 if defined $p->{'name_regex'} and not defined $link->name && $link->name =~ /$p->{'name_regex'}/
1311 0 0 if defined $p->{'tag'} and not $link->tag && $link->tag eq $p->{'tag'}
1312 0 0 if defined $p->{'tag_regex'} and not $link->tag && $link->tag =~ /$p->{'tag_regex'}/
1314 0 0 if defined $p->{'id'} and not $link->attrs->{'id'} && $link->attrs->{'id'} eq $p->{'id'}
1315 0 0 if defined $p->{'id_regex'} and not $link->attrs->{'id'} && $link->attrs->{'id'} =~ /$p->{'id_regex'}/
1316 0 0 if defined $p->{'class'} and not $link->attrs->{'class'} && $link->attrs->{'class'} eq $p->{'class'}
1317 0 0 if defined $p->{'class_regex'} and not $link->attrs->{'class'} && $link->attrs->{'class'} =~ /$p->{'class_regex'}/
1329 0 0 if (exists $opts{$_})
1336 0 0 if ($single and exists $opts{'n'})
1340 0 0 if $n ne "all"
1359 0 0 if length $op
1362 0 0 if (exists $opts{$key})
1369 0 0 if (my $p = delete $opts{'url'})
1373 0 0 if (my $p = delete $opts{'tag'})
1376 0 0 if (my $p = delete $opts{'tag_regex'})
1381 0 0 exists $link_spec{$_} ? :
1383 0 0 if (@full) { }
1393 0 0 if (keys %opts)
1404 0 0 if ($one)
1405 0 0 if (0 == @res)
1406 0 0 if ($single)
1407 0 0 if (1 < @res)
1416 0 0 if ($n eq "all")
1440 0 0 if "all" eq ($opts{'n'} || '')
1441 0 0 if (my $link = $self->find_link_dom('frames', 0, %opts)) { }
1470 0 0 if wantarray
1493 0 0 if wantarray
1513 0 0 if (@_ == 2) { }
1537 0 0 unless ($doc->{'__path'})
1554 0 0 unless ($just_parent)
1561 0 0 if ("html" ne $tag and "" ne $tag)
1571 0 0 if ($body)
1680 0 0 if ("ARRAY" ne (ref $query || ''))
1684 0 0 unless (exists $options{'frames'})
1701 0 0 unless (exists $options{'all'} or $return_first_element)
1702 0 0 if defined wantarray and not wantarray
1713 0 0 if ($options{'document'})
1739 0 0 if ($options{'node'}) { }
1754 0 0 unless (@found)
1779 0 0 if ($options{'frames'} and not $options{'node'})
1799 0 0 if (not $zero_allowed and @res == 0)
1802 0 0 if (not $two_allowed and @res > 1)
1808 0 0 $return_first_element ? :
1831 0 0 if ("ARRAY" ne (ref $query || ''))
1897 0 0 if (not defined $name) { }
0 0 elsif (ref $name and builtin::blessed($name) and $name->can('click')) { }
0 0 elsif (ref $name eq 'HASH') { }
1907 0 0 if (exists $options{'name'})
1912 0 0 if ($options{'name'} eq "")
1920 0 0 if ($options{'dom'}) { }
1929 0 0 if (defined wantarray)
1947 0 0 if (exists $options{$meth})
1953 0 0 unless $method
1961 0 0 unless (grep {exists $options->{$_};} "single", "one", "maybe", "all", "any")
2010 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'}) { }
2034 0 0 if ($node) { }
2064 0 0 unless $self->{'current_form'}
2077 0 0 unless ($focus)
2109 0 0 if ($type = $f->get_attribute('type') || '')
2200 0 0 if (ref $fields[0] eq "HASH")
2237 0 0 wantarray ? :
2298 0 0 if (@_ == 3) { }
2330 0 0 if ($name =~ s/^\^//) { }
0 0 elsif ($name =~ s/^#//) { }
0 0 elsif ($name =~ s/^\.//) { }
2337 0 0 if (builtin::blessed($name)) { }
2368 0 0 unless ref $pre
2370 0 0 unless ref $post
2373 0 0 if ($fields[0]) { }
2375 0 0 if ($set_value)
2382 0 0 $value ? :
2401 0 0 unless defined wantarray
2405 0 0 if ('SELECT' eq uc $tag) { }
2408 0 0 if (wantarray) { }
2437 0 0 if ($dom_form) { }
2501 0 0 unless ($form)
2502 0 0 if ($fields = delete $options{'with_fields'}) { }
2505 0 0 unless ($form)
2515 0 0 unless ($form)
2522 0 0 if ($options{'button'}) { }
2550 0 0 unless ($f)
2562 0 0 if (ref $v)
2564 0 0 unless $num == 1
2587 0 0 ref $spec ? :
2590 0 0 if (not ref $spec || $spec =~ /\D/ and $spec == 1)
2597 0 0 if (not grep({ref $_;} @spec)) { }
2606 0 0 ref $_ ? :
2691 0 0 if builtin::blessed($e) and $e->isa("Selenium::Remote::WebElement")
2695 0 0 unless $res->{'id'}
2734 0 0 if (scalar keys %$rect)
2805 0 0 unless my $element = delete $options{'element'}
2874 0 0 unless ($outname)
2891 0 0 if ($wantresult)
2892 0 0 unless open my $fh, "<", $outname
2900 0 0 unless unlink $_
2984 0 0 if ($self->{'report_js_errors'})
2985 0 0 if (my(@errors) = $self->js_errors)
2998 0 0 @{$_->{'trace'};} ? :
0 0 @{$_->{'trace'};} && $_->{'trace'}[-1]{'function'} ? :