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

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

问题描述

有人知道如何在Chrome 69中启用Flash插件. 我将chromedriver 2.41与Java硒绑定一起使用. 我已经尝试过

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开始以编程方式启用闪光灯,我们必须做两件事:

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

  1. 禁用临时Flash权限(以启用允许的列表 Flash网站)和
  2. 将所有网站添加到该列表中.
  1. Disable Ephemeral Flash Permissions (to enable list of allowed for Flash sites) and
  2. Add all sites to that list.

在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天全站免登陆