Search code examples
firefoxnunitseleniumfirefox-3

How do I disable images and Flash from loading when using Selenium with Firefox?


When running selenium tests through Selenium RC in Firefox 3, the instance of Firefox that launches to run the tests in always displays images even though I've setup Firefox 3 to not display images.

Do anyone know how to disable the images from loading?

I'd also like to disable flash from loading on the test pages as well.


Solution

  • When you launch selenium RC from the command line, you can provide the command line arguement of -firefoxProfileTemplate , where dir is the location of the Firefox profile you wish to use. Example:

    java -jar selenium-server.jar -firefoxProfileTemplate "C:\Documents and Settings\YOUR_USERNAME\Application Data\Mozilla\Firefox\Profiles\gj4zmzhp.default"

    You can then configure the Firefox profile your using anyway you see fit. To disable flash, you can go to the tools->Add-ons in Firefox and then in the Plugins tab, disable the Shockwave Flash plugin.