How to test a Chrome Extension
Contributors: Meir Blachman
Problem
Section titled “Problem”You need to test a chrome extension
Solution
Section titled “Solution”Use Puppeteer.LaunchAsync passing arguments specifying to load your extension.
using var browserFetcher = new BrowserFetcher();await browserFetcher.DownloadAsync(BrowserFetcher.DefaultRevision);
var pathToExtension = "path/to/extension";var launchOptions = new LaunchOptions(){ Headless = false, Args = new [] { $@"--disable-extensions-except=""{pathToExtension}""", $@"--load-extension=""{pathToExtension}""" }};
using (var browser = await Puppeteer.LaunchAsync(launchOptions))using (var page = await browser.NewPageAsync()){ // test your extension here}Made with love by Dario Kondratiuk