Reputation: 31
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);
Upvotes: 1
Views: 4222
Reputation: 8902
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.
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);
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);
Upvotes: 0
Reputation: 922
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);
Upvotes: 4