[英]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. 该扩展名存在于我期望的路径中。
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.