Disable Flash

You can disable Flash in Chrome, Firefox and IE as follows:

Select a browser:

Disabling Flash in Chrome

To disable Flash in Chrome, create a chromeOptions capability, and pass the --disable-plugins argument.

Note: Using this argument will turn off all the plugins in the browser.

ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-plugins");
caps.setCapability(ChromeOptions.CAPABILITY, options);
var capabilities = {
  browserName: 'chrome',
  chromeOptions: {
    args: ['--disable-plugins'],
  },
};
using OpenQA.Selenium.Chrome;

DesiredCapabilities caps;
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.AddArgument("--disable-plugins");
caps = (DesiredCapabilities)chromeOptions.ToCapabilities();
$chromeOptions = array('args'=>array('--disable-plugins'));
$caps = array("platform"=>"WINDOWS", "browserName"=>"chrome", "chromeOptions"=>$chromeOptions);
caps = DesiredCapabilities.CHROME
caps["chromeOptions"] = {}
caps["chromeOptions"]["args"] = ["--disable-plugins"]
caps = Selenium::WebDriver::Remote::Capabilities.chrome
caps["chromeOptions"] = {}
caps["chromeOptions"]["args"] = ["--disable-plugins"]
$caps->{"chromeOptions"} = { "args" => ("--disable-plugins") };

Disabling Flash in Firefox

To disable Flash in Firefox, set the flash capability to 0.

FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("plugin.state.flash", 0);
caps.setCapability(FirefoxDriver.PROFILE, profile);
// Install firefox-profile package
npm install firefox-profile

var myProfile = new FirefoxProfile();
myProfile.setPreference("plugin.state.flash", 0);
myProfile.updatePreferences();
using OpenQA.Selenium.Firefox;

FirefoxProfile firefoxProfile = new FirefoxProfile();
DesiredCapabilities caps = DesiredCapabilities.Firefox();
firefoxProfile.SetPreference("plugin.state.flash", 0);
caps.SetCapability(FirefoxDriver.ProfileCapabilityName, firefoxProfile.ToBase64String());
$profile = new FirefoxProfile();

$profile->setPreference(
  'plugin.state.flash', 0
);

$caps = DesiredCapabilities::firefox();
$caps->setCapability(FirefoxDriver::PROFILE, $profile);
caps = DesiredCapabilities.FIREFOX
profile = webdriver.FirefoxProfile()
profile.set_preference('plugin.state.flash', 0)
profile.update_preferences()
driver = webdriver.Remote(
  command_executor='https://YOUR_USERNAME:YOUR_ACCESS_KEY@hub-cloud.browserstack.com/wd/hub',
  desired_capabilities=caps, browser_profile=profile)
profile = Selenium::WebDriver::Firefox::Profile.new
profile["plugin.state.flash"] = 0
caps = Selenium::WebDriver::Remote::Capabilities.firefox(:firefox_profile => profile)

Disabling Flash in Internet Explorer

To disable Flash in Internet explorer, pass the browserstack.ie.noFlash capability in your tests.

DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("browserstack.ie.noFlash", "true");
var capabilities = {
  'browserstack.ie.noFlash': 'true',
};
desiredCap.SetCapability("browserstack.ie.noFlash", "true");
$caps['browserstack.ie.noFlash'] = "true";
desired_cap["browserstack.ie.noFlash"] = "true"
caps["browserstack.ie.noFlash"] = "true"
$extraCaps->{"browserstack.ie.noFlash"} = "true";

We're sorry to hear that. Please share your feedback so we can do better






Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback