Skip to content

Commit ea41b75

Browse files
committed
[grid] Adding disableBuildCheck as a property.
This allows users to skip version compatibility check between the driver and the browser, which is very useful when testing beta and dev versions.
1 parent 86f65a7 commit ea41b75

File tree

2 files changed

+58
-34
lines changed

2 files changed

+58
-34
lines changed

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

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,18 @@
2020
import static java.util.Collections.unmodifiableList;
2121

2222
import com.google.auto.service.AutoService;
23+
24+
import org.openqa.selenium.Capabilities;
25+
import org.openqa.selenium.WebDriverException;
26+
import org.openqa.selenium.remote.BrowserType;
27+
import org.openqa.selenium.remote.service.DriverService;
28+
2329
import java.io.File;
2430
import java.io.IOException;
2531
import java.time.Duration;
2632
import java.util.ArrayList;
2733
import java.util.List;
2834
import java.util.Map;
29-
import org.openqa.selenium.Capabilities;
30-
import org.openqa.selenium.WebDriverException;
31-
import org.openqa.selenium.remote.BrowserType;
32-
import org.openqa.selenium.remote.service.DriverService;
3335

3436
/**
3537
* Manages the life and death of a ChromeDriver server.
@@ -66,14 +68,22 @@ public class ChromeDriverService extends DriverService {
6668
* in silent mode.
6769
*/
6870
public static final String CHROME_DRIVER_SILENT_OUTPUT_PROPERTY =
69-
"webdriver.chrome.silentOutput";
71+
"webdriver.chrome.silentOutput";
7072

7173
/**
7274
* System property that defines comma-separated list of remote IPv4 addresses which are
7375
* allowed to connect to ChromeDriver.
7476
*/
7577
public static final String CHROME_DRIVER_WHITELISTED_IPS_PROPERTY =
76-
"webdriver.chrome.whitelistedIps";
78+
"webdriver.chrome.whitelistedIps";
79+
80+
/**
81+
* System property that defines whether the chromedriver executable should check for build
82+
* version compatibility between chromedriver and the browser.
83+
*/
84+
public static final String
85+
CHROME_DRIVER_DISABLE_BUILD_CHECK =
86+
"webdriver.chrome.disableBuildCheck";
7787

7888
/**
7989
* @param executable The chromedriver executable.
@@ -83,10 +93,10 @@ public class ChromeDriverService extends DriverService {
8393
* @throws IOException If an I/O error occurs.
8494
*/
8595
public ChromeDriverService(
86-
File executable,
87-
int port,
88-
List<String> args,
89-
Map<String, String> environment) throws IOException {
96+
File executable,
97+
int port,
98+
List<String> args,
99+
Map<String, String> environment) throws IOException {
90100
super(executable, port, DEFAULT_TIMEOUT, args, environment);
91101
}
92102

@@ -144,6 +154,7 @@ public static class Builder extends DriverService.Builder<
144154
private boolean verbose = Boolean.getBoolean(CHROME_DRIVER_VERBOSE_LOG_PROPERTY);
145155
private boolean silent = Boolean.getBoolean(CHROME_DRIVER_SILENT_OUTPUT_PROPERTY);
146156
private String whitelistedIps = System.getProperty(CHROME_DRIVER_WHITELISTED_IPS_PROPERTY);
157+
private boolean disableBuildCheck = Boolean.getBoolean(CHROME_DRIVER_DISABLE_BUILD_CHECK);
147158
private ChromeDriverLogLevel logLevel = null;
148159

149160
@Override
@@ -220,9 +231,9 @@ public Builder withWhitelistedIps(String whitelistedIps) {
220231
@Override
221232
protected File findDefaultExecutable() {
222233
return findExecutable(
223-
"chromedriver", CHROME_DRIVER_EXE_PROPERTY,
224-
"https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver",
225-
"http://chromedriver.storage.googleapis.com/index.html");
234+
"chromedriver", CHROME_DRIVER_EXE_PROPERTY,
235+
"https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver",
236+
"https://chromedriver.storage.googleapis.com/index.html");
226237
}
227238

228239
@Override
@@ -260,6 +271,9 @@ protected List<String> createArgs() {
260271
if (whitelistedIps != null) {
261272
args.add(String.format("--whitelisted-ips=%s", whitelistedIps));
262273
}
274+
if (disableBuildCheck) {
275+
args.add("--disable-build-check");
276+
}
263277

264278
return unmodifiableList(args);
265279
}

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

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -70,46 +70,53 @@ public class EdgeDriverService extends DriverService {
7070
public static final String EDGE_DRIVER_ALLOWED_IPS_PROPERTY = "webdriver.edge.withAllowedIps";
7171

7272
/**
73-
* Configures and returns a new {@link EdgeDriverService} using the default configuration. In
74-
* this configuration, the service will use the MSEdgeDriver executable identified by the
75-
* {@link #EDGE_DRIVER_EXE_PROPERTY} system property. Each service created by this method will
76-
* be configured to use a free port on the current system.
77-
*
78-
* @return A new ChromiumEdgeDriverService using the default configuration.
73+
* System property that defines whether the MSEdgeDriver executable should check for build
74+
* version compatibility between MSEdgeDriver and the browser.
7975
*/
80-
public static EdgeDriverService createDefaultService() {
81-
return new EdgeDriverService.Builder().build();
82-
}
76+
public static final String EDGE_DRIVER_DISABLE_BUILD_CHECK = "webdriver.edge.disableBuildCheck";
8377

8478
/**
85-
* @param executable The EdgeDriver executable.
86-
* @param port Which port to start the EdgeDriver on.
79+
* @param executable The EdgeDriver executable.
80+
* @param port Which port to start the EdgeDriver on.
8781
* @param timeout Timeout waiting for driver server to start.
88-
* @param args The arguments to the launched server.
82+
* @param args The arguments to the launched server.
8983
* @param environment The environment for the launched server.
9084
* @throws IOException If an I/O error occurs.
9185
*/
9286
public EdgeDriverService(
93-
File executable,
94-
int port,
95-
Duration timeout,
96-
List<String> args,
97-
Map<String, String> environment) throws IOException {
87+
File executable,
88+
int port,
89+
Duration timeout,
90+
List<String> args,
91+
Map<String, String> environment) throws IOException {
9892
super(executable, port, timeout,
9993
unmodifiableList(new ArrayList<>(args)),
10094
unmodifiableMap(new HashMap<>(environment)));
10195
}
10296

97+
/**
98+
* Configures and returns a new {@link EdgeDriverService} using the default configuration. In
99+
* this configuration, the service will use the MSEdgeDriver executable identified by the
100+
* {@link #EDGE_DRIVER_EXE_PROPERTY} system property. Each service created by this method will
101+
* be configured to use a free port on the current system.
102+
*
103+
* @return A new ChromiumEdgeDriverService using the default configuration.
104+
*/
105+
public static EdgeDriverService createDefaultService() {
106+
return new EdgeDriverService.Builder().build();
107+
}
108+
103109
/**
104110
* Builder used to configure new {@link EdgeDriverService} instances.
105111
*/
106112
@AutoService(DriverService.Builder.class)
107113
public static class Builder extends DriverService.Builder<
108-
EdgeDriverService, EdgeDriverService.Builder> {
114+
EdgeDriverService, EdgeDriverService.Builder> {
109115

110116
private boolean verbose = Boolean.getBoolean(EDGE_DRIVER_VERBOSE_LOG_PROPERTY);
111117
private boolean silent = Boolean.getBoolean(EDGE_DRIVER_SILENT_OUTPUT_PROPERTY);
112118
private String allowedListIps = System.getProperty(EDGE_DRIVER_ALLOWED_IPS_PROPERTY);
119+
private boolean disableBuildCheck = Boolean.getBoolean(EDGE_DRIVER_DISABLE_BUILD_CHECK);
113120

114121
@Override
115122
public int score(Capabilities capabilities) {
@@ -168,9 +175,9 @@ public EdgeDriverService.Builder withAllowedListIps(String allowedListIps) {
168175
@Override
169176
protected File findDefaultExecutable() {
170177
return findExecutable(
171-
"msedgedriver", EDGE_DRIVER_EXE_PROPERTY,
172-
"https://github.com/SeleniumHQ/selenium/wiki/MicrosoftWebDriver",
173-
"https://msedgecdn.azurewebsites.net/webdriver/index.html");
178+
"msedgedriver", EDGE_DRIVER_EXE_PROPERTY,
179+
"https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium/",
180+
"https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/");
174181
}
175182

176183
@Override
@@ -196,6 +203,9 @@ protected List<String> createArgs() {
196203
if (allowedListIps != null) {
197204
args.add(String.format("--whitelisted-ips=%s", allowedListIps));
198205
}
206+
if (disableBuildCheck) {
207+
args.add("--disable-build-check");
208+
}
199209

200210
return unmodifiableList(args);
201211
}

0 commit comments

Comments
 (0)