from selenium.webdriver.firefox.firefox_profile import FirefoxProfile def diableImages(self): ## get the firefox profile object fireFoxProfile = FirefoxProfile() ## Disable images ## Disable CSS ff_profile.set_preference('permissions.default.stylesheet', 2) fireFoxProfile.set_preference('permissions.default.image', 2) ## Disable flash fireFoxProfile.set_preference('dom.ipc.plugins.enabled.libflashplayer.so', 'false') ## Set the modified profile while creating the browser object self.browserHandle = webdriver.Firefox(fireFoxProfile)