无法从scoped_dir6312_32763/internal加载扩展.管理员使用ChromeDriver Selenium禁用了未打包扩展的加载 [英] Could not load extension from scoped_dir6312_32763/internal.Loading of unpacked extensions is disabled by the administrator with ChromeDriver Selenium

查看:195
本文介绍了无法从scoped_dir6312_32763/internal加载扩展.管理员使用ChromeDriver Selenium禁用了未打包扩展的加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用vue-cli 3创建了一个项目,该项目会自动为我设置e2ed测试.当我尝试运行测试时,从chrome浏览器弹出一个对话框,告诉我管理员已禁用解压扩展程序的加载".

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);

现在这是Java代码,但是我认为在vue.js项目中可以实现相同的目的.但是,我不知道将此配置放在何处.

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.

推荐答案

此弹出窗口:

,错误消息为...

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.

根据讨论无法从以下位置加载扩展:...管理员禁止加载解压缩的扩展程序 ChromeDriver 使用 Chrome自动化扩展程序来自动执行各种功能,例如窗口大小调整,窗口定位等.

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.

无法加载扩展程序.弹出窗口表示尚未加载此扩展程序.如果您手动关闭弹出窗口,浏览器将正常运行, ChromeDriver 命令将继续按预期运行.但是,在这种情况下,如果您尝试执行窗口大小调整或窗口重新定位命令,它将抛出错误 unknown error: cannot get automation extension .

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.

每当组织管理策略禁止扩展时,直到 ChromeDriver v2.28 ,用户都使用参数disable-extensions来绕过限制,如下所示:

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);

效果很好.

ChromeDriver v2.28 开始,每当通过测试通过disable-extensions标志时, ChromeDriver 隐式地通过 disable-extensions-except 标志,加载 Chrome自动化扩展.此扩展程序可帮助Chromedriver执行窗口大小调整和窗口重新定位操作.

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.

此问题取决于无头的硒支持.

作为替代方案,您可以将 useAutomationExtension 功能设置为false,如下所示:

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);

此功能将有助于不加载 Chrome自动化扩展程序,并且不会显示 Failed to load extension 弹出窗口.但是如果没有 Chrome自动化扩展程序,您将无法执行任何窗口大小调整/定位操作.

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.

现在,对无头的硒支持已得到解决 ChromeDriver 将不再需要此扩展程序,因此您不应该看到此错误/弹出窗口.

Now, Selenium support for headless being resolved ChromeDriver will no longer require this extension and you shouldn't have seen this error/popup.

最简单的解决方案是在以下任意一种情况下使用最新版本的 ChromeDriver Chrome 组合:

The simplest solution would be to use the latest version of ChromeDriver and Chrome combination among either of the following:

  • 如果您使用的是 Chrome 73版,请下载 ChromeDriver 73.0.3683.20
  • 如果您使用的是 Chrome 72版,请下载 ChromeDriver 2.46 ChromeDriver 72.0.3626.69
  • 如果您使用的是 Chrome 71版,请下载 ChromeDriver 2.46 ChromeDriver 71.0.3578.137
  • 对于旧版本的Chrome,请参阅此
  • 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 or ChromeDriver 72.0.3626.69
  • If you are using Chrome version 71, please download ChromeDriver 2.46 or ChromeDriver 71.0.3578.137
  • For older version of Chrome, please see this discussion.

其他一些替代方法是:

  • 注册表项 ExtensionInstallWhitelist添加到白名单
  • 删除注册表项 ExtensionInstallBlacklist,其中包含具有值 *
  • 的字符串键 1
  • Add the Registry Key ExtensionInstallWhitelist to whitelist
  • Remove the Registry Key ExtensionInstallBlacklist containing a string key 1 with value *

这篇关于无法从scoped_dir6312_32763/internal加载扩展.管理员使用ChromeDriver Selenium禁用了未打包扩展的加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆