kyrenia kyrenia - 2 months ago 12
Python Question

Can't turn off images in Selenium / Firefox

I am looking to disable images in Firefox when using Selenium. It should be a simple update of the preferences in firefox, which is documented on the instructions on Disable images in Selenium Python

However when i run, images display, and when i enter about:config, the value for

is still 1, rather than 2 which i have tried setting it to.

My code (written in Python) is:

from selenium import webdriver
firefox_profile = webdriver.FirefoxProfile()
firefox_profile.set_preference("permissions.default.image", 2)
driver = webdriver.Firefox(firefox_profile)

For reference, this code works perfect with another change to preference e.g. turning off csv files with the line
. The only difference i can tell between the csv setting and the image one, is that the line
already exists in about:config (i.e. without me setting it), however the line
does not. ... it seems that i can add new lines in with the value i want, but not change an existing one (or it is beein over-ridden by Selenium after i enter my value).


From what I understand, this problem is related to the following Firefox issues:

That means that permissions.default.image is frozen, cannot be changed and does nothing.