Skip to content

Commit 43987a2

Browse files
committed
[java] Removing DriverServiceInfo
1 parent 5374cf8 commit 43987a2

File tree

7 files changed

+31
-38
lines changed

7 files changed

+31
-38
lines changed

java/src/org/openqa/selenium/chrome/ChromeDriverService.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import org.openqa.selenium.WebDriverException;
2424
import org.openqa.selenium.chromium.ChromiumDriverLogLevel;
2525
import org.openqa.selenium.remote.service.DriverService;
26-
import org.openqa.selenium.remote.service.DriverServiceInfo;
2726

2827
import java.io.File;
2928
import java.io.IOException;
@@ -154,7 +153,7 @@ public Capabilities getDefaultDriverOptions() {
154153
/**
155154
* Configures and returns a new {@link ChromeDriverService} using the default configuration. In
156155
* this configuration, the service will use the ChromeDriver executable identified by
157-
* {@link org.openqa.selenium.remote.service.DriverFinder#getPath(DriverServiceInfo, Capabilities)}.
156+
* {@link org.openqa.selenium.remote.service.DriverFinder#getPath(DriverService, Capabilities)}.
158157
* Each service created by this method will be configured to use a free port on the current system.
159158
*
160159
* @return A new ChromeDriverService using the default configuration.
@@ -166,7 +165,7 @@ public static ChromeDriverService createDefaultService() {
166165
/**
167166
* Configures and returns a new {@link ChromeDriverService} using the supplied configuration. In
168167
* this configuration, the service will use the ChromeDriver executable identified by
169-
* {@link org.openqa.selenium.remote.service.DriverFinder#getPath(DriverServiceInfo, Capabilities)}.
168+
* {@link org.openqa.selenium.remote.service.DriverFinder#getPath(DriverService, Capabilities)}.
170169
* Each service created by this method will be configured to use a free port on the current system.
171170
*
172171
* @return A new ChromeDriverService using the supplied configuration from {@link ChromeOptions}.

java/src/org/openqa/selenium/edge/EdgeDriverService.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import org.openqa.selenium.WebDriverException;
2424
import org.openqa.selenium.chromium.ChromiumDriverLogLevel;
2525
import org.openqa.selenium.remote.service.DriverService;
26-
import org.openqa.selenium.remote.service.DriverServiceInfo;
2726

2827
import java.io.File;
2928
import java.io.IOException;
@@ -129,7 +128,7 @@ public Capabilities getDefaultDriverOptions() {
129128
/**
130129
* Configures and returns a new {@link EdgeDriverService} using the default configuration. In
131130
* this configuration, the service will use the MSEdgeDriver executable identified by the
132-
* {@link org.openqa.selenium.remote.service.DriverFinder#getPath(DriverServiceInfo, Capabilities)}.
131+
* {@link org.openqa.selenium.remote.service.DriverFinder#getPath(DriverService, Capabilities)}.
133132
* Each service created by this method will be configured to use a free port on the current system.
134133
*
135134
* @return A new ChromiumEdgeDriverService using the default configuration.
@@ -153,14 +152,14 @@ static boolean isPresent() {
153152
* Builder used to configure new {@link EdgeDriverService} instances.
154153
*/
155154
@AutoService(DriverService.Builder.class)
156-
public static class Builder extends DriverService.Builder<
157-
EdgeDriverService, Builder> {
155+
public static class Builder extends DriverService.Builder<EdgeDriverService, Builder> {
158156

159157
private boolean disableBuildCheck = Boolean.getBoolean(EDGE_DRIVER_DISABLE_BUILD_CHECK);
160158
private boolean readableTimestamp = Boolean.getBoolean(EDGE_DRIVER_READABLE_TIMESTAMP);
161159
private boolean appendLog = Boolean.getBoolean(EDGE_DRIVER_APPEND_LOG_PROPERTY);
162160
private boolean verbose = Boolean.getBoolean(EDGE_DRIVER_VERBOSE_LOG_PROPERTY);
163-
private ChromiumDriverLogLevel logLevel = ChromiumDriverLogLevel.fromString(System.getProperty(EDGE_DRIVER_LOG_LEVEL_PROPERTY));
161+
private ChromiumDriverLogLevel logLevel = ChromiumDriverLogLevel
162+
.fromString(System.getProperty(EDGE_DRIVER_LOG_LEVEL_PROPERTY));
164163
private boolean silent = Boolean.getBoolean(EDGE_DRIVER_SILENT_OUTPUT_PROPERTY);
165164
private String allowedListIps = System.getProperty(EDGE_DRIVER_ALLOWED_IPS_PROPERTY);
166165

java/src/org/openqa/selenium/firefox/FirefoxDriverService.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
package org.openqa.selenium.firefox;
1919

2020
import org.openqa.selenium.remote.service.DriverService;
21-
import org.openqa.selenium.remote.service.DriverServiceInfo;
2221

2322
import java.io.File;
2423
import java.io.IOException;

java/src/org/openqa/selenium/remote/service/DriverFinder.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,28 @@ public class DriverFinder {
1212

1313
private static final Logger LOG = Logger.getLogger(DriverFinder.class.getName());
1414

15-
public static String getPath(DriverServiceInfo serviceInfo, Capabilities options) {
15+
public static String getPath(DriverService service, Capabilities options) {
1616
Require.nonNull("Browser options", options);
17-
String defaultPath = new ExecutableFinder().find(serviceInfo.getDriverName());
18-
String exePath = System.getProperty(serviceInfo.getDriverProperty(), defaultPath);
17+
String defaultPath = new ExecutableFinder().find(service.getDriverName());
18+
String exePath = System.getProperty(service.getDriverProperty(), defaultPath);
1919

20-
if (exePath == null && serviceInfo.getDriverExecutable() != null) {
21-
exePath = serviceInfo.getDriverExecutable().getAbsolutePath();
20+
if (exePath == null && service.getDriverExecutable() != null) {
21+
exePath = service.getDriverExecutable().getAbsolutePath();
2222
}
2323

2424
if (exePath == null) {
2525
try {
2626
exePath = SeleniumManager.getInstance().getDriverPath(options);
2727
} catch (Exception e) {
2828
LOG.warning(String.format("Unable to obtain %s using Selenium Manager: %s",
29-
serviceInfo.getDriverName(), e.getMessage()));
29+
service.getDriverName(), e.getMessage()));
3030
}
3131
}
3232

3333
String validPath = Require.state("The path to the driver executable", exePath).nonNull(
3434
"Unable to locate the %s executable; for more information on how to install drivers, " +
3535
"see https://www.selenium.dev/documentation/webdriver/getting_started/install_drivers/",
36-
serviceInfo.getDriverName());
36+
service.getDriverName());
3737

3838
File exe = new File(validPath);
3939
Require.state("The driver executable", exe).isFile();

java/src/org/openqa/selenium/remote/service/DriverService.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
* In addition to this, it is supposed that the driver server implements /shutdown hook that is
6060
* used to stop the server.
6161
*/
62-
public class DriverService implements Closeable, DriverServiceInfo {
62+
public class DriverService implements Closeable {
6363

6464
private static final String NAME = "Driver Service Executor";
6565
protected static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(20);
@@ -140,11 +140,23 @@ protected Map<String, String> getEnvironment() {
140140

141141
protected URL getUrl(int port) throws IOException {
142142
return new URL(String.format("http://localhost:%d", port));
143-
}
143+
}
144144

145-
protected Capabilities getDefaultDriverOptions() {
146-
return new ImmutableCapabilities();
147-
}
145+
protected Capabilities getDefaultDriverOptions() {
146+
return new ImmutableCapabilities();
147+
}
148+
149+
protected String getDriverName() {
150+
return null;
151+
}
152+
153+
protected String getDriverProperty() {
154+
return null;
155+
}
156+
157+
protected File getDriverExecutable() {
158+
return null;
159+
}
148160

149161
/**
150162
* @return The base URL for the managed driver server.

java/src/org/openqa/selenium/remote/service/DriverServiceInfo.java

Lines changed: 0 additions & 16 deletions
This file was deleted.

java/src/org/openqa/selenium/safari/SafariTechPreviewDriverInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public boolean isSupporting(Capabilities capabilities) {
5353
}
5454

5555
return capabilities.asMap().keySet().parallelStream()
56-
.map(key -> key.startsWith("safari.") || key.startsWith("safari:"))
56+
.map(key -> key.startsWith("safari:"))
5757
.reduce(Boolean::logicalOr)
5858
.orElse(false);
5959
}

0 commit comments

Comments
 (0)