我正在尝试使用 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);
https://stackoverflow.com/questions/54164547/
相关文章:
android - Cordova 插件文件路径 : Unable to resolve files
android - 获取/返回由 Android Room 数据库生成的自动生成的 ID(作为主键)
angular - NRWL 中的多个应用程序可以访问定义文件的位置
apache-spark - 我的 SparkSession 初始化需要很长时间才能在我的笔记本电脑
aws-lambda - AWS Lambda Go : The VM errors out in
flutter - 为什么 build() 在后台的屏幕上被多次调用?