Skip to main content
Transform your testing process with: Real Device Features, Company-wide Licences, & Test Observability

Disable Flash

Learn how to disable flash for your Selenium tests on BrowserStack Automate.

You can disable flash for various browsers including Chrome, IE and Firefox. This guide provides code samples and solutions to disable flash when testing your application.

If you are using BrowserStack SDK, you can set the following capabilities in the browserstack.yml file:

Disable flash in Chrome

To disable flash in Chrome, pass the --disable-plugins argument under the chromeOptions capability.

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

Use the following sample code snippets to disable flash in Chrome.

browserstack.yml
Copy icon Copy snippet

Disable flash in IE

To disable flash in IE, pass the browserstack.ie.noFlash capability in your tests.
Use the following sample code snippets to disable flash in IE.

browserstack.yml
Copy icon Copy snippet

Disable flash in Firefox

To disable flash in Firefox, use the legacy integration method.

BrowserStack SDK is a plug-n-play solution that takes care of all the integration steps for you. Using the BrowserStack SDK is the recommended integration method for your project. To know more, visit the SDK core concepts page.

Disable flash in Chrome

DesiredCapabilities capabilities = new DesiredCapabilities();
HashMap<String, Object> browserstackOptions = new HashMap<String, Object>();
ChromeOptions options = new ChromeOptions();
browserstackOptions.addArguments("--disable-plugins");
capabilities.setCapability("bstack:options", browserstackOptions);
var capabilities = {
	'bstack:options' : {
	"chromeOptions" : {
    args: ['--disable-plugins'],
	},
	"browserName" : "Chrome",
  }
}
using OpenQA.Selenium.Chrome;

ChromeOptions capabilities = new ChromeOptions();
Dictionary<string, object> browserstackOptions = new Dictionary<string, object>();
browserstackOptions.AddArgument("--disable-plugins");
capabilities.AddAdditionalOption("bstack:options", browserstackOptions);
$chromeOptions = array(
    "args" => array('--disable-plugins')
);
$caps = array(
'bstack:options' => array(
    "os" => "Windows", 
    "chromeOptions" => $chromeOptions),
    "browserName" => "Chrome",
)
caps = {
    'bstack:options' : {
        "ChromeOptions" : {
            "args" : ["--disable-plugins"]
    }
    }
}
capabilities = {
	'bstack:options' => {
		"ChromeOptions" => {
         "args" => ["--disable-plugins"]
	},
  }
}
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"]

Disable flash in IE

To disable flash in IE, pass the browserstack.ie.noFlash capability in your tests.
Use the following sample code snippets to disable flash in IE.

DesiredCapabilities capabilities = new DesiredCapabilities();
HashMap<String, Object> browserstackOptions = new HashMap<String, Object>();
browserstackOptions.put("browserstack.ie.noFlash", "true");
capabilities.setCapability("bstack:options", browserstackOptions);
var capabilities = {
	'bstack:options' : {
		"browserstack.ie.noFlash" : "true",
	},
	"browserName" : "Edge",
}
EdgeOptions capabilities = new EdgeOptions();
Dictionary<string, object> browserstackOptions = new Dictionary<string, object>();
browserstackOptions.Add("browserstack.ie.noFlash", "true"));
capabilities.AddAdditionalOption("bstack:options", browserstackOptions);
$caps = array(
	'bstack:options' => array(
		"browserstack.ie.noFlash" => "true",
	),
	"browserName" => "Edge",
)
caps = {
	'bstack:options' : {
		"browserstack.ie.noFlash" : "true",
	},
	"browserName" : "Edge",
}
capabilities = {
	'bstack:options' => {
		"browserstack.ie.noFlash" => "true",
	},
	"browserName" => "Edge",
}
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"

Disable flash in Firefox

Set the flash capability to 0 to disable flash in Firefox.
Use the following sample code snippets to disable flash in Firefox.

import org.openqa.selenium.firefox.FirefoxProfile;

FirefoxProfile profile = new FirefoxProfile();
profile.setPreference("plugin.state.flash", 0);
DesiredCapabilities capabilities = new DesiredCapabilities();
HashMap<String, Object> browserstackOptions = new HashMap<String, Object>();
capabilities.setCapability("bstack:options", browserstackOptions);
capabilities.setCapability(FirefoxDriver.PROFILE, profile);
// Install firefox-profile package
npm install firefox-profile

const firefox = require('selenium-webdriver/firefox')
let profile = new firefox.Options();
profile.setPreference("plugin.state.flash", 0);
profile.updatePreferences();
using OpenQA.Selenium.Firefox;

FirefoxOptions capabilities = new FirefoxOptions();
Dictionary<string, object> browserstackOptions = new Dictionary<string, object>();
capabilities.SetPreference("plugin.state.flash", 0);
capabilities.AddAdditionalOption("bstack:options" browserstackOptions); 
$profile = new FirefoxProfile();

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

$caps = array(
    'bstack:options' => array(
         "firefoxProfile" => $profile),
)
from selenium import webdriver
from selenium.webdriver.firefox.options import Options as FirefoxOptions

options = FirefoxOptions()
options.set_preference('plugin.state.flash', 0)
driver = webdriver.Remote(
    command_executor='https://hub.browserstack.com/wd/hub',
    options=options)
require 'rubygems'
require 'selenium-webdriver'

options = Selenium::WebDriver::Firefox::Options.new
options.add_preference('plugin.state.flash', 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)

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

Is this page helping you?

Yes
No

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!

Talk to an Expert
Download Copy