允许通过chromedriver运行的Chrome 71中的Flash内容 [英] Allow Flash content in Chrome 71 running via chromedriver
问题描述
我一直在使用它来允许Chrome版本为chrome 69.
I've been using this to allow flash for chrome version 69.
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);
现在在chrome版本71中,此实验功能(EphemeralFlashPermission)已被删除.
Now on version 71 of chrome, this experimental feature (EphemeralFlashPermission) has been removed.
我也尝试使用这些设置,但效果不佳.
I've also tried to use these settings but it didn't work as well.
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);
现在是否还有其他方法可以使用chromedriver启用闪存?
Is there any other way now to enable flash using chromedriver?
推荐答案
我还没有找到任何选择,恐怕再也找不到了.
I haven't find any option yet, and I'm afraid won't find ever.
Windows的解决方法是使用组策略(通过向注册表添加条目):
The workaround for Windows is to use Group Policies (via adding entries to registry):
reg add HKLM\Software\Policies\Google\Chrome /v DefaultPluginsSetting /d 1 /t REG_DWORD /f
reg add HKLM\Software\Policies\Google\Chrome\PluginsAllowedForUrls /v 1 /d http://* /t REG_SZ /f
reg add HKLM\Software\Policies\Google\Chrome\PluginsAllowedForUrls /v 2 /d https://* /t REG_SZ /f
或只创建带有.reg扩展名的文件,然后在其中添加以下文本:
or just create file with .reg extension and put text below into it:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google]
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome]
"DefaultPluginsSetting"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome\PluginsAllowedForUrls]
"1"="http://*"
"2"="https://*"
然后保存并双击该文件.
then save and double-click this file.
这篇关于允许通过chromedriver运行的Chrome 71中的Flash内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!