Kaynağa Gözat

Fix #396 & #393: do restricted sanitization of caps for geckodriver

In the fix to #371, we just nuked them from orbit.
Obviously this means caps were ignored, but I could see no other
option to get the darn thing working.

I had the right guess today though, and this should fix those regressions.
George S. Baugh 7 yıl önce
ebeveyn
işleme
60f440048d
1 değiştirilmiş dosya ile 5 ekleme ve 2 silme
  1. 5 2
      lib/Selenium/Remote/Driver.pm

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

@@ -963,8 +963,11 @@ sub _request_new_session {
 
     #Delete compatibility layer when using drivers directly
     if ($self->isa('Selenium::Firefox')) {
-        delete $args->{capabilities};
-        delete $args->{extra_capabilities};
+        if ( exists $args->{capabilities} && exists $args->{capabilities}->{alwaysMatch} ) {
+            delete $args->{capabilities}->{alwaysMatch}->{browserName};
+            delete $args->{capabilities}->{alwaysMatch}->{browserVersion};
+            delete $args->{capabilities}->{alwaysMatch}->{platformName};
+        }
     }
 
     # geckodriver has not yet implemented the GET /status endpoint