There are 2 ways to add a Chrome plugin to a Selenium test:
The second is preferable due to preserving resources (to prevent unpacking the crx file), which will prevent "out of memory" errors for large extensions.
The sample code offered at https://sites.google.com/a/chromium.org/chromedriver/extensions can be simplified further:
ChromeOptions options = new ChromeOptions(); options.addArguments("load-extension=C:\\Users\\user\\..."); WebDriver driver = new ChromeDriver(options); driver.get("http://website.com");
Here is code to consider to use a subfolder called "chromeExtensions" in the main test folder:
options.addArguments("load-extension=" + System.getProperty("user.dir") + File.separator + "chromeExtensions" + File.separator + "screencastify");
The hardest part might be getting an unpacked version of the plugin. Here are 2 options:
1. Copy the extension folder from the Chrome profile.
2. Download the .crx file and unzip it
For #1, you can visit chrome://version to obtain the path to the profile. You will find an extension folder that will match the name of the key found in the chrome plugin url, for example: https://chrome.google.com/webstore/detail/screencastify-screen-vide/mmeijimgabbpbgpdklnllpncmdofkcpn
has this name: mmeijimgabbpbgpdklnllpncmdofkcpn.
For #2, you may want to consider chrome-extension-downloader.com for the download and 7-zip.org to unzip it.