Skip to content

Commit 3e146d0

Browse files
committed
[java] update names and references or chromium driver service classes
1 parent e54fedb commit 3e146d0

File tree

2 files changed

+40
-38
lines changed

2 files changed

+40
-38
lines changed

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

+24-24
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@
2727
import java.io.IOException;
2828
import java.time.Duration;
2929
import java.util.ArrayList;
30+
import java.util.HashMap;
3031
import java.util.List;
3132
import java.util.Map;
3233

3334
import static java.util.Collections.unmodifiableList;
35+
import static java.util.Collections.unmodifiableMap;
3436
import static org.openqa.selenium.remote.Browser.CHROME;
3537

3638
/**
@@ -39,14 +41,13 @@
3941
public class ChromeDriverService extends DriverService {
4042

4143
/**
42-
* System property that defines the location of the chromedriver executable that will be used by
44+
* System property that defines the location of the ChromeDriver executable that will be used by
4345
* the {@link #createDefaultService() default service}.
4446
*/
4547
public static final String CHROME_DRIVER_EXE_PROPERTY = "webdriver.chrome.driver";
4648

4749
/**
48-
* System property that defines the location of the log that will be written by
49-
* the {@link #createDefaultService() default service}.
50+
* System property that defines the default location where ChromeDriver output is logged.
5051
*/
5152
public static final String CHROME_DRIVER_LOG_PROPERTY = "webdriver.chrome.logfile";
5253

@@ -56,41 +57,36 @@ public class ChromeDriverService extends DriverService {
5657
public static final String CHROME_DRIVER_LOG_LEVEL_PROPERTY = "webdriver.chrome.loglevel";
5758

5859
/**
59-
* Boolean system property that defines whether chromedriver should append to existing log file.
60+
* Boolean system property that defines whether ChromeDriver should append to existing log file.
6061
*/
61-
public static final String CHROME_DRIVER_APPEND_LOG_PROPERTY =
62-
"webdriver.chrome.appendLog";
62+
public static final String CHROME_DRIVER_APPEND_LOG_PROPERTY = "webdriver.chrome.appendLog";
6363

6464
/**
65-
* Boolean system property that defines whether the chromedriver executable should be started
65+
* Boolean system property that defines whether the ChromeDriver executable should be started
6666
* with verbose logging.
6767
*/
68-
public static final String CHROME_DRIVER_VERBOSE_LOG_PROPERTY =
69-
"webdriver.chrome.verboseLogging";
68+
public static final String CHROME_DRIVER_VERBOSE_LOG_PROPERTY = "webdriver.chrome.verboseLogging";
7069

7170
/**
72-
* Boolean system property that defines whether the chromedriver executable should be started
71+
* Boolean system property that defines whether the ChromeDriver executable should be started
7372
* in silent mode.
7473
*/
75-
public static final String CHROME_DRIVER_SILENT_OUTPUT_PROPERTY =
76-
"webdriver.chrome.silentOutput";
74+
public static final String CHROME_DRIVER_SILENT_OUTPUT_PROPERTY = "webdriver.chrome.silentOutput";
7775

7876
/**
7977
* System property that defines comma-separated list of remote IPv4 addresses which are
8078
* allowed to connect to ChromeDriver.
8179
*/
82-
public static final String CHROME_DRIVER_WHITELISTED_IPS_PROPERTY =
83-
"webdriver.chrome.whitelistedIps";
80+
public static final String CHROME_DRIVER_WHITELISTED_IPS_PROPERTY = "webdriver.chrome.whitelistedIps";
8481

8582
/**
86-
* System property that defines whether the chromedriver executable should check for build
87-
* version compatibility between chromedriver and the browser.
83+
* System property that defines whether the ChromeDriver executable should check for build
84+
* version compatibility between ChromeDriver and the browser.
8885
*/
89-
public static final String CHROME_DRIVER_DISABLE_BUILD_CHECK =
90-
"webdriver.chrome.disableBuildCheck";
86+
public static final String CHROME_DRIVER_DISABLE_BUILD_CHECK = "webdriver.chrome.disableBuildCheck";
9187

9288
/**
93-
* @param executable The chromedriver executable.
89+
* @param executable The ChromeDriver executable.
9490
* @param port Which port to start the ChromeDriver on.
9591
* @param args The arguments to the launched server.
9692
* @param environment The environment for the launched server.
@@ -101,11 +97,13 @@ public ChromeDriverService(
10197
int port,
10298
List<String> args,
10399
Map<String, String> environment) throws IOException {
104-
super(executable, port, DEFAULT_TIMEOUT, args, environment);
100+
super(executable, port, DEFAULT_TIMEOUT,
101+
unmodifiableList(new ArrayList<>(args)),
102+
unmodifiableMap(new HashMap<>(environment)));
105103
}
106104

107105
/**
108-
* @param executable The chromedriver executable.
106+
* @param executable The ChromeDriver executable.
109107
* @param port Which port to start the ChromeDriver on.
110108
* @param timeout Timeout waiting for driver server to start.
111109
* @param args The arguments to the launched server.
@@ -118,12 +116,14 @@ public ChromeDriverService(
118116
Duration timeout,
119117
List<String> args,
120118
Map<String, String> environment) throws IOException {
121-
super(executable, port, timeout, args, environment);
119+
super(executable, port, timeout,
120+
unmodifiableList(new ArrayList<>(args)),
121+
unmodifiableMap(new HashMap<>(environment)));
122122
}
123123

124124
/**
125125
* Configures and returns a new {@link ChromeDriverService} using the default configuration. In
126-
* this configuration, the service will use the chromedriver executable identified by the
126+
* this configuration, the service will use the ChromeDriver executable identified by the
127127
* {@link #CHROME_DRIVER_EXE_PROPERTY} system property. Each service created by this method will
128128
* be configured to use a free port on the current system.
129129
*
@@ -135,7 +135,7 @@ public static ChromeDriverService createDefaultService() {
135135

136136
/**
137137
* Configures and returns a new {@link ChromeDriverService} using the supplied configuration. In
138-
* this configuration, the service will use the chromedriver executable identified by the
138+
* this configuration, the service will use the ChromeDriver executable identified by the
139139
* {@link #CHROME_DRIVER_EXE_PROPERTY} system property. Each service created by this method will
140140
* be configured to use a free port on the current system.
141141
*

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

+16-14
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// KIND, either express or implied. See the License for the
1515
// specific language governing permissions and limitations
1616
// under the License.
17+
1718
package org.openqa.selenium.edge;
1819

1920
import com.google.auto.service.AutoService;
@@ -35,23 +36,23 @@
3536
import static org.openqa.selenium.remote.Browser.EDGE;
3637

3738
/**
38-
* Manages the life and death of the EdgeDriver (MicrosoftWebDriver or MSEdgeDriver).
39+
* Manages the life and death of the MSEdgeDriver
3940
*/
4041
public class EdgeDriverService extends DriverService {
4142

4243
/**
43-
* System property that defines the location of the EdgeDriver executable that will be used by
44+
* System property that defines the location of the MSEdgeDriver executable that will be used by
4445
* the default service.
4546
*/
4647
public static final String EDGE_DRIVER_EXE_PROPERTY = "webdriver.edge.driver";
4748

4849
/**
49-
* System property that defines the default location where MicrosoftWebDriver output is logged.
50+
* System property that defines the default location where MSEdgeDriver output is logged.
5051
*/
5152
public static final String EDGE_DRIVER_LOG_PROPERTY = "webdriver.edge.logfile";
5253

5354
/**
54-
* System property that defines the log level when MicrosoftWebDriver output is logged.
55+
* System property that defines the log level when MSEdgeDriver output is logged.
5556
*/
5657
public static final String EDGE_DRIVER_LOG_LEVEL_PROPERTY = "webdriver.edge.loglevel";
5758

@@ -61,7 +62,7 @@ public class EdgeDriverService extends DriverService {
6162
public static final String EDGE_DRIVER_APPEND_LOG_PROPERTY = "webdriver.edge.appendLog";
6263

6364
/**
64-
* Boolean system property that defines whether the MicrosoftWebDriver executable should be started
65+
* Boolean system property that defines whether the MSEdgeDriver executable should be started
6566
* with verbose logging.
6667
*/
6768
public static final String EDGE_DRIVER_VERBOSE_LOG_PROPERTY = "webdriver.edge.verboseLogging";
@@ -85,8 +86,8 @@ public class EdgeDriverService extends DriverService {
8586
public static final String EDGE_DRIVER_DISABLE_BUILD_CHECK = "webdriver.edge.disableBuildCheck";
8687

8788
/**
88-
* @param executable The EdgeDriver executable.
89-
* @param port Which port to start the EdgeDriver on.
89+
* @param executable The MSEdgeDriver executable.
90+
* @param port Which port to start the MSEdgeDriver on.
9091
* @param timeout Timeout waiting for driver server to start.
9192
* @param args The arguments to the launched server.
9293
* @param environment The environment for the launched server.
@@ -112,15 +113,15 @@ public EdgeDriverService(
112113
* @return A new ChromiumEdgeDriverService using the default configuration.
113114
*/
114115
public static EdgeDriverService createDefaultService() {
115-
return new EdgeDriverService.Builder().build();
116+
return new Builder().build();
116117
}
117118

118119
/**
119120
* Builder used to configure new {@link EdgeDriverService} instances.
120121
*/
121122
@AutoService(DriverService.Builder.class)
122123
public static class Builder extends DriverService.Builder<
123-
EdgeDriverService, EdgeDriverService.Builder> {
124+
EdgeDriverService, Builder> {
124125

125126
private final boolean disableBuildCheck = Boolean.getBoolean(EDGE_DRIVER_DISABLE_BUILD_CHECK);
126127
private boolean appendLog = Boolean.getBoolean(EDGE_DRIVER_APPEND_LOG_PROPERTY);
@@ -155,7 +156,7 @@ public int score(Capabilities capabilities) {
155156
* @param appendLog True for appending to log file, false otherwise.
156157
* @return A self reference.
157158
*/
158-
public EdgeDriverService.Builder withAppendLog(boolean appendLog) {
159+
public Builder withAppendLog(boolean appendLog) {
159160
this.appendLog = appendLog;
160161
return this;
161162
}
@@ -166,7 +167,7 @@ public EdgeDriverService.Builder withAppendLog(boolean appendLog) {
166167
* @param verbose whether verbose output is used
167168
* @return A self reference.
168169
*/
169-
public EdgeDriverService.Builder withVerbose(boolean verbose) {
170+
public Builder withVerbose(boolean verbose) {
170171
if (verbose) {
171172
this.logLevel = "ALL";
172173
}
@@ -177,7 +178,7 @@ public EdgeDriverService.Builder withVerbose(boolean verbose) {
177178
/**
178179
* Configures the driver server log level.
179180
*/
180-
public EdgeDriverService.Builder withLoglevel(String logLevel) {
181+
public Builder withLoglevel(String logLevel) {
181182
this.verbose = false;
182183
this.silent = false;
183184
this.logLevel = logLevel;
@@ -190,7 +191,7 @@ public EdgeDriverService.Builder withLoglevel(String logLevel) {
190191
* @param silent whether silent output is used
191192
* @return A self reference.
192193
*/
193-
public EdgeDriverService.Builder withSilent(boolean silent) {
194+
public Builder withSilent(boolean silent) {
194195
if (silent) {
195196
this.logLevel = "OFF";
196197
}
@@ -205,7 +206,7 @@ public EdgeDriverService.Builder withSilent(boolean silent) {
205206
* @param allowedListIps Comma-separated list of remote IPv4 addresses.
206207
* @return A self reference.
207208
*/
208-
public EdgeDriverService.Builder withAllowedListIps(String allowedListIps) {
209+
public Builder withAllowedListIps(String allowedListIps) {
209210
this.allowedListIps = allowedListIps;
210211
return this;
211212
}
@@ -236,6 +237,7 @@ protected List<String> createArgs() {
236237
}
237238

238239
List<String> args = new ArrayList<>();
240+
239241
args.add(String.format("--port=%d", getPort()));
240242
if (getLogFile() != null) {
241243
args.add(String.format("--log-path=%s", getLogFile().getAbsolutePath()));

0 commit comments

Comments
 (0)