Code : Automating Extension automation with Selenium

Below code is for Chrome. This will work for Firefox  with little change in code.

// Load extension file
File file = new File(“chrome.crx”);
ChromeOptions options = new ChromeOptions();

// Launch browser instance with the extension
WebDriver driver = new ChromeDriver(options);

// Access Extension in browser window .. This further allows you to automate all the actions through Selenium