Adding Browser Extentions with Selenium WebDriver

When Selenium WebDriver launch a browser , it creates a new profile or options set with browser’s default features.This launched browser does not contain addons or extentions.In everytime we need to add on , which addon or extention we want to use.


ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addExtensions( new File( "/path/to/extension.crx" )) ;
driver = new ChromeDriver(chromeOptions);


FirefoxProfile profile = new FirefoxProfile() ; 
profile.addExtension( new File( "/path/to/addon.xpi" )) ; 
FirefoxOptions firefoxOptions = new FirefoxOptions() ; 
firefoxOptions.setProfile(profile) ; 
FirefoxDriver driver = new FirefoxDriver(firefoxOptions) ;

Install All Selenium WebDrivers with One Command

Did you ever want to install or upgrade all Selenium WebDrivers using one line commmand? On windows you can do it with a Chocolately.Chocolatey is a package manager for windows and yummy way to software installation.

Firstly , you need to install chocolately.To do it , open command prompt as an administrator then write this lines.

@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString(''))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

If installation is success , now you can install drivers

choco install selenium-all-drivers 

List of installed Web Drivers

  • selenium-opera-driver
  • selenium-ie-driver
  • selenium-edge-driver
  • selenium-all-drivers
  • selenium-gecko-driver
  • selenium-chrome-driver

All Selenium Web Drivers will be installed on under “C:\tools\selenium” directory.Don’t forget to add this path as “System Environments Variable”


Upgrading is similar to installation , just change the install variable as upgrade.

choco upgrade selenium-all-drivers
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now