Loading unpacked extensions error when running Protractor E2E tests

Viewed 5086

After some recently rolled out policy updates with Chrome, we are now experiencing the unpacked extension issue when running Protractor E2E tests with Selenium Web Driver.

The error is:

Failed to load extension from:C:\Users\...\AppData\Local\Temp\scoped_dir9090_11922\internal.

Loading of unpacked extensions is disabled by the administrator.

This internal folder was unziped from internal.zip, and contains the following manifest.json:

{
  "key": "MIGfMA0GCSqGSI...",
  "name": "Chrome Automation Extension",
  "version": "1",
  "manifest_version": 2,
  "description": "Exposes extension APIs for automating Chrome",
  "background": {
    "scripts": ["background.js"]
  },
  "permissions": [
     "tabs", "management", "<all_urls>"
  ]
}

In the protractor config file we tried to disable extensions here, but it had no effect:

multiCapabilities: [        
         {
             browserName: 'chrome',
             chromeOptions: {
                 args: [
                     '--disable-extensions', '--disable-plugins', '--start-maximized'
                 ]
             }
         },
    ]

As per comment 22 on March 31st in this Chrome bug, they introduced a new Chrome option, --useAutomationExtension. So as soon as I get Protractor working again on my box, I will try it as follows:

chromeOptions: {
    args: [
          '--disable-extensions', '--disable-plugins', '--start-maximized',
          '--useAutomationExtension=false'
    ]
}

My primary question is:

Has anyone pinpointed exactly the extension name which is unpacked, and what to communicate to their IT department for whitelist purposes? Here is an old post which addresses this issue.

In addition:

  1. Has anyone successfully implemented the --useAutomationExtension=false option in protractor.conf.js?

I will update this post as I progress throughout the day, hoping to add some clarity.

2 Answers

I am seeing this same problem in 2020 with recent versions of node and @angular, under Ubuntu 20.4.

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 9.0.7
Node: 12.18.2
OS: linux x64

Angular: 9.0.7
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.7
@angular-devkit/build-angular     0.1000.0
@angular-devkit/build-optimizer   0.1000.0
@angular-devkit/build-webpack     0.1000.0
@angular-devkit/core              9.0.7
@angular-devkit/schematics        9.0.7
@ngtools/webpack                  10.0.0
@schematics/angular               9.0.7
@schematics/update                0.900.7
rxjs                              6.5.5
typescript                        3.7.5
webpack                           4.43.0

The above instructions to put 'useAutomationExtension: false' in the chromeOptions section of protractor.conf.js worked for me.

However, '--headless' will not fix this problem because the error message, while a bit cryptic, is telling the truth. Thus, setting a 'headless' option just causes the test to time out because the error displays in a popup and it requires one to click the 'ok' button in order to continue the test.

Unless you have a dev channel version of chromium, the automation extension is not in your browser. So chrome driver by default is trying to use an extension that isn't available on non-dev-channel versions of chromium.

Availability: Dev channel only. Learn more.

https://developer.chrome.com/extensions/automation

Personally, I think this is crazy. The driver should check to see if this extension is available before attempting to use it. I have seen many posts on this subject and not one seems to have hit on the real issue. The answer above will solve the problem, but the root of this is that chrome driver's assumption is that the extension is always there. Thus, testing against a 'real world browser version' (Most users are not downloading dev-channel versions of chromium) - which should be the default - is the exception.

Related