瀏覽代碼

Configure FF binary startup for geckodriver

Previously, the FF binary startup actually just called the firefox
binary executable, wherever it was on the system. In the new world of
FF48 & geckodriver, the binary startup now looks the same as for IE,
Chrome, PhantomJS, etc:

    1. start up a driver server (for FF, it's geckodriver)
    2. coordinate everything via normal Remote Driver calls
Daniel Gempesaw 9 年之前
父節點
當前提交
aa91d6327a
共有 3 個文件被更改,包括 8 次插入27 次删除
  1. 1 8
      lib/Selenium/CanStartBinary.pm
  2. 0 12
      lib/Selenium/CanStartBinary/FindBinary.pm
  3. 7 7
      lib/Selenium/Firefox.pm

+ 1 - 8
lib/Selenium/CanStartBinary.pm

@@ -379,14 +379,7 @@ sub _cmd_prefix {
     my ($self) = @_;
 
     if (IS_WIN) {
-        my $prefix = 'start "' . $self->window_title . '"';
-
-        # Let's minimize the command windows for the drivers that have
-        # separate binaries - but let's not minimize the Firefox
-        # window itself.
-        if (! $self->isa('Selenium::Firefox')) {
-            $prefix .= ' /MIN ';
-        }
+        my $prefix = 'start "' . $self->window_title . '" /MIN';
         return $prefix;
     }
     else {

+ 0 - 12
lib/Selenium/CanStartBinary/FindBinary.pm

@@ -25,18 +25,6 @@ sub coerce_simple_binary {
     }
 }
 
-sub coerce_firefox_binary {
-    my ($executable) = @_;
-
-    my $manual_binary = _validate_manual_binary($executable);
-    if ($manual_binary) {
-        return $manual_binary;
-    }
-    else {
-        return firefox_path();
-    }
-}
-
 sub _validate_manual_binary {
     my ($executable) = @_;
 

+ 7 - 7
lib/Selenium/Firefox.pm

@@ -2,7 +2,7 @@ package Selenium::Firefox;
 
 # ABSTRACT: Use FirefoxDriver without a Selenium server
 use Moo;
-use Selenium::CanStartBinary::FindBinary qw/coerce_firefox_binary/;
+use Selenium::CanStartBinary::FindBinary qw/coerce_simple_binary/;
 extends 'Selenium::Remote::Driver';
 
 =head1 SYNOPSIS
@@ -47,8 +47,8 @@ able to find it, so you may be well served by specifying it yourself.
 
 has 'binary' => (
     is => 'lazy',
-    coerce => \&coerce_firefox_binary,
-    default => sub { 'firefox' },
+    coerce => \&coerce_simple_binary,
+    default => sub { 'geckodriver' },
     predicate => 1
 );
 
@@ -76,9 +76,9 @@ has '_binary_args' => (
     builder => sub {
         my ($self) = @_;
 
-        my $args = ' -no-remote';
+        my $args = ' --log trace --port ' . $self->port;
         if( $self->marionette_enabled ) {
-            $args .= ' -marionette';
+            $args .= ' --marionette-port ' . $self->marionette_binary_port;
         }
         return $args;
     }
@@ -86,7 +86,7 @@ has '_binary_args' => (
 
 has '+wd_context_prefix' => (
     is => 'ro',
-    default => sub { '/hub' }
+    default => sub { '' }
 );
 
 =attr marionette_binary_port
@@ -140,7 +140,7 @@ for marionette:
 
 has 'marionette_enabled' => (
     is  => 'lazy',
-    default => 0
+    default => 1
 );
 
 with 'Selenium::CanStartBinary';