WebDriverJS: Chrome profile


WebDriverJS, by default, initializes browsers without any profile data. This is to ensure a pristine state.

But did you know, there’s a way to initialize a driver with a browser profile. In this tutorial, we’ll learn how to do that with Chrome.


You need the following installed:

If you’re on Mac OS and have homebrew installed (see video if you don’t have it installed), you can do the following:

# install Chrome browser
$ brew cask install google-chrome
# install ChromeDriver
$ brew cask install chromedriver

These steps are covered in this video.

Build driver

To build your driver:

const { Builder } = require('selenium-webdriver');

const builder = new Builder();
const driver = builder.build();

Check out article WebDriverJS: Launch a browser for more details.

Chrome options

Before initializing the driver, add argument user-data-dir or --user-data-dir to Chrome options:

const { Options } = require('selenium-webdriver/chrome');

const options = new Options();
// replace `./path/to/profile` with your Chrome profile path

Note: ChromeDriver expects ./path/to/profile/Default/ to exist. If it doesn’t exist, it’ll create the Default/ directory for your profile path.

Set the Chrome options to your builder before building the driver:

// ...
const driver = builder.build();

You can verify the profile path is correct by opening chrome://version in your WebDriver browser:



You can find all code examples (as well as others), in my webdriverjs-recipes repository.

Please support this site and join our Discord!