简体   繁体   English

Selenium无法在firefox驱动程序中加载特定的已创建配置文件

[英]Selenium cannot load specific created profile in firefox driver

I am trying to get a specific firefox profile which I created beforehand. 我正在尝试获取我事先创建的特定的Firefox配置文件。 However when i execute the below code i get an exception saying that the profile doesn't exist. 但是,当我执行以下代码时,我得到一个异常,说明该配置文件不存在。

在此处输入图片说明

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);

在此处输入图片说明

So after investigating this problem, I found out that it was mainly a package version issue. 因此,在调查了此问题之后,我发现这主要是软件包版本问题。 I was using Selenium.WebDriver alpha version nuget package. 我正在使用Selenium.WebDriver alpha版本的nuget包。 The solution was to downgrade to a stable version of this nuget package. 解决的办法是降级到该nuget软件包的稳定版本。

Alternatively you can use it so 另外,您也可以使用它

var options = new FirefoxOptions();
options.Profile = new FirefoxProfile("C:\Users\username\AppData\Roaming\Mozilla\Firefox\Profiles\profilename");
var webDriver = new FirefoxDriver(webdriverPath, options)

The firefox profiles are stored in the path AppData\\Roaming\\Mozilla\\Firefox\\Profiles Firefox配置文件存储在路径AppData \\ Roaming \\ Mozilla \\ Firefox \\ Profiles中

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM