geckodriver icon indicating copy to clipboard operation
geckodriver copied to clipboard

How to set verbosity of MarionetteDriver?

Open ghost opened this issue 10 years ago • 26 comments

Dear Geckodriver team,

I have lately made some efforts to include the new MarionetteDriver into our testing framework to support Firefox version > 47.

Unfortunately I noticed, that MarionetteDriver by default writes many, many entries into the logs, which makes it hard to read, if we run a high number of tests.

Is there any way to change the verbosity of MarionetteDriver?

I already tried to set marionette.logging preference like ffprofile.setPreference("marionette.logging", false); but nothing changed!

Any hints are hightly appreciated.

Best regards mgavilan

ghost avatar Jul 27 '16 10:07 ghost

We corrected the default log level in the latest release (v0.9.0). What log levels are you experiencing with that version?

You can control the log level of Gecko through the -v[v] or --log flags.

See --help for more information.

andreastt avatar Jul 27 '16 11:07 andreastt

Hi adreastt,

thanks for your feedback.

Actually I'm using already geckdriver (wires.exe) v0.9.0. Still I see lots of DEBUG and INFO message on MarionetteDriver startup.

If I get you correct, I should be able to modify the verbosity by using -v or --log flags for the geckodriver.

In fact I'm not starting the geckodriver by myself, but MarionetteDriver is taking over that step. Do I need to add some settings to the capabilities of MarionetteDriver, in order to start the geckodriver using those flags?

Thanks and regards mgavilan

ghost avatar Jul 27 '16 12:07 ghost

The default logging level should be INFO when run against official/optimised Firefox builds, and DEBUG when run against debug builds since https://github.com/mozilla/geckodriver/commit/468f32b9999d946b783ec94ac28bfeab2e15d4ee.

I don’t quite know what the “MarionetteDriver” you speak of is.

andreastt avatar Jul 27 '16 13:07 andreastt

Hi andreastt,

regarding your last comment, I'm referring to the following topic: https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver

Marionette WebDriver is the new way to execute UI tests with Selenium for Firefox > 47. This WebDriver makes use of the new geckodriver.

I have attached an example, which you should be able to rerun from your end to reproduce the described issue. I have found out, that the verbosity of Logging is as you described, if I just instantiate pure MarionetteDriver instance, like e.g.

  • WebDriver driver = new MarionetteDriver()

In our case, we want to reuse the local default Firefox profile (see attachment), which we pass as capability to the MarionetteDriver, like e.g.

  • WebDriver driver = new MarionetteDriver(capability)

In the last case, the logging becomes very verbose, also showing DEBUG entries!

Any idea, how to switch back to INFO only, when using capabilities?

Thanks and regards mgavilan Example_to_reproduce.txt

ghost avatar Jul 27 '16 16:07 ghost

And what does the profile look like? Is it setting the marionette.logging preference to anything?

andreastt avatar Jul 27 '16 16:07 andreastt

Hi andreastt,

in both cases (by passing capabilities or not) the config properties related to marionette.* are the same and do not contain marionette.logging! (see attachment) Still, if I don't give any specific capability, the verbosity is ok, only displaying INFO messages.

What is the link of marionette.logging to verbosity, if it is also ok without this property?

Thanks and regards mgavilan marionette_config_properties

ghost avatar Jul 28 '16 13:07 ghost

geckodriver 0.9.0 is distributed as geckodriver.exe on Windows, not wires.exe. I suspect you’re still using an old version.

andreastt avatar Aug 01 '16 12:08 andreastt

Dear andreastt,

actually the geckodriver executable has been renamed to wires.exe, following the documentation from MDN .

As you can see fom the following screenshot, the wires.exe is using geckodriver v0.9.0!geckodriver_version_0 9 0_named_as wires exe

Any further idea, why passing capabilities to MarionetteDriver is that much verbose?

Thanks and regards Marcos

ghost avatar Aug 01 '16 13:08 ghost

Is myProfile.setPreference('marionette.logging', 'TRACE'); supposed to work?

It seems confusing that the geckodriver executable accepts args but it is Selenium that starts it? So then who and how do we pass arguments to the geckodriver executable via Selenium?

vladikoff avatar Aug 11 '16 15:08 vladikoff

@vladikoff geckodriver overrides the marionette.logging preference when it starts if you give it one of the -v, -vv, or --log LEVEL flags, so it might not working if you are using either of those. The default is INFO level logging for release builds and DEBUG for non-optimised builds of Firefox.

I don’t really understand your point that it is confusing for a program to have command-line flags for different modes of operation. This is perfectly commonplace. How Selenium decides to interface with geckodriver is up to them. The current implementation where you cannot pass arguments or argument the logging level in the Selenium Java bindings strike me as very odd, but there is nothing in geckodriver preventing better integration. This is a matter of writing a Java patch. I encourage you to do so if you have the time.

andreastt avatar Aug 12 '16 13:08 andreastt

Thanks for the response @andreastt ! So my main source of confusion was this: https://github.com/mozilla/geckodriver/issues/177

I had no clue how I'm supposed to set verbosity when I'm passing the executable via setPreference('webdriver.gecko.driver' but then that pref does not exist at all. I had a false assumption that Selenium 'starts' the geckodriver executable and it well went down from there. Sorry for annoying comments.

vladikoff avatar Aug 12 '16 13:08 vladikoff

@vladikoff Your comments are not annoying (-:

Selenium does indeed control and start the geckodriver process. It seems like a missing feature if it is not possible to control the logging output from geckodriver from the Java/Python/Ruby/whatever interfaces.

andreastt avatar Aug 19 '16 15:08 andreastt

Let's add a capability for that.

jgraham avatar Aug 19 '16 15:08 jgraham

Is there any new capability added for logging to reduce?? I have downloaded latest webdriver but still the issue exists

1476705128991   geckodriver INFO    Listening on 127.0.0.1:9167
lokakuuta 17, 2016 5:22:09 IP. org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
1476705129635   mozprofile::profile INFO    Using profile path C:\Users\bern\AppData\Local\Temp\rust_mozprofile.WLQIm32pAXMW
1476705129665   geckodriver::marionette INFO    Starting browser C:\Program Files (x86)\Mozilla Firefox\firefox.exe
1476705129692   geckodriver::marionette INFO    Connecting to Marionette on localhost:50913
1476705130065   addons.manager  DEBUG   Application has been upgraded
1476705130118   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/addons/XPIProvider.jsm: ["XPIProvider"]
1476705130121   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/LightweightThemeManager.jsm: ["LightweightThemeManager"]
1476705130126   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/addons/GMPProvider.jsm
1476705130128   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/addons/PluginProvider.jsm
1476705130129   addons.manager  DEBUG   Starting provider: XPIProvider
1476705130129   addons.xpi  DEBUG   startup
1476705130130   addons.xpi  INFO    SystemAddonInstallLocation directory is missing
1476705130132   addons.xpi  INFO    Mapping [email protected] to C:\Program Files (x86)\Mozilla Firefox\browser\features\[email protected]
1476705130132   addons.xpi  INFO    Mapping [email protected] to C:\Program Files (x86)\Mozilla Firefox\browser\features\[email protected]
1476705130133   addons.xpi  INFO    Mapping [email protected] to C:\Program Files (x86)\Mozilla Firefox\browser\features\[email protected]
1476705130134   addons.xpi  INFO    Mapping {972ce4c6-7e08-4474-a285-3208198ce6fd} to C:\Program Files (x86)\Mozilla Firefox\browser\extensions\{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi
1476705130135   addons.xpi  DEBUG   checkForChanges
1476705130135   addons.xpi  DEBUG   Loaded add-on state from prefs: {}
1476705130137   addons.xpi  DEBUG   New add-on [email protected] in app-system-defaults
1476705130137   addons.xpi  DEBUG   getModTime: Recursive scan of [email protected]
1476705130138   addons.xpi  DEBUG   New add-on [email protected] in app-system-defaults
1476705130139   addons.xpi  DEBUG   getModTime: Recursive scan of [email protected]
1476705130139   addons.xpi  DEBUG   New add-on [email protected] in app-system-defaults
1476705130140   addons.xpi  DEBUG   getModTime: Recursive scan of [email protected]
1476705130141   addons.xpi  DEBUG   New add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} in app-global
1476705130141   addons.xpi  DEBUG   getModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}
1476705130142   addons.xpi  DEBUG   getInstallState changed: true, state: {"app-system-defaults":{"[email protected]":{"d":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\features\\[email protected]","st":1474578384000},"[email protected]":{"d":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\features\\[email protected]","st":1474578384000},"[email protected]":{"d":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\features\\[email protected]","st":1474578384000}},"app-global":{"{972ce4c6-7e08-4474-a285-3208198ce6fd}":{"d":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\extensions\\{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi","st":1474578384000}}}
1476705130152   addons.xpi-utils    DEBUG   Opening XPI database C:\Users\SAIKIR~1.NAT\AppData\Local\Temp\rust_mozprofile.WLQIm32pAXMW\extensions.json
1476705130154   addons.xpi-utils    DEBUG   New add-on [email protected] installed in app-system-defaults
*** Blocklist::_loadBlocklistFromFile: blocklist is disabled
1476705130168   DeferredSave.extensions.json    DEBUG   Save changes
1476705130169   addons.xpi-utils    DEBUG   New add-on [email protected] installed in app-system-defaults
1476705130177   DeferredSave.extensions.json    DEBUG   Starting timer
1476705130179   DeferredSave.extensions.json    DEBUG   Save changes
1476705130179   addons.xpi-utils    DEBUG   New add-on [email protected] installed in app-system-defaults
1476705130186   DeferredSave.extensions.json    DEBUG   Save changes
1476705130187   addons.xpi-utils    DEBUG   New add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} installed in app-global
1476705130192   DeferredSave.extensions.json    DEBUG   Save changes
1476705130200   addons.xpi  DEBUG   Loading bootstrap scope from C:\Program Files (x86)\Mozilla Firefox\browser\features\[email protected]
1476705130217   addons.xpi  DEBUG   Calling bootstrap method install on [email protected] version 1.2
1476705130218   addons.xpi-utils    DEBUG   Make addon app-system-defaults:[email protected] visible
1476705130218   DeferredSave.extensions.json    DEBUG   Save changes
1476705130219   addons.xpi  DEBUG   Loading bootstrap scope from C:\Program Files (x86)\Mozilla Firefox\browser\features\[email protected]
1476705130224   addons.xpi  DEBUG   Calling bootstrap method install on [email protected] version 1.0.4
1476705130224   addons.xpi-utils    DEBUG   Make addon app-system-defaults:[email protected] visible
1476705130225   DeferredSave.extensions.json    DEBUG   Save changes
1476705130226   addons.xpi  DEBUG   Loading bootstrap scope from C:\Program Files (x86)\Mozilla Firefox\browser\features\[email protected]
1476705130229   addons.xpi  DEBUG   Calling bootstrap method install on [email protected] version 1.0
1476705130229   addons.xpi-utils    DEBUG   Make addon app-system-defaults:[email protected] visible
1476705130230   DeferredSave.extensions.json    DEBUG   Save changes
1476705130230   addons.xpi-utils    DEBUG   Make addon app-global:{972ce4c6-7e08-4474-a285-3208198ce6fd} visible
1476705130230   DeferredSave.extensions.json    DEBUG   Save changes
1476705130231   addons.xpi  DEBUG   Updating XPIState for {"id":"[email protected]","syncGUID":"qzTRQ3KM3llX","location":"app-system-defaults","version":"1.2","type":"extension","internalName":null,"updateURL":null,"updateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null,"icons":{},"iconURL":null,"icon64URL":null,"defaultLocale":{"name":"Multi-process staged rollout","description":"Staged rollout of Firefox multi-process feature.","creator":null,"homepageURL":null},"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descriptor":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\features\\[email protected]","installDate":1474578384000,"updateDate":1474578384000,"applyBackgroundUpdates":1,"bootstrap":true,"skinnable":false,"size":5716,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":false,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"49.0.1","maxVersion":"49.*"}],"targetPlatforms":[],"multiprocessCompatible":false,"seen":true}
1476705130231   addons.xpi  DEBUG   getModTime: Recursive scan of [email protected]
1476705130233   addons.xpi  DEBUG   Updating XPIState for {"id":"[email protected]","syncGUID":"BdSOt42dWGsD","location":"app-system-defaults","version":"1.0.4","type":"extension","internalName":null,"updateURL":null,"updateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null,"icons":{},"iconURL":null,"icon64URL":null,"defaultLocale":{"name":"Pocket","description":"When you find something you want to view later, put it in Pocket.","creator":null,"homepageURL":null},"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descriptor":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\features\\[email protected]","installDate":1474578384000,"updateDate":1474578384000,"applyBackgroundUpdates":1,"bootstrap":true,"skinnable":false,"size":895234,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":false,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"49.0.1","maxVersion":"49.*"}],"targetPlatforms":[],"multiprocessCompatible":false,"seen":true}
1476705130234   addons.xpi  DEBUG   getModTime: Recursive scan of [email protected]
1476705130236   addons.xpi  DEBUG   Updating XPIState for {"id":"[email protected]","syncGUID":"nwxvJaKG4KYU","location":"app-system-defaults","version":"1.0","type":"extension","internalName":null,"updateURL":null,"updateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null,"icons":{},"iconURL":null,"icon64URL":null,"defaultLocale":{"name":"Web Compat","description":"Urgent post-release fixes for web compatibility.","creator":null,"homepageURL":null},"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descriptor":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\features\\[email protected]","installDate":1474578384000,"updateDate":1474578384000,"applyBackgroundUpdates":1,"bootstrap":true,"skinnable":false,"size":1502,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":false,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"49.0.1","maxVersion":"49.*"}],"targetPlatforms":[],"multiprocessCompatible":false,"seen":true}
1476705130236   addons.xpi  DEBUG   getModTime: Recursive scan of [email protected]
1476705130237   addons.xpi  DEBUG   Updating XPIState for {"id":"{972ce4c6-7e08-4474-a285-3208198ce6fd}","syncGUID":"p48aVA_mhA4Z","location":"app-global","version":"49.0.1","type":"theme","internalName":"classic/1.0","updateURL":null,"updateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null,"icons":{"32":"icon.png","48":"icon.png"},"iconURL":null,"icon64URL":null,"defaultLocale":{"name":"Default","description":"The default theme.","creator":"Mozilla","homepageURL":null,"contributors":["Mozilla Contributors"]},"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descriptor":"C:\\Program Files (x86)\\Mozilla Firefox\\browser\\extensions\\{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi","installDate":1474578384000,"updateDate":1474578384000,"applyBackgroundUpdates":1,"skinnable":true,"size":21905,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":true,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"49.0.1","maxVersion":"49.0.1"}],"targetPlatforms":[],"seen":true}
1476705130237   addons.xpi  DEBUG   getModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}
1476705130239   DeferredSave.extensions.json    DEBUG   Save changes
1476705130239   addons.xpi  DEBUG   Updating database with changes to installed add-ons
1476705130239   addons.xpi-utils    DEBUG   Updating add-on states
1476705130240   addons.xpi-utils    DEBUG   Writing add-ons list
1476705130247   addons.xpi  DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\[email protected]
1476705130248   addons.xpi  DEBUG   Calling bootstrap method startup on [email protected] version 1.2
1476705130249   addons.xpi  DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\[email protected]
1476705130250   addons.xpi  DEBUG   Calling bootstrap method startup on [email protected] version 1.0.4
1476705130251   addons.xpi  DEBUG   Registering manifest for C:\Program Files (x86)\Mozilla Firefox\browser\features\[email protected]
1476705130251   addons.xpi  DEBUG   Calling bootstrap method startup on [email protected] version 1.0
1476705130254   addons.manager  DEBUG   Registering shutdown blocker for XPIProvider
1476705130254   addons.manager  DEBUG   Provider finished startup: XPIProvider
1476705130254   addons.manager  DEBUG   Starting provider: LightweightThemeManager
1476705130254   addons.manager  DEBUG   Registering shutdown blocker for LightweightThemeManager
1476705130255   addons.manager  DEBUG   Provider finished startup: LightweightThemeManager
1476705130255   addons.manager  DEBUG   Starting provider: GMPProvider
1476705130266   addons.manager  DEBUG   Registering shutdown blocker for GMPProvider
1476705130266   addons.manager  DEBUG   Provider finished startup: GMPProvider
1476705130266   addons.manager  DEBUG   Starting provider: PluginProvider
1476705130266   addons.manager  DEBUG   Registering shutdown blocker for PluginProvider
1476705130267   addons.manager  DEBUG   Provider finished startup: PluginProvider
1476705130268   addons.manager  DEBUG   Completed startup sequence
1476705130584   Marionette  INFO    Listening on port 50913
1476705130886   addons.manager  DEBUG   Starting provider: <unnamed-provider>
1476705130886   addons.manager  DEBUG   Registering shutdown blocker for <unnamed-provider>
1476705130886   addons.manager  DEBUG   Provider finished startup: <unnamed-provider>
1476705130918   addons.manager  DEBUG   Starting provider: PreviousExperimentProvider
1476705130918   addons.manager  DEBUG   Registering shutdown blocker for PreviousExperimentProvider
1476705130918   addons.manager  DEBUG   Provider finished startup: PreviousExperimentProvider
1476705130921   DeferredSave.extensions.json    DEBUG   Starting write
1476705131168   DeferredSave.extensions.json    DEBUG   Write succeeded
1476705131168   addons.xpi-utils    DEBUG   XPI Database saved, setting schema version preference to 17
1476705131876   Marionette  INFO    startBrowser 136c6c6d-c493-4599-8aab-b0d48368e98f
lokakuuta 17, 2016 5:22:12 IP. org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
Firefox.49.0
49.0
49
1476705191888   addons.productaddons    INFO    sending request to: https://aus5.mozilla.org/update/3/GMP/49.0.1/20160922113459/WINNT_x86-msvc-x64/en-US/release/Windows_NT%206.1.1.0%20(x64)/default/default/update.xml
JavaScript error: chrome://marionette/content/proxy.js, line 187: NS_ERROR_ILLEGAL_VALUE: Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIMessageSender.sendAsyncMessage]
1476705193487   addons.productaddons    INFO    Completed downloading document
1476705195161   addons.productaddons    INFO    downloadXHR File download. status=200
1476705195166   addons.productaddons    INFO    Downloaded file will be saved to C:\Users\SAIKIR~1.NAT\AppData\Local\Temp\tmpaddon
1476705197696   addons.productaddons    INFO    downloadXHR File download. status=200
1476705197699   addons.productaddons    INFO    Downloaded file will be saved to C:\Users\SAIKIR~1.NAT\AppData\Local\Temp\tmpaddon
1476705201428   addons.productaddons    INFO    downloadXHR File download. status=200
1476705201434   addons.productaddons    INFO    Downloaded file will be saved to C:\Users\SAIKIR~1.NAT\AppData\Local\Temp\tmpaddon
 - FAILED.
[Child 7812] ###!!! ABORT: Aborting on channel error.: file c:/builds/moz2_slave/m-rel-w32-00000000000000000000/build/src/ipc/glue/MessageChannel.cpp, line 2052
lokakuuta 17, 2016 5:24:08 IP. org.openqa.selenium.os.UnixProcess destroy

saikiran40cs avatar Oct 17 '16 11:10 saikiran40cs

We have now added {moz:firefoxOptions: {log: {level: <level name>}}}, so considering this fixed.

andreastt avatar Oct 17 '16 12:10 andreastt

Hello, Sorry to re-open this thread, but I can apply this to my java code (selenium 3.0.1) I tried this:

        FirefoxOptions options = new FirefoxOptions();
        options.addPreference("log", "{level: info}");
        desiredCapabilities.setCapability("moz:firefoxOptions", options);

Selenium throws an exception if optionsis not instanceof FirefoxOptions, and options.addPreference accepts String, integer or boolean as second parameter, not dictionnary. So how to set properly Log option ?

Thank you for your help,

asvdw avatar Oct 24 '16 10:10 asvdw

@asvdw That sounds like a Selenium bug. Please report there accordingly.

andreastt avatar Oct 24 '16 12:10 andreastt

After several hours trying to get these messages eliminated, I get a "solution": I can quit these messages redirecting the stdout and stderr to /dev/null. I have defined a new shell acrit that call to the real driver: geck file (in /home/user/GRAILS/tst/ma path) : /home/user/GRAILS/tst/ma/geckodriver --log fatal $* &> /dev/null geckodriver is in the same path.

Then I call my script: System.setProperty('webdriver.gecko.driver', '/home/user/GRAILS/tst/ma/geck') The bad (and good) notice is that ALL the messages are eliminated

jsturnio avatar Dec 11 '16 02:12 jsturnio

Does not work for me with selenium 3.1.0 which made it possible to set the LogLevel.

tholu avatar Feb 22 '17 17:02 tholu

@tholu Then that sounds like a bug in Selenium, doesn’t it?

andreastt avatar Feb 22 '17 17:02 andreastt