Error Loading Extension Could not load extension from #39;C:..LocalTempscoped_dir6312_32763internal#39;. Loading of unpacked extensions is disabled(加载扩展时出错无法从“C:..LocalTempscoped_dir6312_32763internal加载扩展.已禁用加载未打包的扩展)
问题描述
当我运行我的 webdriver 脚本时,我会收到一个确认对话框,其中包含以下消息:
When am running my webdriver script, am getting a confirmation dialog box with below message:
加载扩展出错
无法从C:UsersusernameAppDataLocalTempscoped_dir6312_32763internal"加载扩展.管理员禁止加载解压的扩展.
Could not load extension from 'C:UsersusernameAppDataLocalTempscoped_dir6312_32763internal'. Loading of unpacked extensions is disabled by the administrator.
要重试吗?
是 否
点击是"让测试运行.
我不知道为什么会提示这个对话框,
I am not sure why am I getting this dialog box prompted,
我已经尝试了下面提到的解决方法,但它们都不起作用:
I've tried the mentioned workarounds below but neither of them are working:
- 用最新版本替换了 chrome 驱动程序.
在我的脚本中添加以下代码:
- Replaced chrome driver with latest version.
Added below code in my script:
ChromeOptions options = new ChromeOptions();
options.addArguments("no-sandbox");
options.addArguments("disable-extensions");
driver = new ChromeDriver(options);
下面是我的测试方法:
public void Login() throws IOException{
test = extent.startTest("Login");
signInPage = new SignInPage(driver);
signInPage.enterMailId();
String screenShotPath = GetScreenShot.capture(driver, "enterMailId");
test.log(LogStatus.PASS, "Email id is entered successfully: " + test.addScreenCapture(screenShotPath));
signInPage.enterpwd();
//test.log(LogStatus.INFO, "Password is entered successfully");
screenShotPath = GetScreenShot.capture(driver, "enterpwd");
test.log(LogStatus.PASS, "Password is entered successfully: " + test.addScreenCapture(screenShotPath));
signInPage.clickOnLogin();
test.log(LogStatus.PASS, "User logged in successfully");
}
下面是调用浏览器的方法:
Below is the method which invoke the browser:
private void initChromeBrowser(){
System.setProperty("webdriver.chrome.driver", userdir +"\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("test-type");
options.addArguments("no-sandbox");
//Fix for cannot get automation extension
options.addArguments("disable-extensions");
options.addArguments("start-maximized");
options.addArguments("--js-flags=--expose-gc");
options.addArguments("disable-plugins");
options.addArguments("--enable-precise-memory-info");
options.addArguments("--disable-popup-blocking");
options.addArguments("--disable-default-apps");
options.addArguments("test-type=browser");
options.addArguments("disable-infobars");
driver = new ChromeDriver(options);
launchApp();
}
我是否应该在我的脚本中加入任何其他内容以防止出现该对话框.
Could there be anything else that I should incorporate in my script to prevent the dialog box.
推荐答案
您可以将 useAutomationExtension
能力设置为 false.
You can set the useAutomationExtension
capability to false.
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("useAutomationExtension", false);
WebDriver driver = new ChromeDriver(options);
此功能将有助于不加载 Chrome 自动化扩展程序.因此,加载扩展失败"弹出窗口不会出现.
This capability will help to not load Chrome Automation extension. Due to which, "Failed to load extension" popup would not appear.
但请注意,如果没有 Chrome 自动化扩展,您将无法执行任何窗口大小调整/定位操作.
But please note you will not be able to perform any window resizing/positioning operations without the Chrome automation extension.
希望这会有所帮助!
来源:https://bugs.chromium.org/p/chromedriver/issues/detail?id=1749
这篇关于加载扩展时出错无法从“C:..LocalTempscoped_dir6312_32763internal"加载扩展.已禁用加载未打包的扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:加载扩展时出错无法从“C:..LocalTempscoped_dir6312_32763internal"加载扩展.已禁用加载未打包的扩展


- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- 如何使用WebFilter实现授权头检查 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01