27
27
import java .io .IOException ;
28
28
import java .time .Duration ;
29
29
import java .util .ArrayList ;
30
+ import java .util .HashMap ;
30
31
import java .util .List ;
31
32
import java .util .Map ;
32
33
33
34
import static java .util .Collections .unmodifiableList ;
35
+ import static java .util .Collections .unmodifiableMap ;
34
36
import static org .openqa .selenium .remote .Browser .CHROME ;
35
37
36
38
/**
39
41
public class ChromeDriverService extends DriverService {
40
42
41
43
/**
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
43
45
* the {@link #createDefaultService() default service}.
44
46
*/
45
47
public static final String CHROME_DRIVER_EXE_PROPERTY = "webdriver.chrome.driver" ;
46
48
47
49
/**
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.
50
51
*/
51
52
public static final String CHROME_DRIVER_LOG_PROPERTY = "webdriver.chrome.logfile" ;
52
53
@@ -56,41 +57,36 @@ public class ChromeDriverService extends DriverService {
56
57
public static final String CHROME_DRIVER_LOG_LEVEL_PROPERTY = "webdriver.chrome.loglevel" ;
57
58
58
59
/**
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.
60
61
*/
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" ;
63
63
64
64
/**
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
66
66
* with verbose logging.
67
67
*/
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" ;
70
69
71
70
/**
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
73
72
* in silent mode.
74
73
*/
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" ;
77
75
78
76
/**
79
77
* System property that defines comma-separated list of remote IPv4 addresses which are
80
78
* allowed to connect to ChromeDriver.
81
79
*/
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" ;
84
81
85
82
/**
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.
88
85
*/
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" ;
91
87
92
88
/**
93
- * @param executable The chromedriver executable.
89
+ * @param executable The ChromeDriver executable.
94
90
* @param port Which port to start the ChromeDriver on.
95
91
* @param args The arguments to the launched server.
96
92
* @param environment The environment for the launched server.
@@ -101,11 +97,13 @@ public ChromeDriverService(
101
97
int port ,
102
98
List <String > args ,
103
99
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 )));
105
103
}
106
104
107
105
/**
108
- * @param executable The chromedriver executable.
106
+ * @param executable The ChromeDriver executable.
109
107
* @param port Which port to start the ChromeDriver on.
110
108
* @param timeout Timeout waiting for driver server to start.
111
109
* @param args The arguments to the launched server.
@@ -118,12 +116,14 @@ public ChromeDriverService(
118
116
Duration timeout ,
119
117
List <String > args ,
120
118
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 )));
122
122
}
123
123
124
124
/**
125
125
* 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
127
127
* {@link #CHROME_DRIVER_EXE_PROPERTY} system property. Each service created by this method will
128
128
* be configured to use a free port on the current system.
129
129
*
@@ -135,7 +135,7 @@ public static ChromeDriverService createDefaultService() {
135
135
136
136
/**
137
137
* 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
139
139
* {@link #CHROME_DRIVER_EXE_PROPERTY} system property. Each service created by this method will
140
140
* be configured to use a free port on the current system.
141
141
*
0 commit comments