---
title: Chrome Command Line Switches - Complete Reference for ChromeDriver
description: Complete reference guide to Chrome command line switches and how to use
  them with ChromeDriver for Selenium test automation.
source_url:
  html: https://testingbot.com/software-testing-questions/chrome-command-line-switches
  md: https://testingbot.com/software-testing-questions/chrome-command-line-switches.md
---

# What are Chrome Command Line Switches?

- [![Share on Facebook](https://static.addtoany.com/buttons/facebook.svg) ](https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Ftestingbot.com%2Fsoftware-testing-questions%2Fchrome-command-line-switches.md&linkname= "Share on Facebook")
- [![Share on Twitter](https://static.addtoany.com/buttons/twitter.svg) ](https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Ftestingbot.com%2Fsoftware-testing-questions%2Fchrome-command-line-switches.md&linkname= "Share on Twitter")
- [![Share on LinkedIn](https://static.addtoany.com/buttons/linkedin.svg) ](https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Ftestingbot.com%2Fsoftware-testing-questions%2Fchrome-command-line-switches.md&linkname= "Share on LinkedIn")
- [![Share on HackerNews](https://static.addtoany.com/buttons/y18.svg) ](https://www.addtoany.com/add_to/hacker_news?linkurl=https%3A%2F%2Ftestingbot.com%2Fsoftware-testing-questions%2Fchrome-command-line-switches.md&linkname= "Share on HackerNews")

Chrome and Chromium-based browsers support a wide range of command-line switches that allow you to customize browser behavior. These switches are especially useful for automated testing, debugging, and development purposes.

When using ChromeDriver for Selenium WebDriver tests, you can pass these command-line switches through the `args` capability in ChromeOptions.

## How to Pass Command-Line Arguments via ChromeDriver

ChromeDriver provides two key capabilities for managing command-line switches:

### The `args` Capability

Use the `args` capability to pass a list of command-line arguments when starting Chrome. Arguments with values should use an equals sign (`=`) as a separator.

```python
# Python Example
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_argument("--start-maximized")
chrome_options.add_argument("--user-data-dir=/tmp/temp_profile")
chrome_options.add_argument("--disable-gpu")
chrome_options.add_argument("--headless=new")

driver = webdriver.Chrome(options=chrome_options)
```

```java
// Java Example
ChromeOptions options = new ChromeOptions();
options.addArguments("start-maximized");
options.addArguments("user-data-dir=/path/to/profile");
options.addArguments("disable-gpu");
options.addArguments("headless=new");

WebDriver driver = new ChromeDriver(options);
```

```javascript
// JavaScript/Node.js Example
const { Builder } = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');

let options = new chrome.Options();
options.addArguments('--start-maximized');
options.addArguments('--user-data-dir=/tmp/temp_profile');
options.addArguments('--disable-gpu');
options.addArguments('--headless=new');

let driver = await new Builder()
  .forBrowser('chrome')
  .setChromeOptions(options)
  .build();
```

### The `excludeSwitches` Capability

ChromeDriver automatically passes certain switches when starting Chrome. Use `excludeSwitches` to prevent specific default switches from being applied. Do not prefix switches with `--` when using this capability.

```python
# Python Example - Exclude default switches
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_experimental_option("excludeSwitches", ["enable-automation", "enable-logging"])

driver = webdriver.Chrome(options=chrome_options)
```

```java
// Java Example - Exclude default switches
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("excludeSwitches", Arrays.asList("enable-automation", "enable-logging"));

WebDriver driver = new ChromeDriver(options);
```

## Common Chrome Command-Line Switches for Testing

Below is a comprehensive reference of the most useful Chrome command-line switches organized by category.

### Window and Display

| Switch | Description |
| --- | --- |
| --start-maximized | Start Chrome with a maximized window |
| --start-fullscreen | Start Chrome in fullscreen mode |
| --window-size=width,height | Set initial window size (e.g., `--window-size=1920,1080`) |
| --window-position=x,y | Set initial window position |
| --kiosk | Run Chrome in kiosk mode (fullscreen without UI) |
| --force-device-scale-factor=N | Override device scale factor (e.g., `=2` for retina) |

### Headless Mode

| Switch | Description |
| --- | --- |
| --headless=new | Run Chrome in new headless mode (recommended) |
| --headless | Run Chrome in legacy headless mode |
| --disable-gpu | Disable GPU hardware acceleration (often used with headless) |
| --screenshot=FILE | Take a screenshot and save to file (headless only) |
| --print-to-pdf=FILE | Print the page to PDF (headless only) |

### User Profile and Data

| Switch | Description |
| --- | --- |
| --user-data-dir=PATH | Set custom user data directory for profile |
| --profile-directory=NAME | Use a specific profile directory name |
| --incognito | Start Chrome in incognito mode |
| --guest | Start Chrome in guest mode |
| --disable-extensions | Disable all Chrome extensions |

### Security and Permissions

| Switch | Description |
| --- | --- |
| --no-sandbox | Disable sandbox mode (use with caution, often needed in Docker) |
| --disable-web-security | Disable same-origin policy (for testing only) |
| --allow-insecure-localhost | Ignore TLS/SSL errors on localhost |
| --ignore-certificate-errors | Ignore SSL certificate errors |
| --allow-running-insecure-content | Allow mixed content on HTTPS pages |
| --disable-popup-blocking | Disable popup blocking |
| --disable-notifications | Disable notification permission prompts |
| --auto-accept-camera-and-microphone-capture | Auto-accept camera/microphone permissions |

### Network and Proxy

| Switch | Description |
| --- | --- |
| --proxy-server=HOST:PORT | Use specified proxy server |
| --proxy-bypass-list=HOSTS | Comma-separated list of hosts to bypass proxy |
| --no-proxy-server | Don't use a proxy server, always make direct connections |
| --host-resolver-rules=RULES | Custom DNS resolution rules |
| --disable-background-networking | Disable background network requests |

### Performance and Debugging

| Switch | Description |
| --- | --- |
| --remote-debugging-port=PORT | Enable remote debugging on specified port |
| --auto-open-devtools-for-tabs | Automatically open DevTools for each tab |
| --enable-logging | Enable logging to stderr |
| --log-level=N | Set log level (0=INFO, 1=WARNING, 2=ERROR) |
| --disable-dev-shm-usage | Disable /dev/shm usage (helps in Docker containers) |
| --disable-infobars | Disable info bars (deprecated in newer versions) |

### Media and Audio

| Switch | Description |
| --- | --- |
| --mute-audio | Mute all audio output |
| --use-fake-ui-for-media-stream | Use fake UI for media stream requests |
| --use-fake-device-for-media-stream | Use fake devices for media capture |
| --autoplay-policy=no-user-gesture-required | Allow autoplay without user interaction |
| --disable-accelerated-video-decode | Disable GPU video decoding |

### Feature Flags and Experiments

| Switch | Description |
| --- | --- |
| --enable-features=FEATURES | Enable specified features (comma-separated) |
| --disable-features=FEATURES | Disable specified features (comma-separated) |
| --enable-blink-features=FEATURES | Enable Blink runtime features |
| --disable-blink-features=FEATURES | Disable Blink runtime features |

### Downloads

| Switch | Description |
| --- | --- |
| --safebrowsing-disable-download-protection | Disable Safe Browsing download protection |
| --disable-default-apps | Disable default apps on first run |

## Common Testing Configurations

Here are some recommended combinations of switches for common testing scenarios:

### Docker / CI Environment

```python
# Recommended switches for Docker/CI
chrome_options.add_argument("--headless=new")
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--disable-dev-shm-usage")
chrome_options.add_argument("--disable-gpu")
chrome_options.add_argument("--window-size=1920,1080")
```

### Media Testing (WebRTC, Video Calls)

```python
# Switches for testing media features
chrome_options.add_argument("--use-fake-ui-for-media-stream")
chrome_options.add_argument("--use-fake-device-for-media-stream")
chrome_options.add_argument("--auto-accept-camera-and-microphone-capture")
chrome_options.add_argument("--autoplay-policy=no-user-gesture-required")
```

### Clean Test Environment

```python
# Switches for isolated test environment
chrome_options.add_argument("--incognito")
chrome_options.add_argument("--disable-extensions")
chrome_options.add_argument("--disable-popup-blocking")
chrome_options.add_argument("--disable-notifications")
```

## Using Chrome Switches with TestingBot

When running your Selenium tests on [TestingBot](https://testingbot.com), you can pass Chrome command-line switches through the ChromeOptions capability:

```python
from selenium import webdriver
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
chrome_options.add_argument("--start-maximized")
chrome_options.add_argument("--disable-notifications")

capabilities = {
    "browserName": "chrome",
    "browserVersion": "latest",
    "platformName": "WIN10",
    "tb:options": {
        "key": "your_key",
        "secret": "your_secret",
        "name": "My Test"
    }
}
chrome_options.set_capability("tb:options", capabilities["tb:options"])

driver = webdriver.Remote(
    command_executor="https://hub.testingbot.com/wd/hub",
    options=chrome_options
)
```

**Note:** Some switches may not work in cloud testing environments due to security restrictions. TestingBot provides alternative capabilities for many common use cases. Check the [TestingBot documentation](https://testingbot.com/support/web-automate/selenium/test-options) for more information.

- [![Share on Facebook](https://static.addtoany.com/buttons/facebook.svg) ](https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Ftestingbot.com%2Fsoftware-testing-questions%2Fchrome-command-line-switches.md&linkname=)
- [![Share on Twitter](https://static.addtoany.com/buttons/twitter.svg) ](https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Ftestingbot.com%2Fsoftware-testing-questions%2Fchrome-command-line-switches.md&linkname=)
- [![Share on Linkedin](https://static.addtoany.com/buttons/linkedin.svg) ](https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Ftestingbot.com%2Fsoftware-testing-questions%2Fchrome-command-line-switches.md&linkname=)
- [![Share on Hacker News](https://static.addtoany.com/buttons/y18.svg) ](https://www.addtoany.com/add_to/hacker_news?linkurl=https%3A%2F%2Ftestingbot.com%2Fsoftware-testing-questions%2Fchrome-command-line-switches.md&linkname=)

 ![TestingBot Logo](https://testingbot.com/assets/logo-head-2f7f08db4ac9c4a3b1a784047410f8a4ece708e7e9f10ed16e20fdd8310f8de3.svg)

## Sign up for a Free Trial

Start testing your apps with TestingBot.

No credit card required.

[Start Free Trial](https://testingbot.com/users/sign_up)

## Other Questions

### [Testing on Safari for Windows users.](https://testingbot.com/software-testing-questions/download-safari-windows "Testing on Safari for Windows users.")

### [How to handle Performance issues, such as slow script execution or high memory usage in Puppeteer?](https://testingbot.com/software-testing-questions/how-to-handle-puppeteer-performance-issues "How to handle Performance issues, such as slow script execution or high memory usage in Puppeteer?")

### [Find out what exactly a test-suite is, with regards to automted testing](https://testingbot.com/software-testing-questions/what-is-a-test-suite "Find out what exactly a test-suite is, with regards to automted testing")

### [What is Geolocation Testing?](https://testingbot.com/software-testing-questions/what-is-geolocation-testing "What is Geolocation Testing?")

### [Use an online browser sandbox for security and privacy.](https://testingbot.com/software-testing-questions/what-is-an-online-browser-sandbox "Use an online browser sandbox for security and privacy.")

### [Learn about remote browsers and how to use them.](https://testingbot.com/software-testing-questions/what-is-a-remote-browser "Learn about remote browsers and how to use them.")
