ChromeDriver Options for starting Chrome with WebDriver

//ChromeDriver Options for starting Chrome with WebDriver

ChromeDriver Options for starting Chrome with WebDriver

In this Blog we take a look at some of the options provided with the ChromeDriver Server for starting Chrome with various options when using Selenium WebDriver. The examples are in C# so you may need to tailor for Java.

Set Path to the ChromeDriver Server

or you could add the path to chromedriver.exe in your system path.

Hide the automation toolbar warning

Put Chrome into mobile emulation mode

C# example:

Java Example:

An alternative is to set individual device attributes, this is a more complex approach, and details can be found at

Use custom profile (also called user data directory)

By default, ChromeDriver will create a new temporary profile for each session. At times you may want to set special preferences or just use a custom profile altogether. If the former, you can use the ‘chrome.prefs’ capability (described later below) to specify preferences that will be applied after Chrome starts. If the latter, you can use the user-data-dir Chrome command-line switch to tell Chrome which profile to use:

You can create your own custom profile by just running Chrome (on the command-line or through ChromeDriver) with the user-data-dir switch set to some new directory. If the path doesn’t exist, Chrome will create a new profile in the specified location. You can then modify the profile settings as desired, and ChromeDriver can use the profile in the future. Open chrome://version in the browser to see what profile Chrome is using.

Start Chrome maximized

Using a Chrome executable in a non-standard location

Using Headless Chrome

Add Extensions to Chrome


Run chromedriver --help to see command line arguments for your version.

NOTE: The above examples are in WebDriver C#, for Java, you may need to use options.addArguments


Selenium Training Courses
By |2018-03-29T14:31:13+00:00October 13th, 2017|Categories: Selenium WebDriver|Tags: , , , , |2 Comments

About the Author:

Tom has been involved in automated software testing for over 20 years, both as a trainer and consultant. He is both an HP/Microfocus & Ranorex certified trainer.


  1. kumar December 22, 2017 at 7:19 pm

    Hi Tom,
    Nice article but how do you disable location access in chromedriver.

Comments are closed.

Contact Info

Lasyard House, Underhill St. Bridgnorth WV16 4BB

Phone: +44 (0)333 939 8884