Page tree
Skip to end of metadata
Go to start of metadata

Last updated: Apr 29, 2020 18:14


Sometimes there is a need to use Chrome options which are not a part of standard capabilities.


Starting Selenium version 3.6.0, the ChromeOptions class in Java also implements the Capabilities interface, allowing you to specify other WebDriver capabilities not specific to ChromeDriver.

The code example below shows the passing Chrome Options as capabilities:

Chrome Options with switches
ChromeOptions options = new ChromeOptions();
options.addExtensions(new File("/path/to/extension.crx"));
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
Chrome Options with preferences
ChromeOptions options = new ChromeOptions();
Map<String, Object> prefs = new HashMap<String, Object>();
prefs.put("ssl.error_override_allowed", true);
options.setExperimentalOption("prefs", prefs);
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
Chrome Options with switches Protractor JS
 capabilities: {
  browserName: 'chrome',
  chromeOptions: {
     args: [ "--headless", 
             "--debuggerAddress=" ]
Chrome://flags Chrome driver Protractor JS example
capabilities: {
    'platformName' : 'Windows',
    'platformVersion' : '10',
    'browserName' : 'Chrome',
    'browserVersion' : '77',
    'resolution' : '1280x1024',
    'location' : 'US East',
                                securityToken: '',
                                "goog:chromeOptions":  {
        args: ["" ],
        extensions: []

More information on Chrome driver capabilities, complete list of switches & preferences options.

All preferences:

All switches: