允许通过 chromedriver 运行 Chrome 69 中的 Flash 内容 [英] Allow Flash content in Chrome 69 running via chromedriver

查看:26
本文介绍了允许通过 chromedriver 运行 Chrome 69 中的 Flash 内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道如何在 Chrome 69 中启用 Flash 插件.我使用带有 java selenium 绑定的 chromedriver 2.41.我试过了

Does anybody know how to enable Flash plugin in Chrome 69. I use chromedriver 2.41 with java selenium bindings. I've tried with

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 进行比较,然后尝试:

but with no luck. I've also tried to compare chrome profile preferences with disallowed/allowed flash for particular site and then tried with:

            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);

但它也不会起作用.

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

I've also tried to run with profile specified via

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

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

but since this white list setting becomes 'ephemeral' in Chrome 69 it also won't work.

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

Is there any method to run my automation in Chrome with flash support?

推荐答案

感谢大家的解答.

我终于找到了解决办法.为了从 Chrome 69 开始以编程方式启用 Flash,我们必须做两件事:

I finally have found the solution. In order to enable flash progrmatically since Chrome 69 we have to do 2 things:

  1. 禁用 Ephemeral Flash 权限(启用允许的列表Flash 网站)和
  2. 将所有网站添加到该列表中.

请参阅以下 Java 代码:

See the following code on 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 内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆