所有
当我尝试使用扩展程序启动Chrome时,Chrome会崩溃
我试着这个案子:
var userProfile = Environment.GetEnvironmentVariable("userprofile");
if (string.IsNullOrEmpty(userProfile))
{
throw new Exception("Can't get user profile folder path.");
}
var userHome = Path.Combine(userProfile, @"AppData\Local\Google
\Chrome\User Data");
var options = new ChromeOptions();
options.AddArguments("--user-data-dir=" + userHome);
options.AddExtensions(Extensions);
var capabilities = new DesiredCapabilities();
capabilities.SetCapability(ChromeOptions.Capability, options);
Driver = new ChromeDriver(options);
就这样:
var options = new ChromeOptions();
options.AddExtensions(Extensions);
Driver = new ChromeDriver(options);
而且:
var options = new ChromeOptions();
options.AddExtension(@"C:\Program Files\My Company\My product\ChromeExt\my_plugin.crx");
Driver = new ChromeDriver(options);
结果是: Chrome crush。
在ChromeDriver窗口中:
Starting ChromeDriver (v2.7.236900) on port 1679
[5812:10296:1206/125819:ERROR:gpu_info_collector_win.cc(102)] Can't retrieve a v
alid WinSAT assessment.
[1206/125823:ERROR:gl_surface_egl.cc(131)] eglInitialize failed with error UNKNOWN
版本:
chromedriver.exe - v2.7.236900
WebDriver.dll - 2.37.0.0
Chrome - 31.0.1650.63 m