首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Selenium无法在firefox驱动程序中加载特定创建的配置文件

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

Stack Overflow用户
提问于 2019-07-12 01:34:40
回答 2查看 341关注 0票数 1

我正在尝试获取一个特定的firefox配置文件,这是我事先创建的。然而,当我执行下面的代码时,我得到一个异常,告诉我这个概要文件不存在。

代码语言:javascript
运行
复制
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);

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2019-07-12 03:44:44

所以在调查了这个问题之后,我发现这主要是一个包版本问题。我使用的是Selenium.WebDriver alpha版本的nuget包。解决方案是降级到此nuget包的稳定版本。

票数 0
EN

Stack Overflow用户

发布于 2019-07-12 16:38:22

或者,您可以这样使用它

代码语言:javascript
运行
复制
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中

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56994611

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档