1

Before I have used the code below, but it doesn't work anymore with firefox update.

from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
firefoxProfile = FirefoxProfile()
firefoxProfile.set_preference('permissions.default.image', 2)

I also tried this one below, it seems good but is there a way to disable images without add-on or 3rd party tools?

from selenium import webdriver
firefox_profile = webdriver.FirefoxProfile()
firefox_profile.add_extension(folder_xpi_file_saved_in + "\\quickjava-2.0.6-fx.xpi")
firefox_profile.set_preference("thatoneguydotnet.QuickJava.startupStatus.Images", 2)  ## Turns images off
hzleonardo
  • 463
  • 1
  • 7
  • 16

1 Answers1

1

Have you tried updating your selenium after the Firefox update?

eg :

sudo -H pip install --upgrade selenium
dmdip
  • 1,665
  • 14
  • 15
  • 1
    It is up to date. Actually this is the problem. Because the first code worked before, after firefox and selenium updates, it doesn't work anymore. – hzleonardo Apr 17 '16 at 07:53
  • Ah, okay. I mentioned this because the statement (which was working fine earlier) : driver = webdriver.Firefox() started giving me this error : WebDriverException: Message: Can't load the profile. Profile Dir: %s If you specified a log_file in the FirefoxBinary constructor, check it for details which got resolved after the selenium update. – dmdip Apr 17 '16 at 08:22