I have created a project using vue-cli 3 which automatically set up e2ed tests for me. When I try to run the tests, I get a popup from chrome, telling me that "Loading of unpacked extensions is disabled by the administrator".
This seems to be a common problem, one solution offered elsewhere is
ChromeOptions o = new ChromeOptions();
o.addArguments("disable-extensions");
o.addArguments("--start-maximized");
WebDriver driver = new ChromeDriver(o);
Now this is Java code, but I assume there's a way to achieve the same thing in a vue.js project. However, I have no idea where to put this configuration.
The fix would be to talk to your IT team and find out why they have blacklisted chrome extensions, you will need them to delete them, restart your machine and run the test case again. It should be able to launch the chrome browser successfully this time.
Follow the steps to load the unpacked extension. Goto Chrome Settings using three dots on the top right corner. Then Select Extensions. Click on Load Unpacked and select your Unzip folder.
Extensions can be loaded in unpacked mode by following the following steps: Visit chrome://extensions (via omnibox or menu -> Tools -> Extensions). Enable Developer mode by ticking the checkbox in the upper-right corner. Click on the "Load unpacked extension..." button.
This popup:
with the error message as...
Error Loading Extension
Failed to load extension from: 'C:\Users\user_name\AppData\Local\Temp\scoped_dir6312_32763\internal'. Loading of unpacked extensions is disabled by the administrator.
OK
...implies that an extension has not been loaded as it is disabled by the administrator.
As per the discussion Failed to load extention from: ... Loading of unpacked extensions is disabled by the administrator ChromeDriver uses Chrome automation extension for automating various functions like window sizing, window positioning, etc.
The Failed to load extension.. popup means that this extension has not been loaded. If you manually close the popup, browser will act normally and ChromeDriver commands will continue to work as expected. But in this case if you try executing window resizing or window re-positioning commands, it will throw an error as unknown error: cannot get automation extension
.
Till ChromeDriver v2.28 whenever an organizations admin policy forbidden extensions, to bypass the restriction users have used the argument disable-extensions
as follows:
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-extensions");
WebDriver driver = new ChromeDriver(options);
and it worked perfecto.
ChromeDriver v2.28 onwards, whenever disable-extensions
flag is passed by test, ChromeDriver implicitly passes disable-extensions-except
flag which in turn loads Chrome automation extension. This extension helps Chromedriver to perform window sizing and window re-positioning operations.
So, if your organizational admin policy blocks extensions, display of popup Failed to load extension from: ... Loading of unpacked extensions is an expected behavior.
This issue had a dependency on Selenium support for headless.
As an alternative, you can set the useAutomationExtension
capability to false
as follows:
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("useAutomationExtension", false);
WebDriver driver = new ChromeDriver(options);
This capability inturn will help to not load Chrome Automation extension and Failed to load extension
popup would not appear. But you will not be able to perform any window resizing/positioning operations without the Chrome automation extension.
Now, Selenium support for headless being resolved ChromeDriver will no longer require this extension and you shouldn't have seen this error/popup.
The simplest solution would be to use the latest version of ChromeDriver and Chrome combination among either of the following:
ChromeDriver 73.0.3683.20
ChromeDriver 2.46
or ChromeDriver 72.0.3626.69
ChromeDriver 2.46
or ChromeDriver 71.0.3578.137
Some other alternatives are:
ExtensionInstallWhitelist
to whitelistExtensionInstallBlacklist
containing a string key 1 with value *
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With