2727import java .io .IOException ;
2828import java .time .Duration ;
2929import java .util .ArrayList ;
30+ import java .util .HashMap ;
3031import java .util .List ;
3132import java .util .Map ;
3233
3334import static java .util .Collections .unmodifiableList ;
35+ import static java .util .Collections .unmodifiableMap ;
3436import static org .openqa .selenium .remote .Browser .CHROME ;
3537
3638/**
3941public 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 *
0 commit comments