Do not want images to load and CSS to render on Firefox


SUBMITTED BY: Guest

DATE: Nov. 13, 2013, 9:24 p.m.

FORMAT: Text only

SIZE: 755 Bytes

HITS: 1186

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

comments powered by Disqus