| 1 | package Selenium::Specification; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 2 | $Selenium::Specification::VERSION = '1.06'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # ABSTRACT: Module for building a machine readable specification for Selenium | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 v5.28; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | no warnings 'experimental'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use feature qw/signatures state unicode_strings/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 2 | ▶ | use List::Util qw{uniq}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 2 | ▶ | use HTML::Parser(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 2 | ▶ | use JSON::MaybeXS(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 2 | ▶ | use File::HomeDir(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 2 | ▶ | use File::Slurper(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 2 | ▶ | use DateTime::Format::HTTP(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 2 | ▶ | use HTTP::Tiny(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 2 | ▶ | use File::Path qw{make_path}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 2 | ▶ | use File::Spec(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 2 | ▶ | use Encode qw{decode}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 2 | ▶ | use Unicode::Normalize qw{NFC}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | #TODO make a JSONWire JSON spec since it's not changing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | # URLs and the container ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 2 | our %spec_urls = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | unstable => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | url => 'https://w3c.github.io/webdriver/', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | section_id => 'endpoints', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | draft => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | url => "https://www.w3.org/TR/webdriver2/", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | section_id => 'endpoints', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | stable => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | url => "https://www.w3.org/TR/webdriver1/", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | section_id => 'list-of-endpoints', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 2 | our $browser = HTTP::Tiny->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 2 | my %state; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 2 | my $parse = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 2 | our $method = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | sub read($client_dir, $type='stable', $nofetch=1, $hardcode=1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | my $buf; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | state $static; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | if (!$hardcode) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | my $dir = File::Spec->catdir( $client_dir,"specs" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | my $file = File::Spec->catfile( "$dir","$type.json"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | fetch( once => $nofetch, dir => $dir ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | die "could not write $file: $@" unless -f $file; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | $buf = File::Slurper::read_binary($file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | $static = readline(DATA) unless $static; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | $buf = $static; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | my $array = JSON::MaybeXS->new()->utf8()->decode($buf); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | my %hash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | @hash{map { $_->{name} } @$array} = @$array; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | return \%hash; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | #TODO needs to grab args and argtypes still | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | ▶ | sub fetch (%options) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fetch: not called CC=14 SCAR=53.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | my $dir = $options{dir}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | my $rc = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | foreach my $spec ( sort keys(%spec_urls) ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | make_path( $dir ) unless -d $dir; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | my $file = File::Spec->catfile( "$dir","$spec.json"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | my $last_modified = -f $file ? (stat($file))[9] : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | if ($options{once} && $last_modified) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$options{"once"} and $last_modified
MC/DC0%0/2
$options{"once"} and $last_modified
$options{"once"}
$last_modified
Truth table0%0/3
A and B
A= $options{"once"}B= $last_modified
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | print STDERR "Skipping fetch, using cached result" if $options{verbose}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | $last_modified = 0 if $options{force}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | my $spc = _build_spec($last_modified, %{$spec_urls{$spec}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | ▶ | if (!$spc) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | print STDERR "Could not retrieve $spec_urls{$spec}{url}, skipping" if $options{verbose}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | $rc = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | # Second clause is for an edge case -- if the header is not set for some bizarre reason we should obey force still | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | if (ref $spc ne 'ARRAY' && $last_modified) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $spc ne "ARRAY" and $last_modified
MC/DC0%0/2
ref $spc ne "ARRAY" and $last_modified
ref $spc ne "ARRAY"
$last_modified
Truth table0%0/3
A and B
A= ref $spc ne "ARRAY"B= $last_modified
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | ▶ | print STDERR "Keeping cached result '$file', as page has not changed since last fetch.\n" if $options{verbose}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | _write_spec($spc, $file); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | ▶ | print "Wrote $file\n" if $options{verbose}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | return $rc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | ▶ | sub _write_spec ($spec, $file) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_write_spec: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | my $spec_json = JSON::MaybeXS->new()->utf8()->encode($spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | return File::Slurper::write_binary($file, $spec_json); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | ▶ | sub _build_spec($last_modified, %spec) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_spec: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | my $page = $browser->get($spec{url}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | return unless $page->{success}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | if ($page->{headers}{'last-modified'} && $last_modified ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$page->{"headers"}{"last-modified"} and $last_modified
MC/DC0%0/2
$page->{"headers"}{"last-modified"} and $last_modified
$page->{"headers"}{"last-modified"}
$last_modified
Truth table0%0/3
A and B
A= $page->{"headers"}{"last-modified"}B= $last_modified
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | my $modified = DateTime::Format::HTTP->parse_datetime($page->{headers}{'last-modified'})->epoch(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | return 'cache' if $modified < $last_modified; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | my $html = NFC( decode('UTF-8', $page->{content}) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | $parse = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | %state = ( id => $spec{section_id} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | my $parser = HTML::Parser->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | handlers => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | start => [\&_handle_open, "tagname,attr"], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | end => [\&_handle_close, "tagname"], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | text => [\&_handle_text, "text"], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | $parser->parse($html); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | # Now that we have parsed the methods, let us go ahead and build the argspec based on the anchors for each endpoint. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | foreach my $m (@$parse) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | $method = $m; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | %state = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | my $mparser = HTML::Parser->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | handlers => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | start => [\&_endpoint_open, "tagname,attr"], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | end => [\&_endpoint_close, "tagname"], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | text => [\&_endpoint_text, "text"], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | $mparser->parse($html); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | return _fixup(\%spec,$parse); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | ▶ | sub _fixup($spec,$parse) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fixup: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | @$parse = map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | $_->{href} = "$spec->{url}$_->{href}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | #XXX correct TYPO in the spec | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | $_->{uri} =~ s/{sessionid\)/{sessionid}/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | @{$_->{output_params}} = grep { $_ ne 'null' } uniq @{$_->{output_params}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | $_ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | } @$parse; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | return $parse; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | ▶ | sub _handle_open($tag,$attr) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_handle_open: not called CC=9 SCAR=45.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | if ( $tag eq 'section' && ($attr->{id} || '') eq $state{id} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/5
$tag eq "section" and ($attr->{"id"} || "") eq $state{"id"}
$attr->{'id'} || ''
MC/DC0%0/2
$tag eq "section" and ($attr->{"id"} || "") eq $state{"id"}
$tag eq "section"
$attr->{'id'}
Truth table0%0/3
A and B
A= $tag eq "section"B= $attr->{'id'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | $state{active} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | if ($tag eq 'tr') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | $state{method} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | $state{headers} = [qw{method uri name}]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | $state{data} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | ▶ | if ($tag eq 'td') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | $state{heading} = shift @{$state{headers}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | ▶ | if ($tag eq 'a' && $state{heading} && $attr->{href}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$tag eq "a" and $state{"heading"} and $attr->{"href"}
$tag eq "a" and $state{"heading"}
MC/DC0%0/3
$tag eq "a" and $state{"heading"} and $attr->{"href"}
$tag eq "a"
$state{"heading"}
$attr->{"href"}
Truth table0%0/4
A and B and C
A= $tag eq "a"B= $state{"heading"}C= $attr->{"href"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | $state{data}{href} = $attr->{href}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | ▶ | sub _handle_close($tag) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_handle_close: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | if ($tag eq 'section') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | $state{active} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | if ($tag eq 'tr' && $state{active}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$tag eq "tr" and $state{"active"}
MC/DC0%0/2
$tag eq "tr" and $state{"active"}
$tag eq "tr"
$state{"active"}
Truth table0%0/3
A and B
A= $tag eq "tr"B= $state{"active"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | if ($state{past_first}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | push(@$parse, $state{data}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | $state{past_first} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | $state{method} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | ▶ | sub _handle_text($text) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_handle_text: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | return unless $state{active} && $state{method} && $state{past_first} && $state{heading}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$state{"active"} and $state{"method"} and $state{"past_first"} and $state{"heading"}
$state{"active"} and $state{"method"} and $state{"past_first"}
$state{"active"} and $state{"method"}
MC/DC0%0/4
$state{"active"} and $state{"method"} and $state{"past_first"} and $state{"heading"}
$state{"active"}
$state{"method"}
$state{"past_first"}
$state{"heading"}
Truth table0%0/5
A and B and C and D
A= $state{"active"}B= $state{"method"}C= $state{"past_first"}D= $state{"heading"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | $text =~ s/\s//gm; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | return unless $text; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | $state{data}{$state{heading}} .= $text; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | # Endpoint parsers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | ▶ | sub _endpoint_open($tag,$attr) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_endpoint_open: not called CC=11 SCAR=48.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | my $id = $method->{href}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | $id =~ s/^#//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 0 | ▶ | if ($attr->{id} && $attr->{id} eq $id) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$attr->{"id"} and $attr->{"id"} eq $id
MC/DC0%0/2
$attr->{"id"} and $attr->{"id"} eq $id
$attr->{"id"}
$attr->{"id"} eq $id
Truth table0%0/3
A and B
A= $attr->{"id"}B= $attr->{"id"} eq $id
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | $state{active} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | ▶ | if ($tag eq 'ol') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 0 | $state{in_tag} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | if ($tag eq 'dt' && $state{in_tag} && $state{last_tag} eq 'dl') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$tag eq "dt" and $state{"in_tag"} and $state{"last_tag"} eq "dl"
$tag eq "dt" and $state{"in_tag"}
MC/DC0%0/3
$tag eq "dt" and $state{"in_tag"} and $state{"last_tag"} eq "dl"
$tag eq "dt"
$state{"in_tag"}
$state{"last_tag"} eq "dl"
Truth table0%0/4
A and B and C
A= $tag eq "dt"B= $state{"in_tag"}C= $state{"last_tag"} eq "dl"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | $state{in_dt} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | if ($tag eq 'code' && $state{in_dt} && $state{in_tag} && $state{last_tag} eq 'dt') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$tag eq "code" and $state{"in_dt"} and $state{"in_tag"} and $state{"last_tag"} eq "dt"
$tag eq "code" and $state{"in_dt"} and $state{"in_tag"}
$tag eq "code" and $state{"in_dt"}
MC/DC0%0/4
$tag eq "code" and $state{"in_dt"} and $state{"in_tag"} and $state{"last_tag"} eq "dt"
$tag eq "code"
$state{"in_dt"}
$state{"in_tag"}
$state{"last_tag"} eq "dt"
Truth table0%0/5
A and B and C and D
A= $tag eq "code"B= $state{"in_dt"}C= $state{"in_tag"}D= $state{"last_tag"} eq "dt"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | $state{in_code} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | $state{last_tag} = $tag; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | ▶ | sub _endpoint_close($tag) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_endpoint_close: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | return unless $state{active}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | ▶ | if ($tag eq 'section') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | $state{active} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | $state{in_tag} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | ▶ | if ($tag eq 'ol') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | $state{in_tag} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | ▶ | if ($tag eq 'dt') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | $state{in_dt} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | ▶ | if ($tag eq 'code') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | $state{in_code} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | ▶ | sub _endpoint_text($text) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_endpoint_text: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | if ($state{active} && $state{in_tag} && $state{in_code} && $state{in_dt} && $state{last_tag} eq 'code') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/12
$state{"active"} and $state{"in_tag"} and $state{"in_code"} and $state{"in_dt"} and $state{"last_tag"} eq "code"
$state{"active"} and $state{"in_tag"} and $state{"in_code"} and $state{"in_dt"}
$state{"active"} and $state{"in_tag"} and $state{"in_code"}
$state{"active"} and $state{"in_tag"}
MC/DC0%0/5
$state{"active"} and $state{"in_tag"} and $state{"in_code"} and $state{"in_dt"} and $state{"last_tag"} eq "code"
$state{"active"}
$state{"in_tag"}
$state{"in_code"}
$state{"in_dt"}
$state{"last_tag"} eq "code"
Truth table0%0/6
A and B and C and D and E
A= $state{"active"}B= $state{"in_tag"}C= $state{"in_code"}D= $state{"in_dt"}E= $state{"last_tag"} eq "code"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | $method->{output_params} //= []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$Selenium::Specification::method->{"output_params"} //= []
MC/DC0%0/1
$Selenium::Specification::method->{"output_params"} //= []
$Selenium::Specification::method->{"output_params"}
Truth table0%0/2
A
A= $Selenium::Specification::method->{"output_params"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | $text =~ s/\s//gm; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | push(@{$method->{output_params}},$text) if $text; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | =encoding UTF-8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | Selenium::Specification - Module for building a machine readable specification for Selenium | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | version 1.06 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | =head1 SUBROUTINES | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | =head2 read($client_dir STRING, $type STRING, $nofetch BOOL, $hardcoe BOOL) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | Reads the copy of the provided spec type, and fetches it if a cached version is not available. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | If hardcode is passed we use the JSON in the DATA section below. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | =head2 fetch(%OPTIONS HASH) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | Builds a spec hash based upon the WC3 specification documents, and writes it to disk. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | George S. Baugh <george@troglodyne.net> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | This software is Copyright (c) 2023 by George S. Baugh. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | This is free software, licensed under: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | The MIT (X11) License | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | __DATA__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | [{"output_params":["capabilities","sessionId"],"href":"https://www.w3.org/TR/webdriver1/#dfn-creating-a-new-session","uri":"/session","name":"NewSession","method":"POST"},{"href":"https://www.w3.org/TR/webdriver1/#dfn-delete-session","output_params":[],"uri":"/session/{sessionid}","method":"DELETE","name":"DeleteSession"},{"method":"GET","name":"Status","uri":"/status","href":"https://www.w3.org/TR/webdriver1/#dfn-status","output_params":["ready"]},{"method":"GET","name":"GetTimeouts","uri":"/session/{sessionid}/timeouts","output_params":["script"],"href":"https://www.w3.org/TR/webdriver1/#dfn-get-timeouts"},{"output_params":["script"],"href":"https://www.w3.org/TR/webdriver1/#dfn-timeouts","name":"SetTimeouts","method":"POST","uri":"/session/{sessionid}/timeouts"},{"method":"POST","name":"NavigateTo","uri":"/session/{sessionid}/url","href":"https://www.w3.org/TR/webdriver1/#dfn-navigate-to","output_params":["https://example.com"]},{"href":"https://www.w3.org/TR/webdriver1/#dfn-get-current-url","output_params":[],"method":"GET","name":"GetCurrentURL","uri":"/session/{sessionid}/url"},{"href":"https://www.w3.org/TR/webdriver1/#dfn-back","output_params":["window.history.back"],"uri":"/session/{sessionid}/back","method":"POST","name":"Back"},{"output_params":["pageHide"],"href":"https://www.w3.org/TR/webdriver1/#dfn-forward","name":"Forward","method":"POST","uri":"/session/{sessionid}/forward"},{"output_params":["file"],"href":"https://www.w3.org/TR/webdriver1/#dfn-refresh","method":"POST","name":"Refresh","uri":"/session/{sessionid}/refresh"},{"href":"https://www.w3.org/TR/webdriver1/#dfn-get-title","output_params":["document.title"],"uri":"/session/{sessionid}/title","name":"GetTitle","method":"GET"},{"method":"GET","name":"GetWindowHandle","uri":"/session/{sessionid}/window","href":"https://www.w3.org/TR/webdriver1/#dfn-get-window-handle","output_params":[]},{"output_params":[],"href":"https://www.w3.org/TR/webdriver1/#dfn-close-window","name":"CloseWindow","method":"DELETE","uri":"/session/{sessionid}/window"},{"name":"SwitchToWindow","method":"POST","uri":"/session/{sessionid}/window","output_params":["handle"],"href":"https://www.w3.org/TR/webdriver1/#dfn-switch-to-window"},{"uri":"/session/{sessionid}/window/handles","name":"GetWindowHandles","method":"GET","output_params":[],"href":"https://www.w3.org/TR/webdriver1/#dfn-get-window-handles"},{"name":"SwitchToFrame","method":"POST","uri":"/session/{sessionid}/frame","output_params":["id"],"href":"https://www.w3.org/TR/webdriver1/#dfn-switch-to-frame"},{"uri":"/session/{sessionid}/frame/parent","name":"SwitchToParentFrame","method":"POST","href":"https://www.w3.org/TR/webdriver1/#dfn-switch-to-parent-frame","output_params":[]},{"uri":"/session/{sessionid}/window/rect","method":"GET","name":"GetWindowRect","output_params":[],"href":"https://www.w3.org/TR/webdriver1/#dfn-get-window-rect"},{"href":"https://www.w3.org/TR/webdriver1/#dfn-set-window-rect","output_params":["width"],"name":"SetWindowRect","method":"POST","uri":"/session/{sessionid}/window/rect"},{"uri":"/session/{sessionid}/window/maximize","method":"POST","name":"MaximizeWindow","href":"https://www.w3.org/TR/webdriver1/#dfn-maximize-window","output_params":[]},{"output_params":[],"href":"https://www.w3.org/TR/webdriver1/#dfn-minimize-window","name":"MinimizeWindow","method":"POST","uri":"/session/{sessionid}/window/minimize"},{"method":"POST","name":"FullscreenWindow","uri":"/session/{sessionid}/window/fullscreen","href":"https://www.w3.org/TR/webdriver1/#dfn-fullscreen-window","output_params":[]},{"uri":"/session/{sessionid}/element/active","method":"GET","name":"GetActiveElement","href":"https://www.w3.org/TR/webdriver1/#dfn-get-active-element","output_params":[]},{"output_params":["#toremove"],"href":"https://www.w3.org/TR/webdriver1/#dfn-find-element","uri":"/session/{sessionid}/element","method":"POST","name":"FindElement"},{"href":"https://www.w3.org/TR/webdriver1/#dfn-find-elements","output_params":["using"],"name":"FindElements","method":"POST","uri":"/session/{sessionid}/elements"},{"uri":"/session/{sessionid}/element/{elementid}/element","name":"FindElementFromElement","method":"POST","href":"https://www.w3.org/TR/webdriver1/#dfn-find-element-from-element","output_params":["using"]},{"method":"POST","name":"FindElementsFromElement","uri":"/session/{sessionid}/element/{elementid}/elements","output_params":["using"],"href":"https://www.w3.org/TR/webdriver1/#dfn-find-elements-from-element"},{"href":"https://www.w3.org/TR/webdriver1/#dfn-is-element-selected","output_params":["input"],"uri":"/session/{sessionid}/element/{elementid}/selected","name":"IsElementSelected","method":"GET"},{"output_params":[],"href":"https://www.w3.org/TR/webdriver1/#dfn-get-element-attribute","method":"GET","name":"GetElementAttribute","uri":"/session/{sessionid}/element/{elementid}/attribute/{name}"},{"href":"https://www.w3.org/TR/webdriver1/#dfn-get-element-property","output_params":[],"uri":"/session/{sessionid}/element/{elementid}/property/{name}","name":"GetElementProperty","method":"GET"},{"name":"GetElementCSSValue","method":"GET","uri":"/session/{sessionid}/element/{elementid}/css/{propertyname}","href":"https://www.w3.org/TR/webdriver1/#dfn-get-element-css-value","output_params":["xml"]},{"name":"GetElementText","method":"GET","uri":"/session/{sessionid}/element/{elementid}/text","href":"https://www.w3.org/TR/webdriver1/#dfn-get-element-text","output_params":["a"]},{"uri":"/session/{sessionid}/element/{elementid}/name","name":"GetElementTagName","method":"GET","output_params":[],"href":"https://www.w3.org/TR/webdriver1/#dfn-get-element-tag-name"},{"method":"GET","name":"GetElementRect","uri":"/session/{sessionid}/element/{elementid}/rect","href":"https://www.w3.org/TR/webdriver1/#dfn-get-element-rect","output_params":["x"]},{"method":"GET","name":"IsElementEnabled","uri":"/session/{sessionid}/element/{elementid}/enabled","href":"https://www.w3.org/TR/webdriver1/#dfn-is-element-enabled","output_params":["xml"]},{"output_params":["input"],"href":"https://www.w3.org/TR/webdriver1/#dfn-element-click","uri":"/session/{sessionid}/element/{elementid}/click","method":"POST","name":"ElementClick"},{"uri":"/session/{sessionid}/element/{elementid}/clear","name":"ElementClear","method":"POST","output_params":["innerHTML"],"href":"https://www.w3.org/TR/webdriver1/#dfn-element-clear"},{"method":"POST","name":"ElementSendKeys","uri":"/session/{sessionid}/element/{elementid}/value","href":"https://www.w3.org/TR/webdriver1/#dfn-element-send-keys","output_params":["type"]},{"href":"https://www.w3.org/TR/webdriver1/#dfn-get-page-source","output_params":["true"],"uri":"/session/{sessionid}/source","method":"GET","name":"GetPageSource"},{"method":"POST","name":"ExecuteScript","uri":"/session/{sessionid}/execute/sync","href":"https://www.w3.org/TR/webdriver1/#dfn-execute-script","output_params":[]},{"uri":"/session/{sessionid}/execute/async","name":"ExecuteAsyncScript","method":"POST","output_params":["unset"],"href":"https://www.w3.org/TR/webdriver1/#dfn-execute-async-script"},{"method":"GET","name":"GetAllCookies","uri":"/session/{sessionid}/cookie","href":"https://www.w3.org/TR/webdriver1/#dfn-get-all-cookies","output_params":[]},{"uri":"/session/{sessionid}/cookie/{name}","name":"GetNamedCookie","method":"GET","output_params":[],"href":"https://www.w3.org/TR/webdriver1/#dfn-get-named-cookie"},{"href":"https://www.w3.org/TR/webdriver1/#dfn-adding-a-cookie","output_params":["cookie"],"method":"POST","name":"AddCookie","uri":"/session/{sessionid}/cookie"},{"uri":"/session/{sessionid}/cookie/{name}","name":"DeleteCookie","method":"DELETE","href":"https://www.w3.org/TR/webdriver1/#dfn-delete-cookie","output_params":[]},{"uri":"/session/{sessionid}/cookie","name":"DeleteAllCookies","method":"DELETE","output_params":[],"href":"https://www.w3.org/TR/webdriver1/#dfn-delete-all-cookies"},{"uri":"/session/{sessionid}/actions","name":"PerformActions","method":"POST","output_params":[],"href":"https://www.w3.org/TR/webdriver1/#dfn-perform-actions"},{"href":"https://www.w3.org/TR/webdriver1/#dfn-release-actions","output_params":[],"name":"ReleaseActions","method":"DELETE","uri":"/session/{sessionid}/actions"},{"href":"https://www.w3.org/TR/webdriver1/#dfn-dismiss-alert","output_params":[],"uri":"/session/{sessionid}/alert/dismiss","name":"DismissAlert","method":"POST"},{"output_params":[],"href":"https://www.w3.org/TR/webdriver1/#dfn-accept-alert","uri":"/session/{sessionid}/alert/accept","method":"POST","name":"AcceptAlert"},{"output_params":[],"href":"https://www.w3.org/TR/webdriver1/#dfn-get-alert-text","uri":"/session/{sessionid}/alert/text","name":"GetAlertText","method":"GET"},{"href":"https://www.w3.org/TR/webdriver1/#dfn-send-alert-text","output_params":["prompt"],"uri":"/session/{sessionid}/alert/text","method":"POST","name":"SendAlertText"},{"href":"https://www.w3.org/TR/webdriver1/#dfn-take-screenshot","output_params":["canvas"],"uri":"/session/{sessionid}/screenshot","name":"TakeScreenshot","method":"GET"},{"href":"https://www.w3.org/TR/webdriver1/#dfn-error-code","output_params":["error"],"uri":"/session/{sessionid}/element/{elementid}/screenshot","method":"GET","name":"TakeElementScreenshot"}] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||