我正在尝试使用 Selenium 在 Firefox 上安装 ublock。问题是,扩展不会加载。浏览器加载正常,但不添加扩展。
FirefoxProfile profile = new FirefoxProfile();
profile.AddExtension("ublock_origin-1.17.4-an+fx.xpi");
FirefoxOptions options = new FirefoxOptions
{
Profile = profile
};
IWebDriver driver = new FirefoxDriver(options);
我看过 this但我不想使用旧版本的 firefox,而且我还没有看到任何其他修复方法。
当前使用 v0.23.0 的 geckodriver for win64。
如何使用 selenium 为 firefox 添加扩展? (不使用旧版本)
最佳答案
尝试拆分选项部分,看看是否有所不同:
FirefoxProfile profile = new FirefoxProfile();
profile.AddExtension(*file path*);
FirefoxOptions options = new FirefoxOptions();
options.Profile = profile;
IWebDriver driver = new FirefoxDriver(options);
关于c# - Selenium Firefox 不添加扩展,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54164547/