允许通过chromedriver运行的Chrome 69中的Flash内容

有谁知道如何在Chrome 69中启用Flash插件。我将chromedriver 2.41与Javaselenium绑定一起使用。我尝试过

prefs.put("profile.default_content_setting_values.plugins", 1);

prefs.put("profile.content_settings.plugin_whitelist.adobe-flash-player", 1);

prefs.put("profile.content_settings.exceptions.plugins.*,*.per_resource.adobe-flash-player", 1);

但没有运气。我还尝试将chrome配置文件首选项与特定网站的不允许/允许的Flash进行比较,然后尝试使用:

            Map<String, Object> site = new HashMap<>();

Map<String, Object> values = new HashMap<>();

Map<String, Object> setting = new HashMap<>();

setting.put("flashPreviouslyChanged", true);

values.put("last_modified", "13180613213099316");

values.put("setting", setting);

site.put("http://my.site,*", values);

prefs.put("profile.content_settings.exceptions.flash_data", site);

但效果不佳。

我也尝试使用通过指定的配置文件运行

options.addArguments("user-data-dir=" + profileDir);

但由于此白名单设置在Chrome 69中变为“临时”,因此它也将不起作用。

有什么方法可以在支持Flash的Chrome中运行自动化?

回答:

谢谢大家的回答。

我终于找到了解决方案。为了从Chrome 69开始以编程方式启用闪光灯,我们必须做两件事:

  1. 禁用临时Flash权限(以启用Flash网站允许的列表)和
  2. 将所有站点添加到该列表。

请参阅以下有关Java的代码:

ChromeOptions options = new ChromeOptions();

// disable ephemeral flash permissions flag

options.addArguments("--disable-features=EnableEphemeralFlashPermission");

Map<String, Object> prefs = new HashMap<>();

// Enable flash for all sites for Chrome 69

prefs.put("profile.content_settings.exceptions.plugins.*,*.setting", 1);

options.setExperimentalOption("prefs", prefs);

nestedDriver = new ChromeDriver(options);

以上是 允许通过chromedriver运行的Chrome 69中的Flash内容 的全部内容, 来源链接: utcz.com/qa/412431.html

回到顶部