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);
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);
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.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With