Selenium Firefox 无法添加扩展

Dav*_*her 5 c# selenium

我正在尝试使用 Selenium 将最新版本的 AdBlock 添加到最新版本的 Firefox。浏览器加载正常,没有例外,但 AdBlock 没有正确安装,当我检查浏览器中的扩展时,它不存在。

public static FirefoxDriver CreateFirefoxDriver(string driverPath, string binaryPath)
{
    var profile = new FirefoxProfile();
    profile.AddExtension(@"C:\Users\david\source\repos\TestingApp\TestingApp\bin\Debug\selenium\browsers\firefox\extensions\adblock_plus-3.3.1-an+fx.xpi");
    profile.SetPreference("permissions.default.image", 2);
    var options = new FirefoxOptions();
    options.Profile = profile;
    var service = FirefoxDriverService.CreateDefaultService(driverPath);
    service.FirefoxBinaryPath = binaryPath;
    var driver = new FirefoxDriver(service, options);
    return driver;
}
Run Code Online (Sandbox Code Playgroud)

当我使用相同的 xpi 文件手动添加扩展时,它工作正常。

Selenium Nuget 版本 3.14.0(最新)

geckodriver 0.23.0 win64(最新)

Firefox 62.0.3 64 位(最新)

AdBlock 3.3.1(最新)

更新:

尝试了最新版本的 uBlock xpi 文件,也没有出现在我的扩展中,无一例外地帮助我诊断出了什么问题。可以轻松地手动添加相同的扩展。

我尝试使用 Firefox 61 和 60,仍然有同样的问题。

Dav*_*her 3

我终于能够解决这个问题了。我不断尝试旧版本的 Firefox,最终 58.0.2 成功了。我似乎无法在 geckodriver 的 github 页面上找到兼容版本的列表。