Skip to content

[🐛 Bug]: If LoggingPrefs is set, the profile gets lost [Java, Firefox] #10222

@moossenm

Description

@moossenm

What happened?

Hi,
i think i found a bug in the latest 4.1.1 Java Version:

I have following piece of code working with v3.x:

FirefoxOptions options = new FirefoxOptions();
FirefoxProfile profile = new FirefoxProfile();
String downloadDir = "/path/to/my/dir/";
profile.setPreference("browser.download.dir", downloadDir);
options.addPreference("browser.download.dir", downloadDir);
options.setLogLevel(FirefoxDriverLogLevel.TRACE);
LoggingPreferences logs = new LoggingPreferences();
Level level = Level.ALL;
logs.enable(LogType.DRIVER, level);
logs.enable(LogType.CLIENT, level);
logs.enable(LogType.BROWSER, level);
logs.enable(LogType.SERVER, level);
logs.enable(LogType.PERFORMANCE, level);
logs.enable(LogType.PROFILER, level);
options.setCapability(CapabilityType.LOGGING_PREFS, logs);
options.setProfile(profile);
new FirefoxDriver(options);

as said, this works with v3.x, but in v4.x the profile is not transferred to firefox, the configuration entry browser.download.dir remains unset.
and if i remove the line

options.setCapability(CapabilityType.LOGGING_PREFS,  logs);

then it works fine again.

how can it be that this breaks the profile?
am i doing something wrong here?

i see also the same behaviour using a grid.

many thanks
Michael

How can we reproduce the issue?

FirefoxOptions options = new FirefoxOptions();
FirefoxProfile profile = new FirefoxProfile();
String downloadDir = "/path/to/my/dir/";
profile.setPreference("browser.download.dir", downloadDir);
options.addPreference("browser.download.dir", downloadDir);
options.setLogLevel(FirefoxDriverLogLevel.TRACE);
LoggingPreferences logs = new LoggingPreferences();
Level level = Level.ALL;
logs.enable(LogType.DRIVER, level);
logs.enable(LogType.CLIENT, level);
logs.enable(LogType.BROWSER, level);
logs.enable(LogType.SERVER, level);
logs.enable(LogType.PERFORMANCE, level);
logs.enable(LogType.PROFILER, level);
options.setCapability(CapabilityType.LOGGING_PREFS, logs);
options.setProfile(profile);
new FirefoxDriver(options);

Relevant log output

1641376474543	geckodriver	INFO	Listening on 127.0.0.1:51609
1641376480277	mozrunner::runner	INFO	Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "--marionette" "-no-remote" "-profile" "C:\\Users\\moossenm\\AppData\\Local\\Temp\\rust_mozprofileJd5B9U"
1641376480749	Marionette	INFO	Marionette enabled
console.warn: SearchSettings: "get: No settings file exists, new profile?" (new NotFoundError("Could not open the file at C:\\Users\\moossenm\\AppData\\Local\\Temp\\rust_mozprofileJd5B9U\\search.json.mozlz4", (void 0)))
1641376483121	Marionette	INFO	Listening on port 50851
1641376483410	RemoteAgent	WARN	TLS certificate errors will be ignored for this session

Operating System

Windows 10, RedHat7

Selenium version

Java 4.1.1

What are the browser(s) and version(s) where you see this issue?

Firefox 95.0.2

What are the browser driver(s) and version(s) where you see this issue?

GeckoDriver 0.30.0

Are you using Selenium Grid?

4.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-javaJava BindingsD-firefoxI-defectSomething is not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions