If you are using BrowserStack SDK, you can set the following capabilities in the configuration 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 .
```yml
platforms:
- os: OS X
osVersion: Big Sur
browserName: Chrome
browserVersion: latest
chrome:
driver: 112.0.5615.28
chromeOptions:
args:
- --disable-plugins
```
Copy icon
Copy
```js
// wdio.conf.js
export const config = {
// ... (credentials, services, and commonCapabilities as defined previously)
capabilities: [
{
browserName: 'Chrome',
browserVersion: 'latest',
'bstack:options': {
os: 'OS X',
osVersion: 'Big Sur',
"chrome.driver": "112.0.5615.28" // Specific driver version
},
'goog:chromeOptions': {
args: ['--disable-plugins'] // Specific Chrome arguments
}
},
// ... other platforms
]
};
exports.config.capabilities.forEach(function (caps) {
for (let i in exports.config.commonCapabilities)
caps[i] = { ...caps[i], ...exports.config.commonCapabilities[i]};
});
// nightwatch.conf.js
const nightwatchConfigs = {
// ... (plugins and observability block)
test_settings: {
// ...
'browserstack.chrome_mac': {
...browserStackBase,
desiredCapabilities: {
browserName: 'Chrome',
browserVersion: 'latest',
'bstack:options': {
os: 'OS X',
osVersion: 'Big Sur',
"chrome.driver": '112.0.5615.28'
},
'goog:chromeOptions': {
args: ['--disable-plugins']
}
}
}
}
};
```
Copy icon
Copy
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 .
```yml
platforms:
- os: Windows
osVersion: 10
browserName: IE
browserVersion: 11.0
ie:
driver: 4.0.0
noFlash: true
```
Copy icon
Copy
```js
// wdio.conf.js
export const config = {
// ... (credentials, services, and commonCapabilities)
capabilities: [
{
browserName: 'IE',
browserVersion: '11.0',
'bstack:options': {
os: 'Windows',
osVersion: '10',
"ie.driver": "4.0.0", // Specific IE Driver version
"ie.noFlash": true // Disables Adobe Flash plugin in IE
}
},
// ... other platforms (Chrome, Safari, etc.)
]
};
exports.config.capabilities.forEach(function (caps) {
for (let i in exports.config.commonCapabilities)
caps[i] = { ...caps[i], ...exports.config.commonCapabilities[i]};
});
// nightwatch.conf.js
const nightwatchConfigs = {
// ... (plugins and observability block)
test_settings: {
// ... other settings
'browserstack.ie11': {
...browserStackBase,
desiredCapabilities: {
browserName: 'IE',
browserVersion: '11.0',
'bstack:options': {
os: 'Windows',
osVersion: '10',
"ie.driver": '4.0.0',
"ie.noFlash": true
}
}
}
}
};
```
Copy icon
Copy
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 )