Error Loading Extension Could not load extension from 'C:\..\Local\Temp\scoped_dir6312_32763\internal'. Loading of unpacked extensions is disabled
You can set the useAutomationExtension
capability to false.
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("useAutomationExtension", false);
WebDriver driver = new ChromeDriver(options);
This capability will help to not load Chrome Automation extension. Due to which, "Failed to load extension" popup would not appear.
But please note you will not be able to perform any window resizing/positioning operations without the Chrome automation extension.
Hope this helps!
Source : https://bugs.chromium.org/p/chromedriver/issues/detail?id=1749
This error message...
Error Loading Extension
Could not load extension from 'C:\Users\username\AppData\Local\Temp\scoped_dir6312_32763\internal'. Loading of unpacked extensions is disabled by the administrator.
Would you like to retry?
Yes No
...implies that an extension was not been loaded as it was disabled by the administrator.
As per Issue 1749: 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.
Solution
The simplest solution would be to use the latest version of ChromeDriver and Chrome combination among either of the following:
- If you are using Chrome version 73, please download
ChromeDriver 73.0.3683.20
- If you are using Chrome version 72, please download
ChromeDriver 2.46
orChromeDriver 72.0.3626.69
- If you are using Chrome version 71, please download
ChromeDriver 2.46
orChromeDriver 71.0.3578.137
- For older version of Chrome, please see this discussion.
Alternative
Some other alternatives are:
- Add the Registry Key
ExtensionInstallWhitelist
to whitelist - Remove the Registry Key
ExtensionInstallBlacklist
containing a string key 1 with value*
I encountered this same issue after upgrading to ChromeDriver v2.29. I have Chrome v58.0. It looks like an open issue: https://bugs.chromium.org/p/chromedriver/issues/detail?id=639#c26
Depending on your versions, YMMV, in my case, I had to downgrade to ChromeDriver v2.27.
If you go to chrome://version/
you can see under the Command:
C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-background-networking --disable-client-side-phishing-detection --disable-default-apps --disable-extensions --disable-extensions-except="C:\Users\Inno3\AppData\Local\Temp\scoped_dir80288_6333\internal" --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --disable-web-resources --enable-automation --enable-logging --force-fieldtrials=SiteIsolationExtensions/Control --ignore-certificate-errors --log-level=0 --metrics-recording-only --no-first-run --password-store=basic --remote-debugging-port=12354 --safebrowsing-disable-auto-update --start-maximized --test-type=webdriver --use-mock-keychain --user-data-dir="C:\Users\Inno3\AppData\Local\Temp\scoped_dir80288_30914" --flag-switches-begin --flag-switches-end data:,
This is why it throw error, I don't know why it give error, maybe user policy or Chrome updates?
--disable-extensions-except="C:\Users\Inno3\AppData\Local\Temp\scoped_dir80288_6333\internal"
I believe the argument is added by Selenium, you need the following command to tell selenium to not add it.
In C#:
chromeOptions = OpenQA.Selenium.Chrome.ChromeOptions();
chromeOptions.AddAdditionalCapability("useAutomationExtension", false);
river = new ChromeDriver(chromeOptions);
launchApp();
In Java:
chromeOptions.AddAdditionalCapability("useAutomationExtension", false)