selenium icon indicating copy to clipboard operation
selenium copied to clipboard

Unable to set geckodriver log level

Open asvdw opened this issue 10 years ago • 8 comments

Meta

Selenium 3.0.1 - Java Firefox 49.0.2 - geckodriver 11.0.1

Issue

I'd like to set log level for geckodriver, which is DEBUG by default. Mozilla says we have to set {moz:firefoxOptions: {log: {level: <level name>}}} but I can't get it working in java.

I tried this:

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

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

Thank your for your help,

Linked Issue @Mozilla: https://github.com/mozilla/geckodriver/issues/152

asvdw avatar Oct 25 '16 07:10 asvdw

will be available in the next release, you'll be able to do:

options.setLogLevel(Level.INFO)

lukeis avatar Oct 25 '16 16:10 lukeis

Tried with 3.1.0, does not fix https://github.com/mozilla/geckodriver/issues/152 for me. Geckodriver is still very verbose. Trying the workaround at the end of the linked issue now.

tholu avatar Feb 22 '17 17:02 tholu

i realy struggle with the log level. Coming from selenium1(2) im totaly new to Geckodriver.

My Code so far:

geckodriver = "/opt/geckodriver" capabilities = DesiredCapabilities.FIREFOX capabilities["marionette"] = True

browser = webdriver.Firefox(capabilities=capabilities, executable_path=geckodriver)

i tryed alot - but how can i set the Option for the Loggin in selenium3 + gecko + python ? i need it more verbose ... its only on info

sorry for the, mayb dumb question

Frankstar avatar Feb 23 '17 14:02 Frankstar

As @tholu said, i still see this issue. Getting lot of verbose on the console, even after setting log level to Off or Error. Can someone provide me how to get rid of this verbose.

Following is my environment: OS: Windows 7 64-bit Selenium: 3.1.0 Firefox: 51.0.1 geckodriver: 0.14.0

Following is the code which i tried.

		FirefoxOptions ffOptions=new FirefoxOptions();
		ffOptions.setLogLevel(Level.OFF);
//		ffOptions.addPreference("log", "{level: error}");

		System.setProperty("webdriver.gecko.driver", "D:/Cigniti/Softwares/geckodriver.exe");
		
		DesiredCapabilities capabilities = DesiredCapabilities.firefox();
		capabilities.setCapability("moz:firefoxOptions", ffOptions);
 
		WebDriver driver = new FirefoxDriver(capabilities);
                driver.get("http://www.google.com")

Following is the trace displayed in console:

1488519749246	geckodriver	INFO	Listening on 127.0.0.1:13279
1488519750043	mozprofile::profile	INFO	Using profile path C:\Users\E002841\AppData\Local\Temp\rust_mozprofile.IyBPuyoZtbjT
1488519753843	addons.manager	DEBUG	Application has been upgraded
1488519754097	addons.manager	DEBUG	Loaded provider scope for resource://gre/modules/addons/XPIProvider.jsm: ["XPIProvider"]
1488519754102	addons.manager	DEBUG	Loaded provider scope for resource://gre/modules/LightweightThemeManager.jsm: ["LightweightThemeManager"]
1488519754109	addons.manager	DEBUG	Loaded provider scope for resource://gre/modules/addons/GMPProvider.jsm
1488519754111	addons.manager	DEBUG	Loaded provider scope for resource://gre/modules/addons/PluginProvider.jsm
1488519754112	addons.manager	DEBUG	Starting provider: XPIProvider
1488519754112	addons.xpi	DEBUG	startup
1488519754113	addons.xpi	INFO	SystemAddonInstallLocation directory is missing
1488519754115	addons.xpi	INFO	Mapping [email protected] to C:\Program Files\Mozilla Firefox\browser\features\[email protected]
1488519754115	addons.xpi	INFO	Mapping [email protected] to C:\Program Files\Mozilla Firefox\browser\features\[email protected]
1488519754116	addons.xpi	INFO	Mapping [email protected] to C:\Program Files\Mozilla Firefox\browser\features\[email protected]
1488519754116	addons.xpi	INFO	Mapping [email protected] to C:\Program Files\Mozilla Firefox\browser\features\[email protected]
1488519754117	addons.xpi	INFO	Mapping {972ce4c6-7e08-4474-a285-3208198ce6fd} to C:\Program Files\Mozilla Firefox\browser\extensions\{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi
1488519754118	addons.xpi	DEBUG	checkForChanges
1488519754118	addons.xpi	DEBUG	Loaded add-on state from prefs: {}
1488519754120	addons.xpi	DEBUG	New add-on [email protected] in app-system-defaults
1488519754120	addons.xpi	DEBUG	getModTime: Recursive scan of [email protected]
1488519754121	addons.xpi	DEBUG	New add-on [email protected] in app-system-defaults
1488519754121	addons.xpi	DEBUG	getModTime: Recursive scan of [email protected]
1488519754128	addons.xpi	DEBUG	New add-on [email protected] in app-system-defaults
1488519754128	addons.xpi	DEBUG	getModTime: Recursive scan of [email protected]
1488519754129	addons.xpi	DEBUG	New add-on [email protected] in app-system-defaults
1488519754129	addons.xpi	DEBUG	getModTime: Recursive scan of [email protected]
1488519754130	addons.xpi	DEBUG	New add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} in app-global
1488519754131	addons.xpi	DEBUG	getModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}
1488519754131	addons.xpi	DEBUG	getInstallState changed: true, state: {"app-system-defaults":{"[email protected]":{"d":"C:\\Program Files\\Mozilla Firefox\\browser\\features\\[email protected]","st":1488433768577},"[email protected]":{"d":"C:\\Program Files\\Mozilla Firefox\\browser\\features\\[email protected]","st":1488433768573},"[email protected]":{"d":"C:\\Program Files\\Mozilla Firefox\\browser\\features\\[email protected]","st":1488433768568},"[email protected]":{"d":"C:\\Program Files\\Mozilla Firefox\\browser\\features\\[email protected]","st":1488433768500}},"app-global":{"{972ce4c6-7e08-4474-a285-3208198ce6fd}":{"d":"C:\\Program Files\\Mozilla Firefox\\browser\\extensions\\{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi","st":1488433768581}}}
1488519754143	addons.xpi-utils	DEBUG	Opening XPI database C:\Users\E002841\AppData\Local\Temp\rust_mozprofile.IyBPuyoZtbjT\extensions.json
1488519754145	addons.xpi-utils	DEBUG	New add-on [email protected] installed in app-system-defaults
*** Blocklist::_loadBlocklistFromFile: blocklist is disabled
1488519754161	DeferredSave.extensions.json	DEBUG	Save changes
1488519754162	addons.xpi-utils	DEBUG	New add-on [email protected] installed in app-system-defaults
1488519754166	DeferredSave.extensions.json	DEBUG	Starting timer
1488519754168	DeferredSave.extensions.json	DEBUG	Save changes
1488519754168	addons.xpi-utils	DEBUG	New add-on [email protected] installed in app-system-defaults
1488519754176	DeferredSave.extensions.json	DEBUG	Save changes
1488519754176	addons.xpi-utils	DEBUG	New add-on [email protected] installed in app-system-defaults
1488519754183	DeferredSave.extensions.json	DEBUG	Save changes
1488519754184	addons.xpi-utils	DEBUG	New add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} installed in app-global
1488519754190	DeferredSave.extensions.json	DEBUG	Save changes
1488519754190	addons.manager	DEBUG	Registering startup change 'installed' for [email protected]
1488519754199	addons.xpi	DEBUG	Loading bootstrap scope from C:\Program Files\Mozilla Firefox\browser\features\[email protected]
1488519754208	addons.xpi	DEBUG	Calling bootstrap method install on [email protected] version 1.0
1488519754208	addons.xpi-utils	DEBUG	Make addon app-system-defaults:[email protected] visible
1488519754209	DeferredSave.extensions.json	DEBUG	Save changes
1488519754210	addons.manager	DEBUG	Registering startup change 'installed' for [email protected]
1488519754211	addons.xpi	DEBUG	Loading bootstrap scope from C:\Program Files\Mozilla Firefox\browser\features\[email protected]
1488519754219	addons.xpi	DEBUG	Calling bootstrap method install on [email protected] version 1.7
1488519754222	addons.xpi-utils	DEBUG	Make addon app-system-defaults:[email protected] visible
1488519754223	DeferredSave.extensions.json	DEBUG	Save changes
1488519754224	addons.manager	DEBUG	Registering startup change 'installed' for [email protected]
1488519754226	addons.xpi	DEBUG	Loading bootstrap scope from C:\Program Files\Mozilla Firefox\browser\features\[email protected]
1488519754236	addons.xpi	DEBUG	Calling bootstrap method install on [email protected] version 1.0.5
1488519754236	addons.xpi-utils	DEBUG	Make addon app-system-defaults:[email protected] visible
1488519754236	DeferredSave.extensions.json	DEBUG	Save changes
1488519754236	addons.manager	DEBUG	Registering startup change 'installed' for [email protected]
1488519754238	addons.xpi	DEBUG	Loading bootstrap scope from C:\Program Files\Mozilla Firefox\browser\features\[email protected]
1488519754241	addons.xpi	DEBUG	Calling bootstrap method install on [email protected] version 1.0
1488519754241	addons.xpi-utils	DEBUG	Make addon app-system-defaults:[email protected] visible
1488519754242	DeferredSave.extensions.json	DEBUG	Save changes
1488519754242	addons.xpi-utils	DEBUG	Make addon app-global:{972ce4c6-7e08-4474-a285-3208198ce6fd} visible
1488519754242	DeferredSave.extensions.json	DEBUG	Save changes
1488519754243	addons.xpi	DEBUG	Updating XPIState for {"id":"[email protected]","syncGUID":"{dd747c41-51fb-405d-b8ca-d9b9b8ea3bb2}","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":"Application Update Service Helper","description":"Sets value(s) in the update url based on custom checks.","creator":null,"homepageURL":null},"visible":true,"active":true,"userDisabled":false,"appDisabled":false,"descriptor":"C:\\Program Files\\Mozilla Firefox\\browser\\features\\[email protected]","installDate":1488433768577,"updateDate":1488433768577,"applyBackgroundUpdates":1,"bootstrap":true,"skinnable":false,"size":5975,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":false,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"51.0.1","maxVersion":"51.*"}],"targetPlatforms":[],"multiprocessCompatible":true,"seen":true,"dependencies":[],"hasEmbeddedWebExtension":false,"mpcOptedOut":false}
1488519754243	addons.xpi	DEBUG	getModTime: Recursive scan of [email protected]
1488519754244	addons.xpi	DEBUG	Updating XPIState for {"id":"[email protected]","syncGUID":"{99e84c13-b214-48d1-ade0-96c906297ca1}","location":"app-system-defaults","version":"1.7","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\\Mozilla Firefox\\browser\\features\\[email protected]","installDate":1488433768573,"updateDate":1488433768573,"applyBackgroundUpdates":1,"bootstrap":true,"skinnable":false,"size":6997,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":false,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"51.0.1","maxVersion":"51.*"}],"targetPlatforms":[],"multiprocessCompatible":true,"seen":true,"dependencies":[],"hasEmbeddedWebExtension":false,"mpcOptedOut":false}
1488519754244	addons.xpi	DEBUG	getModTime: Recursive scan of [email protected]
1488519754245	addons.xpi	DEBUG	Updating XPIState for {"id":"[email protected]","syncGUID":"{fb82cec8-5666-4991-9603-6b5b54668170}","location":"app-system-defaults","version":"1.0.5","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\\Mozilla Firefox\\browser\\features\\[email protected]","installDate":1488433768568,"updateDate":1488433768568,"applyBackgroundUpdates":1,"bootstrap":true,"skinnable":false,"size":921011,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":false,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"51.0.1","maxVersion":"51.*"}],"targetPlatforms":[],"multiprocessCompatible":true,"seen":true,"dependencies":[],"hasEmbeddedWebExtension":false,"mpcOptedOut":false}
1488519754245	addons.xpi	DEBUG	getModTime: Recursive scan of [email protected]
1488519754245	addons.xpi	DEBUG	Updating XPIState for {"id":"[email protected]","syncGUID":"{96dc9539-3173-4787-b909-094c07af1dbe}","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\\Mozilla Firefox\\browser\\features\\[email protected]","installDate":1488433768500,"updateDate":1488433768500,"applyBackgroundUpdates":1,"bootstrap":true,"skinnable":false,"size":1570,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":false,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"51.0.1","maxVersion":"51.*"}],"targetPlatforms":[],"multiprocessCompatible":true,"seen":true,"dependencies":[],"hasEmbeddedWebExtension":false,"mpcOptedOut":false}
1488519754245	addons.xpi	DEBUG	getModTime: Recursive scan of [email protected]
1488519754246	addons.xpi	DEBUG	Updating XPIState for {"id":"{972ce4c6-7e08-4474-a285-3208198ce6fd}","syncGUID":"{d7cf7e9e-acbe-4675-81b5-631e7031cd09}","location":"app-global","version":"51.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\\Mozilla Firefox\\browser\\extensions\\{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi","installDate":1488433768581,"updateDate":1488433768581,"applyBackgroundUpdates":1,"skinnable":true,"size":19708,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":false,"hasBinaryComponents":false,"strictCompatibility":true,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"51.0.1","maxVersion":"51.0.1"}],"targetPlatforms":[],"seen":true,"dependencies":[],"hasEmbeddedWebExtension":false}
1488519754246	addons.xpi	DEBUG	getModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}
1488519754248	DeferredSave.extensions.json	DEBUG	Save changes
1488519754248	addons.xpi	DEBUG	Updating database with changes to installed add-ons
1488519754248	addons.xpi-utils	DEBUG	Updating add-on states
1488519754254	addons.xpi-utils	DEBUG	Writing add-ons list
1488519754262	addons.xpi	DEBUG	Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\[email protected]
1488519754263	addons.xpi	DEBUG	Calling bootstrap method startup on [email protected] version 1.0
1488519754264	addons.xpi	DEBUG	Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\[email protected]
1488519754265	addons.xpi	DEBUG	Calling bootstrap method startup on [email protected] version 1.7
1488519754266	addons.xpi	DEBUG	Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\[email protected]
1488519754267	addons.xpi	DEBUG	Calling bootstrap method startup on [email protected] version 1.0.5
1488519754269	addons.xpi	DEBUG	Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\[email protected]
1488519754269	addons.xpi	DEBUG	Calling bootstrap method startup on [email protected] version 1.0
1488519754272	addons.manager	DEBUG	Registering shutdown blocker for XPIProvider
1488519754272	addons.manager	DEBUG	Provider finished startup: XPIProvider
1488519754272	addons.manager	DEBUG	Starting provider: LightweightThemeManager
1488519754272	addons.manager	DEBUG	Registering shutdown blocker for LightweightThemeManager
1488519754272	addons.manager	DEBUG	Provider finished startup: LightweightThemeManager
1488519754273	addons.manager	DEBUG	Starting provider: GMPProvider
1488519754282	addons.manager	DEBUG	Registering shutdown blocker for GMPProvider
1488519754282	addons.manager	DEBUG	Provider finished startup: GMPProvider
1488519754283	addons.manager	DEBUG	Starting provider: PluginProvider
1488519754283	addons.manager	DEBUG	Registering shutdown blocker for PluginProvider
1488519754283	addons.manager	DEBUG	Provider finished startup: PluginProvider
1488519754284	addons.manager	DEBUG	Completed startup sequence

udayanem avatar Mar 03 '17 05:03 udayanem

@udayanem see my comment here https://github.com/SeleniumHQ/selenium/issues/3550#issuecomment-282930718

lmtierney avatar Mar 03 '17 13:03 lmtierney

One option that has worked for some is proposed here, and uses a batch file to pass in command line arguments to the executable. Unfortunately, this oftentimes leaves extra processes open (geckodriver.exe, cmd.exe) and no solution to this next problem has been proposed as of yet...

ice1080 avatar Jul 03 '17 19:07 ice1080

So, the issue is not resolved yet? There's no possibility to set the log level for GeckoDriver and Firefox from Selenium? Only using directly the CLI argument works? No other way? If so, why is this issue closed? Or is there any opened issue regarding this?

vmuzikar avatar Aug 01 '17 13:08 vmuzikar

Hi,

I've been trying to get a Trace log using C# and think this is the way to do it:

       var options = new FirefoxOptions();
        options.LogLevel = FirefoxDriverLogLevel.Trace;
        //options.SetLoggingPreference("Driver", LogLevel.Debug);

        //Guess Capabilities is no longer needed?
        var caps = DesiredCapabilities.Firefox();
        caps.SetCapability("moz:firefoxOptions", options);
        

        driver = new FirefoxDriver(options);

But am getting zilch in my Debug window. I don't know if this is related to this issue or not....

EDIT: Am able to see the logging via a TeamCity "Build Log" and it always defaults to DEBUG. Changing the above options does not make a difference

realfaisalk avatar Aug 10 '17 14:08 realfaisalk