I am automating my application using Selenium Webdriver, C#, Visual Studio and Chrome browser.
I am getting below popup when selenium tried to open the chrome browse
This error message...
Failed to load extension from:C:\Users\VARA~1.PAK\AppData\Local\Temp\scoped_dir6712_14913\internal.
Loading of unpacked extensions is disabled by the administrator.
...implies that an extension was not been loaded as it was 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.
Background: Till ChromeDriver v2.28 whenever an organizations admin policy forbidden extensions, to bypass the restriction users have used the argument disable-extensions as follows (Java Code Sample):
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.
As a solution, you can set the useAutomationExtension capability to false as follows (Java Code Sample):
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.
The best approach would be to use the latest version of ChromeDriver and Chrome combination among either of the following:
ChromeDriver 73.0.3683.20ChromeDriver 2.46 or ChromeDriver 72.0.3626.69ChromeDriver 2.46 or ChromeDriver 71.0.3578.137Some diverse alternatives:
ExtensionInstallWhitelist to whitelistExtensionInstallBlacklist containing a string key 1 with value *