我正在尝试获取一个特定的firefox配置文件,这是我事先创建的。然而,当我执行下面的代码时,我得到一个异常,告诉我这个概要文件不存在。
var profileManager = new FirefoxProfileManager();
var profile = profileManager.GetProfile("profile");
var options = new FirefoxOptions { Profile = profile };
profile.SetPreference("webdriver.firefox.profile", "profile");
var driver = new FirefoxDriver(@"C:\Users\danza\source\repos\InstaManager\", options);
发布于 2019-07-11 19:44:44
所以在调查了这个问题之后,我发现这主要是一个包版本问题。我使用的是Selenium.WebDriver alpha版本的nuget包。解决方案是降级到此nuget包的稳定版本。
发布于 2019-07-12 08:38:22
或者,您可以这样使用它
var options = new FirefoxOptions();
options.Profile = new FirefoxProfile("C:\Users\username\AppData\Roaming\Mozilla\Firefox\Profiles\profilename");
var webDriver = new FirefoxDriver(webdriverPath, options)
firefox配置文件存储在路径AppData\Roaming\Mozilla\Firefox\Profiles中
https://stackoverflow.com/questions/56994611
复制