Răsfoiți Sursa

Add FF binary path option to geckodriver startup

Daniel Gempesaw 9 ani în urmă
părinte
comite
da3f29377a
1 a modificat fișierele cu 14 adăugiri și 6 ștergeri
  1. 14 6
      lib/Selenium/Firefox.pm

+ 14 - 6
lib/Selenium/Firefox.pm

@@ -77,9 +77,14 @@ has '_binary_args' => (
         my ($self) = @_;
 
         my $args = ' --log trace --port ' . $self->port;
-        if( $self->marionette_enabled ) {
+        if ( $self->marionette_enabled ) {
             $args .= ' --marionette-port ' . $self->marionette_binary_port;
+
+            if ( $self->has_firefox_binary ) {
+                $args .= ' --binary ' . $self->firefox_binary;
+            }
         }
+
         return $args;
     }
 );
@@ -97,10 +102,6 @@ there's no a priori guarantee that this will be an open port, this is
 _not_ necessarily the port that we end up using - if the port here is
 already bound, we'll search above it until we find an open one.
 
-See L<Selenium::CanStartBinary/port> for more details, and
-L<Selenium::Remote::Driver/port> after instantiation to see what the
-actual port turned out to be.
-
     Selenium::Firefox->new(
         marionette_enabled     => 1,
         marionette_binary_port => 12345,
@@ -139,10 +140,17 @@ for marionette:
 =cut
 
 has 'marionette_enabled' => (
-    is  => 'lazy',
+    is => 'lazy',
     default => 1
 );
 
+has 'firefox_binary' => (
+    is => 'lazy',
+    predicate => 1,
+    default => sub { '' }
+);
+
+
 with 'Selenium::CanStartBinary';
 
 =attr custom_args