I've been trying to handle the basic authentication during my protractor test. Some hard time on it, so i've found a chrome plugin wich sends automatically my credentials for websites that require basic authentication.
As each time that chromedriver is executed, a new profile is loaded, how can i permanelty add a plugin to my tests? I know that there is https://sites.google.com/a/chromium.org/chromedriver/extensions, but i dont think this very clear.
You need to configure
extensions
list insidechromeOptions
:Note that it in
extensions
, it is important to provide a list of base-64 encoded packed Chrome extension.To get a base64 encoded extension, you need to read the
.ctx
extension file and encode the contents withbase64
. For example, using python:Or, easier, make a
helper.js
file usingfs
andq
:Then, in your protractor config, use this
getCapabilities()
function to get capabilities:Currently, it works with a single extension, so there is a room for improvement.
Also, look through the following issue in case you have problems:
Check this: https://github.com/andresdominguez/elementor/blob/master/bin/elementexplorer.js#L194
Here I am loading an extension from a local directory. The extension is not a crx file, but the uncompressed version.