Remove default factories
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.Dialect;
-import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import java.util.function.Predicate;
import java.util.logging.Logger;
import java.util.regex.Pattern;
-import java.util.stream.Stream;
import java.util.stream.StreamSupport;
/**
@@ -73,17 +71,13 @@ public ActiveSessionFactory() {
StreamSupport.stream(loadDriverProviders().spliterator(), false)
.forEach(p -> builder.put(p::canCreateDriverInstanceFor, new InMemorySession.Factory(p)));
- bind(
- builder,
- "org.openqa.selenium.firefox.FirefoxDriver",
- caps -> {
+ ImmutableMap.<Predicate<Capabilities>, String>builder()
+ .put(caps -> {
Object marionette = caps.getCapability("marionette");
return marionette instanceof Boolean && !(Boolean) marionette;
},
- firefox());
-
- ImmutableMap.<Predicate<Capabilities>, String>builder()
+ "org.openqa.selenium.firefox.XpiDriverService")
.put(browserName(chrome()), "org.openqa.selenium.chrome.ChromeDriverService")
.put(containsKey("chromeOptions"), "org.openqa.selenium.chrome.ChromeDriverService")
.put(browserName(edge()), "org.openqa.selenium.edge.EdgeDriverService")
@@ -105,21 +99,6 @@ public ActiveSessionFactory() {
// Attempt to bind the htmlunitdriver if it's present.
bind(builder, "org.openqa.selenium.htmlunit.HtmlUnitDriver", browserName(htmlUnit()), htmlUnit());
- // Finally, add a default factory.
- Stream.of(
- "org.openqa.selenium.chrome.ChromeDriverService",
- "org.openqa.selenium.firefox.GeckoDriverService",
- "org.openqa.selenium.edge.EdgeDriverService",
- "org.openqa.selenium.ie.InternetExplorerDriverService",
- "org.openqa.selenium.safari.SafariDriverService")
- .filter(name -> CLASS_EXISTS.apply(name) != null)
- .findFirst()
- .ifPresent(
- serviceName -> {
- LOG.info("Binding default provider to: " + serviceName);
- builder.put(ignored -> true, new ServicedSession.Factory(serviceName));
- });
-
this.factories = ImmutableMap.copyOf(builder);
}
