加载扩展时出错无法从“C:..LocalTempscoped_dir6312_32763internal"加载扩展.已禁用加载未打包的扩展 [英] Error Loading Extension Could not load extension from 'C:..LocalTempscoped_dir6312_32763internal'. Loading of unpacked extensions is disabled

查看:15
本文介绍了加载扩展时出错无法从“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:

  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:..LocalTempscoped_dir6312_32763internal"加载扩展.已禁用加载未打包的扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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