Sometimes you'll see a dialog in Firefox that it has prevented Flash or other plugin from running for a website:
Firefox has prevented the outdated plugin "Adobe Flash" from running on (website name)
The way to dismiss this dialog is to disable automatic blocking of Flash (or other plugin) by setting the extensions.blocklist.enabled
property to false in the browser profile, and it will never pop up in the first place!
This script contains an example of setting this extension so that the test can access the site watch.spectrum.net.
DesiredCapabilities capabilities = new DesiredCapabilities();
// set desired capabilities to launch appropriate browser on Sauce
capabilities.setCapability(CapabilityType.BROWSER_NAME, "firefox");
capabilities.setCapability(CapabilityType.VERSION, "latest");
capabilities.setCapability(CapabilityType.PLATFORM, "Windows 7");
capabilities.setCapability("name", "sample test name");
FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.setPreference("extensions.blocklist.enabled", false);
capabilities.setCapability(FirefoxDriver.PROFILE, firefoxProfile);
// Launch remote browser and set it as the current thread
WebDriver driver = new RemoteWebDriver(
new URL("https://" + authentication.getUsername() + ":" + authentication.getAccessKey() + seleniumURI +"/wd/hub"),
capabilities);
driver.get("https://watch.spectrum.net/");
// Sleep for ten seconds to make sure flash dialog is not present
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
// flash notification dialog should not be present
driver.quit();