WebDriverJS: Firefox profile

How do we set the Firefox profile for WebDriverJS (Selenium for Node.js)?


First, you’ll need Firefox and geckodriver (you can follow this video if you’re on Mac OS).

If you have homebrew installed, you can run the following:

# install the browser
$ brew cask install firefox

# install the driver
$ brew install geckodriver

Building your driver

Now you want to start building your driver. See how it’s done here.

Firefox options

Before instantiating the driver, you want to set the profile in the Firefox options:

const firefox = require('selenium-webdriver/firefox');
const options = new firefox.Options();
// replace `/path/to/profile`

Note: Unlike ChromeDriver, the profile must be valid otherwise the driver will fail to build. To create and manage Firefox profiles, see the official documentation.

Now let’s update the builder so WebDriverJS launches Firefox based on the specified profile:


To confirm that the profile is correct, you can check the path if you go to about:support:

const driver = builder.build();