ソースを参照

Fix #371: Using geckodriver requires pruning compatibility capabilities

Simply remove these additional parameters when using Selenium::Firefox.
George S. Baugh 7 年 前
コミット
61f8e96903
5 ファイル変更35 行追加3 行削除
  1. 4 0
      Changes
  2. 11 0
      at/chrome.test
  3. 11 0
      at/firefox.test
  4. 1 1
      dist.ini
  5. 8 2
      lib/Selenium/Remote/Driver.pm

+ 4 - 0
Changes

@@ -1,5 +1,9 @@
 Revision history for Selenium-Remote-Driver
 
+1.27   02-21-2018 TEODESIAN
+        [BUG FIXES]
+        - Fix incorrect passing of capabilities to geckodriver which caused exceptions on instantiaion.
+
 1.26   02-19-2018 TEODESIAN
         [BUG FIXES]
         - Fix issue where only <form> elements and not <input> elements could be submit()ted.

+ 11 - 0
at/chrome.test

@@ -0,0 +1,11 @@
+use strict;
+use warnings;
+
+use Selenium::Chrome;
+use Test::More tests => 2;
+use Test::Fatal;
+
+$ENV{MOZ_HEADLESS} = 1;
+my $driver;
+is( exception { $driver = Selenium::Chrome->new(); }, undef, "can spawn new Selenium::Chrome");
+is( exception { $driver->shutdown_binary; }, undef, "can shutdown binary correctly");

+ 11 - 0
at/firefox.test

@@ -0,0 +1,11 @@
+use strict;
+use warnings;
+
+use Selenium::Firefox;
+use Test::More tests => 2;
+use Test::Fatal;
+
+$ENV{MOZ_HEADLESS} = 1;
+my $driver;
+is( exception { $driver = Selenium::Firefox->new(); }, undef, "can spawn new Selenium::Firefox");
+is( exception { $driver->shutdown_binary; }, undef, "can shutdown binary correctly");

+ 1 - 1
dist.ini

@@ -1,5 +1,5 @@
 name = Selenium-Remote-Driver
-version = 1.26
+version = 1.27
 author = George S. Baugh <george@troglodyne.net>
 author = Aditya Ivaturi <ivaturi@gmail.com>
 author = Daniel Gempesaw <gempesaw@gmail.com>

+ 8 - 2
lib/Selenium/Remote/Driver.pm

@@ -200,9 +200,9 @@ That said, the following 'sanity tests' in the at/ (acceptance test) directory o
 
 =item Selenium Server: 3.8.1 - all tests
 
-=item geckodriver: 0.19.1 - at/sanity.test
+=item geckodriver: 0.19.1 - at/sanity.test, at/firefox.test (Selenium::Firefox)
 
-=item chromedriver: 2.35 - at/sanity-chrome.test
+=item chromedriver: 2.35 - at/sanity-chrome.test, at/chrome.test (Selenium::Chrome)
 
 =item edgedriver: 5.16299 - at/sanity-edge.test
 
@@ -944,6 +944,12 @@ sub _request_new_session {
     delete $args->{desiredCapabilities} if $FORCE_WD3; #XXX fork working-around busted fallback in firefox
     delete $args->{capabilities} if $FORCE_WD2; #XXX 'secret' feature to help the legacy unit tests to work
 
+    #Delete compatibility layer when using drivers directly
+    if ($self->isa('Selenium::Firefox')) {
+        delete $args->{capabilities};
+        delete $args->{extra_capabilities};
+    }
+
     # geckodriver has not yet implemented the GET /status endpoint
     # https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver/status
     if (! $self->isa('Selenium::Firefox')) {