line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Alien::SeleniumRC; |
2
|
1
|
|
|
1
|
|
69272
|
use strict; |
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
28
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
55
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '3.7'; |
6
|
|
|
|
|
|
|
our $SELENIUM_SERVER_VERSION = '3.141.59'; # Reminder: Update version in doc below |
7
|
|
|
|
|
|
|
our $VERBOSE = 1; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
28
|
use 5.006; |
|
1
|
|
|
|
|
4
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub start { |
12
|
3
|
|
100
|
3
|
1
|
1491
|
my $args = shift || ''; |
13
|
3
|
|
|
|
|
7
|
my $jarfile = find_jar_location(); |
14
|
|
|
|
|
|
|
|
15
|
3
|
|
|
|
|
10
|
my $cmd = "java -jar $jarfile $args"; |
16
|
3
|
50
|
|
|
|
10
|
if ( $ENV{SELENIUMRC_USE_SIC} ) { |
17
|
0
|
|
|
|
|
0
|
$cmd = "sudo /usr/libexec/StartupItemContext `which java` -jar $jarfile $args"; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
3
|
50
|
|
|
|
6
|
print "Running $cmd\n" if $VERBOSE; |
21
|
3
|
|
|
|
|
9
|
my $ret = system($cmd); |
22
|
3
|
50
|
|
|
|
17
|
die "Failed to run '$cmd': $!" if $ret == -1; |
23
|
3
|
50
|
|
|
|
9
|
print "Selenium server has finished\n" if $VERBOSE; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub help { |
27
|
|
|
|
|
|
|
# ignore the return code of selenium-server.jar -help |
28
|
1
|
|
|
1
|
1
|
587
|
start('-help'); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub find_jar_location { |
32
|
4
|
|
|
4
|
0
|
92
|
my $pm_location = $INC{'Alien/SeleniumRC.pm'}; |
33
|
4
|
|
|
|
|
20
|
(my $src_location = $pm_location) =~ s#\.pm#/selenium-server.jar#; |
34
|
|
|
|
|
|
|
|
35
|
4
|
50
|
|
|
|
15
|
if ($^O eq 'cygwin') { |
36
|
0
|
|
|
|
|
0
|
$src_location = `cygpath -m '$src_location'`; |
37
|
0
|
|
|
|
|
0
|
chomp $src_location; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
4
|
50
|
|
|
|
72
|
die "Can't find $src_location!" unless -e $src_location; |
41
|
4
|
|
|
|
|
20
|
return $src_location; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 NAME |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Alien::SeleniumRC - Packages the Selenium Remote Control server. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head1 SYNOPSIS |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
use Alien::SeleniumRC; |
53
|
|
|
|
|
|
|
Alien::SeleniumRC::start(); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 DESCRIPTION |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
The Selenium Server (formerly known as Selenium RC Server) is at |
58
|
|
|
|
|
|
|
L |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Selenium Server is a test tool that allows you to write automated web |
61
|
|
|
|
|
|
|
application UI tests in any programming language against any HTTP |
62
|
|
|
|
|
|
|
website using any mainstream JavaScript-enabled browser. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
The Selenium Server is needed in order to run either Selenium RC style |
65
|
|
|
|
|
|
|
scripts or Remote Selenium Webdriver ones. The 2.x server is a drop-in |
66
|
|
|
|
|
|
|
replacement for the old Selenium RC server and is designed to be |
67
|
|
|
|
|
|
|
backwards compatible with your existing infrastructure. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Selenium Server can automatically start/stop/control any supported |
70
|
|
|
|
|
|
|
browser. It works by using Selenium Core, a pure-HTML+JS library that |
71
|
|
|
|
|
|
|
performs automated tasks in JavaScript. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 METHODS |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 C |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
This method launches the Selenium Server bundled in this package. |
78
|
|
|
|
|
|
|
This call will block until the server is killed. The method will throw |
79
|
|
|
|
|
|
|
an exception with C if the C call returns an error. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
The first argument passed to start() will be passed to |
82
|
|
|
|
|
|
|
selenium-server.jar as a command line argument. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 C |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Prints the selenium-server.jar usage. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 UPDATING SELENIUM-SERVER.JAR |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
A copy of C is installed in the C |
91
|
|
|
|
|
|
|
module directory. The Selenium RC version in this distribution is |
92
|
|
|
|
|
|
|
B, released 2018-11-14. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
To update your local copy, download SeleniumRC from L |
95
|
|
|
|
|
|
|
and extract the file C. Copy it to the Alien::SeleniumRC |
96
|
|
|
|
|
|
|
module directory. On most systems, you can find that path by typing |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
perldoc -l Alien::SeleniumRC |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 ENVIRONMENT VARIABLES |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Previous versions of L used C to launch the |
103
|
|
|
|
|
|
|
Java process using C when running under any |
104
|
|
|
|
|
|
|
version of Mac OSX. Running C in the middle of automated test |
105
|
|
|
|
|
|
|
suites can be problematic and not always required so from 1.01 on this |
106
|
|
|
|
|
|
|
is no longer the default behaviour. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
To get the old behaviour back, set the environment variable |
109
|
|
|
|
|
|
|
C to a true value before calling C. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 SEE ALSO |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
L, L |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Selenium Server home page: L |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Selenium home page: L |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 LICENSE |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
This software is released under the same terms as perl itself. |
122
|
|
|
|
|
|
|
If you don't know what that means visit http://perl.com/ |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Copyright 2006 by Luke Closs |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
All rights Reserved |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 AUTHOR |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Luke Closs |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Cygwin support provided by: Kevin Jones |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Co-maintainer Daniel Austin |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=cut |