Skip to content

[🚀 Feature]: [Ruby] Ability to read all Firefox config preferences as json #13124

@MatzFan

Description

@MatzFan

Feature and motivation

I can set user preferences via the Profile object, but unless I am misreading the docs the API does not seem to provide a way to read the Firefox preferences from an initialized driver. These are stored in prefs.json together with a user.json, if it exists, and are available on the about:config page if you click on the 'Show All' button.

It seems strange to have the ability to set prefs, as below, without the ability to get their values - especially in a use-case where code may dynamically alter prefs and you need to know how one is set at any point in time.

profile = Selenium::WebDriver::Firefox::Profile.new
profile['browser.download.dir'] = "/tmp/webdriver-downloads"
options = Selenium::WebDriver::Firefox::Options.new(profile: profile)
driver = Selenium::WebDriver.for :firefox, options: options

profile['browser.download.dir'] # => undefined method `[]' for #<Selenium::WebDriver::Firefox::Profile:0x00007f5838737c50

Usage example

For example, in Ruby you would get a preference just like setting it:

profile['browser.download.dir']

And/or have a method which returns all the preferences, something like:

profile.prefs # => hash of all prefs and their values

These could either be read from the two json files on disk or by parsing the html table on the about:config page. The latter option would need to be done in a new (background) session as it would require navigating to that page.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-needs-triagingA Selenium member will evaluate this soon!G-geckodriverRequires fixes in GeckoDriverI-enhancementSomething could be better

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions