【发布时间】:2021-11-02 18:54:27
【问题描述】:
我正在尝试在 selenium 中为 geckdriver 使用扩展,发现我需要使用 FirefoxProfile。不过,从这里开始,我不知道该怎么做。我在网上找不到太多帮助。这是我所拥有的,但我收到 System.TypeInitializationException 错误。
FirefoxOptions options = new FirefoxOptions();
FirefoxProfile profile = new FirefoxProfile();
string workingDirectory1 = Environment.CurrentDirectory;
profile.AddExtension(workingDirectory1 + "\\anticaptcha.xpi");
options.Profile = profile;
IWebDriver driver = new FirefoxDriver(options);
driver.Navigate().GoToUrl("https://www.google.com/");
【问题讨论】: