Skip to content

Commit

Permalink
Reverting "Dropping capabilities that can cause geckodriver to reject…
Browse files Browse the repository at this point in the history
… a New Session request"

For "browserName", as geckodriver is designed for Firefox, it's
right for geckodriver to complain if the browser name indicates
something else. The solution here is not to set the browser name
at all (which can be done by setting the capability to `null`)

For browser version, the spec says that the matching is done in
an implementation specific way. It's probably best to leave that
out and configure the Grid to hand out nodes with the right
version for you.

`platformName` is more contentious. There's a note in the spec that
recommends `Platform` families be respected, and there's an open
issue for geckodriver about this:

https://bugzilla.mozilla.org/show_bug.cgi?id=1421233

This reverts commit 3cd7889.
  • Loading branch information
shs96c committed Nov 28, 2017
1 parent 1df5daf commit 77c2331
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions java/client/src/org/openqa/selenium/firefox/FirefoxDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
package org.openqa.selenium.firefox;

import static org.openqa.selenium.firefox.FirefoxDriver.SystemProperty.DRIVER_USE_MARIONETTE;
import static org.openqa.selenium.remote.CapabilityType.BROWSER_NAME;
import static org.openqa.selenium.remote.CapabilityType.BROWSER_VERSION;
import static org.openqa.selenium.remote.CapabilityType.PLATFORM_NAME;
import static org.openqa.selenium.remote.CapabilityType.PROXY;

import com.google.common.collect.Maps;
Expand Down Expand Up @@ -196,11 +193,15 @@ private static Capabilities dropCapabilities(Capabilities capabilities) {
return new ImmutableCapabilities();
}

final Set<String> toRemove = isLegacy(capabilities)
? Sets.newHashSet(BINARY, PROFILE)
: Sets.newHashSet(BROWSER_NAME, BROWSER_VERSION, PLATFORM_NAME);
MutableCapabilities caps = new MutableCapabilities(
Maps.filterKeys(capabilities.asMap(), key -> !toRemove.contains(key)));
MutableCapabilities caps;

if (isLegacy(capabilities)) {
final Set<String> toRemove = Sets.newHashSet(BINARY, PROFILE);
caps = new MutableCapabilities(
Maps.filterKeys(capabilities.asMap(), key -> !toRemove.contains(key)));
} else {
caps = new MutableCapabilities(capabilities);
}

// Ensure that the proxy is in a state fit to be sent to the extension
Proxy proxy = Proxy.extractFrom(capabilities);
Expand Down

0 comments on commit 77c2331

Please sign in to comment.