错误加载扩展名无法从'C:\ .. \ Local \ Temp \ scoped_dir6312_32763 \ internal'加载扩展名.已解压缩的扩展程序的加载已禁用 [英] Error Loading Extension Could not load extension from 'C:\..\Local\Temp\scoped_dir6312_32763\internal'. Loading of unpacked extensions is disabled

查看:413
本文介绍了错误加载扩展名无法从'C:\ .. \ Local \ Temp \ scoped_dir6312_32763 \ internal'加载扩展名.已解压缩的扩展程序的加载已禁用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当运行我的webdriver脚本时,会出现一个确认对话框,其中包含以下消息:

When am running my webdriver script, am getting a confirmation dialog box with below message:

错误加载扩展程序

Error Loading Extension

无法从'C:\ Users \ username \ AppData \ Local \ Temp \ scoped_dir6312_32763 \ internal'加载扩展名.管理员禁止加载解压缩的扩展程序.

Could not load extension from 'C:\Users\username\AppData\Local\Temp\scoped_dir6312_32763\internal'. Loading of unpacked extensions is disabled by the administrator.

您想重试吗?

是不是

单击是"可以运行测试.

Clicking "yes" lets the tests run.

我不确定为什么会提示此对话框,

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:

  1. 已替换最新版本的chrome驱动程序.
  2. 在我的脚本中添加了以下代码:

  1. Replaced chrome driver with latest version.
  2. 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:\ .. \ Local \ Temp \ scoped_dir6312_32763 \ internal'加载扩展名.已解压缩的扩展程序的加载已禁用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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