1

Used the following code for Chrome...But the flash is not disabled for Chrome.. Even I require the code for IE as well

ChromeOptions options = new ChromeOptions();
Map<String, Object> prefs = new HashMap<String, Object>();
prefs.put("profile.default_content_settings.state.flash",0);
//profile.default_content_settings.popups
options.setExperimentalOption("prefs", prefs);  
System.setProperty("webdriver.chrome.driver",System.getProperty("user.dir")+"\\chromedriver.exe");
driver = new ChromeDriver(options);
Raj
  • 31
  • 1
  • 7
  • Are you trying to disable Adobe's flash plugin or Chrome's bundled flash? – Fred Porciúncula Aug 07 '15 at 14:47
  • Adobe Flash Player..Also I require the code for the IE..That would be helpful – Raj Aug 07 '15 at 14:49
  • You could either [disable external plugins](http://stackoverflow.com/questions/27210708/disabling-flash-in-chrome), thus disabling Adobe Flash Player, or you could [disable specifically Adobe's plugin](http://stackoverflow.com/questions/17113477/disable-flash-in-saucelabs-selenium-webdriver). I don't know about IE, though. – Fred Porciúncula Aug 07 '15 at 15:37
  • Thanks...Could U provide the code for Chrome... – Raj Aug 07 '15 at 16:06

2 Answers2

4

This is how i got it to work for Chrome:

ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-bundled-ppapi-flash");
WebDriver webDriver = new org.openqa.selenium.chrome.ChromeDriver(options);
Wolf
  • 892
  • 2
  • 8
  • 22
  • This will disable Chrome's bundled flash, not Adobe's flash plugin. – Fred Porciúncula Aug 17 '15 at 00:07
  • I don't really get the difference. Isn't the embedded plugin provided by Adobe? (see: https://www.adobe.com/software/flash/about/) However, when I use the argument, no Flash Plugin appears in the about:plugins section anymore and Flash doesn't work for me anymore. – Wolf Aug 23 '15 at 13:18
  • The embedded plugin is provided by Adobe, but you can still have their regular plugin installed on top of that. Check the second question on this link: https://helpx.adobe.com/flash-player/kb/flash-player-google-chrome.html – Fred Porciúncula Aug 23 '15 at 13:29
0

I believe you have two options when working with Chrome. I don't know about IE, though. Your only option might be to manually configure it.

Disabling external plugins

Based on Disabling flash in Chrome. This will disable any external plugin, including Adobe Flash Player.

ChromeOptions options = new ChromeOptions();
options.AddArguments("--disable-plugins-discovery");
WebDriver driver = new ChromeDriver(options);

Disabling Adobe Flash Player plugin

Based on Disable flash in saucelabs/selenium webdriver?. This should disable only Adobe's plugin.

Map<String, Object> prefs = new HashMap<>();
prefs.put("plugins.plugins_disabled", "Adobe Flash Player");
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("prefs", prefs);  
WebDriver driver = new ChromeDriver(options);
Community
  • 1
  • 1
Fred Porciúncula
  • 8,533
  • 3
  • 40
  • 57