How to enable Adobe Flash in FireFox Selenium webdriver with FirefoxProfile

I need an automated way to enable Flash in Firefox Selenium web browser without user interaction.

I tried:

FirefoxProfile profile = new FirefoxProfile();
//As 0 is to disable, I used 1. I don"t know what to use.
profile.setPreference("plugin.state.flash", 1);
WebDriver driver = new FirefoxDriver(profile);

      

But it still requires me to click "Allow".

This shows up all the time, even with the above code

+3


source to share


2 answers


I found a solution myself.

This post shows how to disable Adobe Flash Player in Python

And to enable it in "JAVA" just change false to true.



profile.setPreference("dom.ipc.plugins.enabled.libflashplayer.so","true");

      

And it works :)

+1


source


This didn't work for me: profile.setPreference("dom.ipc.plugins.enabled.libflashplayer.so","true");

Instead, I used: profile.setPreference("plugin.state.flash", 2);



I am assuming "2" will activate the plugin as well.

+2


source







All Articles