line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Alien::Selenium; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
83730
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
126
|
|
4
|
3
|
|
|
3
|
|
19
|
use warnings; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
89
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
4007
|
use File::Copy (); |
|
3
|
|
|
|
|
26592
|
|
|
3
|
|
|
|
|
86
|
|
7
|
3
|
|
|
3
|
|
25
|
use File::Path (); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
65
|
|
8
|
3
|
|
|
3
|
|
15
|
use File::Basename qw(dirname); |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
381
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Alien::Selenium - installing and finding the Selenium Web test framework |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 SYNOPSIS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
use Alien::Selenium; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $version = Alien::Selenium->version; |
19
|
|
|
|
|
|
|
my $path = Alien::Selenium->path; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Alien::Selenium->install( $destination_directory ); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Please see L for the manifesto of the Alien namespace. |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=cut |
28
|
|
|
|
|
|
|
|
29
|
3
|
|
|
3
|
|
17
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
2690
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
our $VERSION = '0.09'; |
32
|
|
|
|
|
|
|
our $SELENIUM_VERSION = '0.8.3'; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=over |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=item I |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Returns the version of Selenium that is contained within this Alien |
39
|
|
|
|
|
|
|
package (not to be confused with $Alien::Selenium::VERSION, which is |
40
|
|
|
|
|
|
|
the version number of the Perl wrapper) |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
1
|
1
|
32
|
sub version { $SELENIUM_VERSION } |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=item I |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Returns the path where a file-for-file copy of the Selenium core has |
49
|
|
|
|
|
|
|
been installed as part of the Alien::Selenium Perl package. One may |
50
|
|
|
|
|
|
|
direct one's webserver to serve files directly off I, or |
51
|
|
|
|
|
|
|
alternatively use L. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub path { |
56
|
1
|
|
|
1
|
1
|
5
|
my $base = $INC{'Alien/Selenium.pm'}; |
57
|
|
|
|
|
|
|
|
58
|
1
|
|
|
|
|
7
|
$base =~ s{\.pm$}{/javascript}; |
59
|
|
|
|
|
|
|
|
60
|
1
|
|
|
|
|
3
|
return $base; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=item I |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Install a copy of the contents of L into $dest_dir, which need |
66
|
|
|
|
|
|
|
not exist beforehand. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub install { |
71
|
1
|
|
|
1
|
1
|
2124
|
my( $class, $dest_dir ) = @_; |
72
|
|
|
|
|
|
|
|
73
|
1
|
|
|
|
|
212
|
File::Path::mkpath $dest_dir; |
74
|
|
|
|
|
|
|
|
75
|
1
|
|
|
|
|
6
|
my $path = $class->path(); |
76
|
1
|
|
|
|
|
548
|
foreach my $f ( grep { -f $_ } |
|
13
|
|
|
|
|
300
|
|
77
|
|
|
|
|
|
|
glob "$path/*" ) { |
78
|
13
|
50
|
|
|
|
5572
|
File::Copy::copy( $f, $dest_dir ) |
79
|
|
|
|
|
|
|
or die "Can't copy $f to $dest_dir: $!"; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item I |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Returns the path to the C Mozilla/Firefox extension |
86
|
|
|
|
|
|
|
that is part of Selenium starting at version 0.8.0. Returns undef for |
87
|
|
|
|
|
|
|
versions of Selenium that do not have such a file. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub path_readystate_xpi { |
92
|
2
|
|
|
2
|
1
|
680
|
my $base = $INC{'Alien/Selenium.pm'}; |
93
|
|
|
|
|
|
|
|
94
|
2
|
|
|
|
|
12
|
$base =~ s{\.pm$}{/xpi/readyState.xpi}; |
95
|
2
|
50
|
|
|
|
100
|
return if ! -f $base; |
96
|
2
|
|
|
|
|
42
|
return $base; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item I |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Installs the C file as $targetfile, creating any |
102
|
|
|
|
|
|
|
missing directories if needed. Croaks if there is no |
103
|
|
|
|
|
|
|
C in this version of Selenium (see |
104
|
|
|
|
|
|
|
L). |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=cut |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub install_readystate_xpi { |
109
|
1
|
|
|
1
|
1
|
3
|
my ($class, $targetfile) = @_; |
110
|
|
|
|
|
|
|
|
111
|
1
|
50
|
|
|
|
5
|
die "no readyState.xpi in this version of Selenium ($SELENIUM_VERSION)" |
112
|
|
|
|
|
|
|
unless defined(my $srcfile = $class->path_readystate_xpi()); |
113
|
|
|
|
|
|
|
|
114
|
1
|
|
|
|
|
227
|
File::Path::mkpath (dirname($targetfile)); |
115
|
1
|
50
|
|
|
|
8
|
File::Copy::copy($srcfile, $targetfile) |
116
|
|
|
|
|
|
|
or die "Can't copy $srcfile to $targetfile: $!"; |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=back |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 AUTHOR |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Mattia Barbon |
124
|
|
|
|
|
|
|
Dominique Quatravaux |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 LICENSE |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Copyright (c) 2005-2006 Mattia Barbon |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or |
131
|
|
|
|
|
|
|
modify it under the same terms as Perl itself |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Please notice that Selenium comes with its own licence. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=cut |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
1; |