Let’s go over how to set the Firefox profile for WebDriverJS (Selenium for Node.js).
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 build your driver. See how it’s done here.
Before instantiating the driver, you want to set the profile in Firefox options:
const firefox = require('selenium-webdriver/firefox'); const options = new firefox.Options(); // replace `/path/to/profile` options.setProfile('/path/to/profile');
Update the builder so WebDriverJS launches Firefox based on the specified profile:
To confirm the profile is correct, you can check the path if you go to
const driver = builder.build(); driver.get('about:support');