Pārlūkot izejas kodu

Add switch to enable marionette on Firefox

Vangelis Katsikaros 9 gadi atpakaļ
vecāks
revīzija
621e335a70
2 mainītis faili ar 32 papildinājumiem un 1 dzēšanām
  1. 17 0
      lib/Selenium/CanStartBinary.pm
  2. 15 1
      lib/Selenium/Firefox.pm

+ 17 - 0
lib/Selenium/CanStartBinary.pm

@@ -142,6 +142,20 @@ has custom_args => (
     default => sub { '' }
 );
 
+has 'marionette_port' => (
+    is => 'lazy',
+    builder => sub {
+        my ($self) = @_;
+
+        if ($self->isa('Selenium::Firefox') && $self->marionette_enabled) {
+            return find_open_port_above($self->marionette_binary_port);
+        }
+        else {
+            return;
+        }
+    }
+);
+
 =attr startup_timeout
 
 Optional: you can modify how long we will wait for the binary to start
@@ -262,6 +276,9 @@ sub _build_binary_mode {
     my $port = $self->port + 0;
     return if $port == 4444;
 
+    my $marionette_port = $self->marionette_enabled ?
+    $self->marionette_port : 0;
+
     if ($self->isa('Selenium::Firefox')) {
         my @args = ($port);
 

+ 15 - 1
lib/Selenium/Firefox.pm

@@ -75,7 +75,11 @@ has '_binary_args' => (
     builder => sub {
         my ($self) = @_;
 
-        return ' -no-remote';
+        my $args = ' -no-remote';
+        if( $self->marionette_enabled ) {
+            $args .= ' -marionette';
+        }
+        return $args;
     }
 );
 
@@ -84,6 +88,16 @@ has '+wd_context_prefix' => (
     default => sub { '/hub' }
 );
 
+has 'marionette_binary_port' => (
+    is => 'lazy',
+    default => sub { 2828 }
+);
+
+has 'marionette_enabled' => (
+    is  => 'lazy',
+    default => 0
+);
+
 with 'Selenium::CanStartBinary';
 
 =attr custom_args