5

I noticed that starting Chrome 62, chrome disables Flash player by default.

I wrote a simple selenium test to visit : https://helpx.adobe.com/flash-player.html and noticed that it does not enable flash player by default. The same test works fine and flash player is enabled in Chrome 61.

Also, another noticeable difference is that I am using chromedriver v2.32 when running tests on Chrome 61 and chromedriver v2.33 when running tests on Chrome 62.

I've tried using the following solutions but none seems to work. I am using Java:

ChromeOptions options = new ChromeOptions(); 
options.setExperimentalOption("excludeSwitches", Arrays.asList("disable-component-update")); 
WebDriver driver= new ChromeDriver(options);

Tried using the flag:

--disable-bundled-ppapi-flash

None of them seem to work and flash player is always disabled no matter what flag I use.

  • I am stuck in the exact same predicament as you and I've tried numerous things, but nothing seems to be working. The worrying thing is that Google won't be fixing it either. – Bhurm Oct 31 '17 at 9:47
6

Correct Chrome blocks flash by default starting with Chrome 62 see https://support.google.com/chrome/a/answer/7084871?hl=en

This worked for me in Chrome 62, its a combination of answers already provided here.

    ChromeOptions options = new ChromeOptions();
    Map<String, Object> prefs = new HashMap<String, Object>();
    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);
    // Enable Flash for this site
    prefs.put("PluginsAllowedForUrls", "https://arlo.netgear.com");
    options.setExperimentalOption("prefs", prefs);  

Doc: https://www.chromium.org/administrators/policy-list-3#PluginsAllowedForUrls

  • Thank you. This solution worked for me on our Flash-heavy site – Gazen Ganados Dec 4 '17 at 9:42
2

A slightly tweaked solution to dimkin's has worked for me:

ChromeOptions options = new ChromeOptions();

// Disable extensions and hide infobars
options.addArguments("--disable-extensions");
options.addArguments("disable-infobars");

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

// Enable Flash
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);

// Hide save credentials prompt
prefs.put("credentials_enable_service", false);
prefs.put("profile.password_manager_enabled", false);
options.setExperimentalOption("prefs", prefs);

ChromeDriver driver = new ChromeDriver(options);
0

Depending on how you are running your tests: if you have access to the registry of the running machine, you should be able to edit one of these:

DefaultPluginsSetting - Can set flash to auto-run everywhere (not recommended for a machine that any human will actually use).

White-list the sites needed with PluginsAllowedForUrls (recommended if any humans use the machine).

Of course if you aren't using a machine you control (eg: a browserstack/sauce labs instances), this won't work.

0

you need extra stuff in capabilities

    Map<String, Object> chromeOptions = new HashMap<>();
    chromeOptions.put("args", getDefaultFlagList());

    Map<String, Object> prefs = new HashMap<>();
    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);
    chromeOptions.put("prefs", prefs);

    DesiredCapabilities capabilities = DesiredCapabilities.chrome();
    capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);

also you need extra flag "--allow-outdated-plugins" since 65th chrome

0

For those that come here trying to do this with the .NET version, there is no "setExperimentalOption" for ChromeOptions, you need to use "AddUserProfilePreference", the following code worked for me on Chrome 67:

 string binPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);

 binPath = binPath.Substring(6);//convert to local path by dropping "file://"

 ChromeOptions options = new ChromeOptions();

 options.AddUserProfilePreference("profile.default_content_setting_values.plugins", 1);
 options.AddUserProfilePreference("profile.content_settings.plugin_whitelist.adobe-flash-player", 1);
 options.AddUserProfilePreference("profile.content_settings.exceptions.plugins.*,*.per_resource.adobe-flash-player", 1);

 IWebDriver driver = new ChromeDriver(binPath,options);
0

It worked for me

ChromeOptions options = new ChromeOptions();
System.setProperty("webdriver.chrome.driver", "DriverPath");
Map<String, Object> prefs = new HashMap<String, Object>();
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);
// Enable Flash for this site
prefs.put("PluginsAllowedForUrls", "Put URL here");
options.setExperimentalOption("prefs", prefs); 
ChromeDriver driver = new ChromeDriver(options);
  • 1
    Hi Tasaduq! Can you say why this worked for you, or why it'd work for OP? – trashpanda Aug 1 '18 at 10:48
0
options.add_argument("--ppapi-flash-version=32.0.0.129")

options.add_argument("--ppapi-flash-path=/usr/lib/pepperflashplugin-
nonfree/libpepflashplayer.so")

Adding these arguments worked for me. Refer this URL for more details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.