简体   繁体   English

使用ChromeDriver for Selenium时未将Chrome扩展程序添加到Chrome浏览器

[英]Chrome extension not being added to Chrome browser when using ChromeDriver for Selenium

I am attempting to open Chrome browser with an extension. 我正在尝试使用扩展程序打开Chrome浏览器。 Chrome opens, but it doesn't have my extension. Chrome打开,但没有我的扩展程序。 Here is my code. 这是我的代码。 Please let me know what I am doing wrong. 请让我知道我在做什么错。

private IWebDriver GetChromeDriver(BrowserConfigurationOptions browserConfigOptions)
{
    var outPutDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
    var chromeDriverPath = Path.GetFullPath(outPutDirectory + @"\Drivers");

    var options = new ChromeOptions();
    options.AddExtension(outPutDirectory + @"\3.1.5_0.crx");
    options.AddArguments("disable-infobars");
    options.AddUserProfilePreference("credentials_enable_service", false);
    if (browserConfigOptions.KioskModeForChrome)
        options.AddArgument("--kiosk");

    return new ChromeDriver(chromeDriverPath, options);
}

The extension exists in the path where I expect it to be. 该扩展名存在于我期望的路径中。

  • Chrome version: 60 Chrome版本:60
  • ChromeDriver v:2.29 ChromeDriver v:2.29
  • Selenium v: 3.5.2 硒v:3.5.2

The issue is that WebDriver 3.5.2 does not support ChromeDriver 2.29. 问题是WebDriver 3.5.2不支持ChromeDriver 2.29。 These problems can be resolved if we downgrade to WebDriver 3.4. 如果我们降级到WebDriver 3.4,则可以解决这些问题。 Then everything works. 然后一切正常。 I logged an issue on their Github but I believe that backwards compatibility is not expected between WebDriver and older versions of ChromeDriver. 我在他们的Github上记录了一个问题,但我认为WebDriver和旧版本的ChromeDriver之间不希望向后兼容。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 Selenium ChromeDriver 打开 chrome 浏览器时遇到一些问题 - Having some trouble when opening chrome browser with Selenium ChromeDriver 在 Selenium.WebDriver.ChromeDriver NuGet package 中找不到更新的 Chrome 浏览器 - Updated Chrome Browser not found in Selenium.WebDriver.ChromeDriver NuGet package 在 c# 中使用新版本的 chromedriver、chrome 和 selenium 时出现点击问题 - Having issues with click when using new version of chromedriver, chrome and selenium in c# selenium 视频录制的 Chrome 扩展 - Chrome extension for selenium video recording Selenium API 在 Chrome 浏览器中不工作 - Selenium API is not working in Chrome browser 错误:System.InvalidOperationException:会话未创建:Chrome 版本必须介于 70 和 73 之间,通过 Selenium 使用 ChromeDriver 和 Chrome - Error: System.InvalidOperationException: session not created: Chrome version must be between 70 and 73 using ChromeDriver and Chrome through Selenium 使用chromedriver 2.22,chrome 51和硒2.53时,地址栏中的“数据:” - 'data:,' in the address bar while using chromedriver 2.22 , chrome 51, and selenium 2.53 如何使用 Selenium 点击 C# 中的 Chrome 扩展? - How to Click The Chrome Extension in C# Using Selenium? 使用 google chrome 浏览器扩展打开带有参数的 .net 应用程序 - Open a .net app with parameters using google chrome browser extension 有没有机会使用C#在Selenium中隐藏chrome浏览器? - Is there any chance to hide the chrome browser in Selenium using C#?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM