为 Firefox (Geckodriver) 设置自定义配置文件目录
Set custom profile directory for Firefox (Geckodriver)
我有一些配置文件想在 Firefox 中使用。
我已尝试为配置文件设置自定义文件夹,但 Firefox 无法加载配置文件。
我现在的代码:
FirefoxOptions options = new FirefoxOptions();
options.AddArguments(@"user-data-dir=C:\SomeFolder\firefox" + @"\" + profilename + @"\");
IWebDriver driver = new FirefoxDriver(options);
您需要在选项 class 上设置配置文件 属性,例如
options.Profile = new FirefoxProfile("PATH_TO_PROFILE");
遗憾的是,许多人 运行 对此似乎存在一个问题。幸运的是,有一个绝妙的答案可以让这个真正起作用,下面是 link。我建议按照答案加载您的自定义配置文件。
我有一些配置文件想在 Firefox 中使用。 我已尝试为配置文件设置自定义文件夹,但 Firefox 无法加载配置文件。 我现在的代码:
FirefoxOptions options = new FirefoxOptions();
options.AddArguments(@"user-data-dir=C:\SomeFolder\firefox" + @"\" + profilename + @"\");
IWebDriver driver = new FirefoxDriver(options);
您需要在选项 class 上设置配置文件 属性,例如
options.Profile = new FirefoxProfile("PATH_TO_PROFILE");
遗憾的是,许多人 运行 对此似乎存在一个问题。幸运的是,有一个绝妙的答案可以让这个真正起作用,下面是 link。我建议按照答案加载您的自定义配置文件。