To set a Firefox about:config entry programmatically using Selenium without modifying the file system profile or web-scraping about:config, you can use Firefox's preferences (also known as "prefs") system. Selenium allows you to set preferences directly when launching the browser via FirefoxOptions.
about:config Entry via SeleniumFirefoxOptions to set preferences before launching the browser.about:config key to its corresponding preference name (e.g., browser.startup.homepage for the homepage).pythonfrom selenium import webdriver from selenium.webdriver.firefox.options import Options # Create Firefox options options = Options() # Set the preference (replace 'pref_name' and 'pref_value' with your target) options.set_preference("pref_name", "pref_value") # Example: Disable Firefox's default "new tab" page options.set_preference("browser.newtabpage.enabled", False) # Example: Set a custom homepage options.set_preference("browser.startup.homepage", "https://example.com") # Launch Firefox with the options driver = webdriver.Firefox(options=options) # Continue with your Selenium script driver.get("https://example.com")
about:config are the same as those used in set_preference. For example:
browser.startup.homepage → Homepage URLnetwork.proxy.type → Proxy type (0 = direct, 1 = manual, etc.)privacy.trackingprotection.enabled → Tracking protectionTrue/False for booleans, 1 for integers, "value" for strings).about:config.about:config in Firefox.set_preference.about:config entries can be set this way (e.g., some are read-only or require browser restarts).Vibe can make mistakes. Check answers. Learn more