First, I will repeat the disclaimer for the logs:
[WARNING] You are using an unsupported command-line switch: --disable-build-check. Please don't report bugs that cannot be reproduced with this switch removed.
This flag isn't a Chrome switch, it's a ChromeDriver switch. The Selenium libraries don't make these easily accessible to code. If you start ChromeDriver independently on the command line, then of course it is easy to add the switch. At the bottom of this page are instructions for connecting to such an instance:
https://chromedriver.chromium.org/getting-started
To add this (or any) switch with Java code,
First, subclass ChromeDriverService.Builder, and create a method that will call super.createDriverService. (This example overrides createDriverService, but that's not necessary):
static class CustomBuilder extends ChromeDriverService.Builder{
public ChromeDriverService createDriverService(File exe, int port,
ImmutableList<String> args, ImmutableMap<String, String> environment){
ImmutableList<String> superargs = super.createArgs();
ImmutableList<String> merged = new ImmutableList.Builder<String>()
.addAll(args).addAll(superargs).build();
System.out.println("exe: " + exe.toString());
System.out.println("port: " + port);
System.out.println("args: " + args.toString());
System.out.println("merged: " + merged.toString());
return super.createDriverService(exe, port, merged, environment);
}
}
The call to super.createArgs() will set the verbose and log-path switches according to the standard System properties.
Then to create the Driver:
CustomBuilder builder = new CustomBuilder();
builder = (CustomBuilder) builder.usingPort(22171);
service = builder.createDriverService(
new File(System.getProperty("webdriver.chrome.driver")), 22171,
ImmutableList.of("--disable-build-check"),
ImmutableMap.<String,String>of());
service.start();
You must call builder.usingPort to set the port for the service or the later call to createArgs will set the port to 0, and your service won't respond.
You must use the same port number when calling createDriverService, or the service won't respond. I think setting this port is the most likely error you will face; it will cause the service.start() call to timeout waiting for the service to respond. The driver will be created, so be sure to find and kill the process before trying again.
The only import I added was: import com.google.common.collect.*;
For troubleshooting the CustomBuilder calls, I also used this in my code: service = ChromeDriverService.createDefaultService(). Then used that service when creating the driver. If this version runs, then you know there's an error in the builder code. Otherwise createDefaultService isn't very helpful as you can't set any properties on the resulting Service.
Finally, I will repeat that this is not a supported configuration. Please continue to try your code in the current version and report issues. This switch should be used only as a temporary workaround.