--disable-build-check has no effect

500 views
Skip to first unread message

Adam

unread,
Oct 30, 2019, 5:30:27 PM10/30/19
to ChromeDriver Users
In a perfect world, we'd always be able to align the Chrome/ChromeDriver versions, but for our use case we can't; we'd like to use the older versions at least temporarily.

;Error: session not created: This version of ChromeDriver only supports Chrome version 75
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'HOST', ip: '192.168.0.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_121'
Driver info: driver.version: ChromeDriver

Looking for a workaround, I stumbled on the existence of a "--disable-build-check" switch, that seems like it would emit a warning instead of failing to start up the ChromeDriver.

Unfortunately, it doesn't seem to have any effect, we still get the above error. Other switches work properly, and it looks like it's been correctly added to the ChromeOptions, when checking the map:

; 17:10:31,939 INFO  [Application] browserName:chrome
; 17:10:31,939 INFO  [Application] goog:chromeOptions:{args=[--no-sandbox, --incognito, --disable-extensions, --disable-build-check, --window-size=1680,1050], extensions=[]}

I'm using the regular Java bindings, ie;

ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-build-check");
ChromeDriverService service = ChromeDriverService.createDefaultService();
ChromeDriver driver = new ChromeDriver(service, options);

Is there a different way to apply this switch so that it takes effect, or some other way of accomplishing this altogether? 

T Crichton

unread,
Oct 31, 2019, 11:50:27 AM10/31/19
to ChromeDriver Users
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();
      
      driver = new ChromeDriver(service, options);

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.

Adam

unread,
Nov 4, 2019, 3:44:41 PM11/4/19
to ChromeDriver Users
Just wanted to let you know that you've solved my issue completely, thank you.

tri...@google.com

unread,
Nov 4, 2019, 3:53:36 PM11/4/19
to ChromeDriver Users
Great. I'm glad it helps. Thanks for the update!
Reply all
Reply to author
Forward
0 new messages