|
@@ -107,10 +107,7 @@ sub BUILDARGS {
|
|
|
sub _build_binary_mode {
|
|
sub _build_binary_mode {
|
|
|
my ($self) = @_;
|
|
my ($self) = @_;
|
|
|
|
|
|
|
|
- my $port = $self->start_binary_on_port(
|
|
|
|
|
- $self->binary_name,
|
|
|
|
|
- $self->binary_port
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ my $port = $self->start_binary_on_port;
|
|
|
$self->port($port);
|
|
$self->port($port);
|
|
|
return 1;
|
|
return 1;
|
|
|
}
|
|
}
|
|
@@ -126,11 +123,12 @@ sub probe_port {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
sub start_binary_on_port {
|
|
sub start_binary_on_port {
|
|
|
- my ($self, $process, $port) = @_;
|
|
|
|
|
|
|
+ my ($self) = @_;
|
|
|
|
|
|
|
|
- my $executable = $self->_find_executable($process);
|
|
|
|
|
- $port = _find_open_port_above($port);
|
|
|
|
|
- if ($process eq 'firefox') {
|
|
|
|
|
|
|
+ my $executable = $self->_find_executable;
|
|
|
|
|
+ my $port = _find_open_port_above($self->binary_port);
|
|
|
|
|
+
|
|
|
|
|
+ if (ref($self) eq 'Selenium::Firefox') {
|
|
|
setup_firefox_binary_env($port);
|
|
setup_firefox_binary_env($port);
|
|
|
}
|
|
}
|
|
|
my $command = _construct_command($executable, $port);
|
|
my $command = _construct_command($executable, $port);
|
|
@@ -157,17 +155,20 @@ sub shutdown_binary {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
sub _find_executable {
|
|
sub _find_executable {
|
|
|
- my ($self, $binary) = @_;
|
|
|
|
|
|
|
+ my ($self) = @_;
|
|
|
|
|
|
|
|
- if ($self->has_binary_path) {
|
|
|
|
|
- if (-x $self->binary_path) {
|
|
|
|
|
- return $self->binary_path;
|
|
|
|
|
|
|
+ # If the user specified the full path to the binary, we don't have
|
|
|
|
|
+ # any work to do.
|
|
|
|
|
+ if ($self->has_binary) {
|
|
|
|
|
+ if (-x abs_path($self->binary)) {
|
|
|
|
|
+ return abs_path($self->binary);
|
|
|
}
|
|
}
|
|
|
else {
|
|
else {
|
|
|
- die 'The binary at "' . $self->binary_path . '" is not executable. Fix the path or chmod +x it as needed.';
|
|
|
|
|
|
|
+ die 'The binary at ' . $self->binary . ' is not executable. Choose the correct file or chmod +x it as needed.';
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ my $binary = $self->binary;
|
|
|
if ($binary eq 'firefox') {
|
|
if ($binary eq 'firefox') {
|
|
|
return firefox_path();
|
|
return firefox_path();
|
|
|
}
|
|
}
|