Skip to content

Commit 77c2331

Browse files
committed
Reverting "Dropping capabilities that can cause geckodriver to reject 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.
1 parent 1df5daf commit 77c2331

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

java/client/src/org/openqa/selenium/firefox/FirefoxDriver.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
package org.openqa.selenium.firefox;
1919

2020
import static org.openqa.selenium.firefox.FirefoxDriver.SystemProperty.DRIVER_USE_MARIONETTE;
21-
import static org.openqa.selenium.remote.CapabilityType.BROWSER_NAME;
22-
import static org.openqa.selenium.remote.CapabilityType.BROWSER_VERSION;
23-
import static org.openqa.selenium.remote.CapabilityType.PLATFORM_NAME;
2421
import static org.openqa.selenium.remote.CapabilityType.PROXY;
2522

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

199-
final Set<String> toRemove = isLegacy(capabilities)
200-
? Sets.newHashSet(BINARY, PROFILE)
201-
: Sets.newHashSet(BROWSER_NAME, BROWSER_VERSION, PLATFORM_NAME);
202-
MutableCapabilities caps = new MutableCapabilities(
203-
Maps.filterKeys(capabilities.asMap(), key -> !toRemove.contains(key)));
196+
MutableCapabilities caps;
197+
198+
if (isLegacy(capabilities)) {
199+
final Set<String> toRemove = Sets.newHashSet(BINARY, PROFILE);
200+
caps = new MutableCapabilities(
201+
Maps.filterKeys(capabilities.asMap(), key -> !toRemove.contains(key)));
202+
} else {
203+
caps = new MutableCapabilities(capabilities);
204+
}
204205

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

0 commit comments

Comments
 (0)