mozilla / geckodriver

WebDriver for Firefox
https://firefox-source-docs.mozilla.org/testing/geckodriver/
Mozilla Public License 2.0
7.14k stars 1.52k forks source link

Default logs from geckodriver + Firefox are chatty #1046

Open nirhp opened 6 years ago

nirhp commented 6 years ago

System

Testcase

  1. Under Jenkins job, create selenium firefox instance with 'firefoxOptions.Profile = new FirefoxProfile()'. for example, the bellow C# code:

            var firefoxService = FirefoxDriverService.CreateDefaultService();
            var firefoxOptions = new FirefoxOptions() { Profile = new FirefoxProfile() };

            firefoxOptions.BrowserExecutableLocation = @"C:\Program Files (x86)\Mozilla Firefox\firefox.exe";

            using (var webDriver = new FirefoxDriver(firefoxService, firefoxOptions, TimeSpan.FromMinutes(1)))
            {
                webDriver.Navigate().GoToUrl("http://www.google.com");
            }

Expected behavior

Job output console will not contain Selenium / Firefox / Geckodriver logs.

Actual behavior

The Jenkins job console output contains a lot of logging output (jobOutput.txt attached bellow). jobOutput.txt

andreastt commented 6 years ago

What you see in this log file is the expected output with the default configuration. We have some ideas on how to make it less chatty which you can read more about in https://bugzilla.mozilla.org/show_bug.cgi?id=1399441.

nirhp commented 6 years ago

Is there a way to turn off this expected output?

andreastt commented 6 years ago

Yes, by redirecting the stdout and stderr to a /dev/null.

nirhp commented 6 years ago

For the browser? I tried

var firefoxOptions = new FirefoxOptions() { }; firefoxOptions.AddArgument("> NUL");

but it does not work.

andreastt commented 6 years ago

Not sure what language that is, but I don’t think shell commands, or redirections, is supported through arguments.

Tomm254 commented 6 years ago

turn off driver logs for JAVA: ffProfile.setPreference("webdriver.log.driver", "OFF"); System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE, "/dev/null");

nirhp commented 6 years ago

@Tomm254 , It didn't work for me:

firefoxOptions.Profile.SetPreference("webdriver.log.driver", "OFF");
Environment.SetEnvironmentVariable("webdriver.firefox.logfile", "/dev/null");
nirhp commented 6 years ago

@andreastt I'm using C#. I there a way to pass redirection for the browser through Selenium?

andreastt commented 6 years ago

@nirhp Alas I don’t know any of the Selenium bindings well.

andreastt commented 6 years ago

I have submitted https://bugzilla.mozilla.org/show_bug.cgi?id=1384956 to patch the debug-logs-always-on problem.

AutomatedTester commented 6 years ago

raised Selenium bug https://github.com/SeleniumHQ/selenium/issues/5129 as this is really their issue for just letting it flow through.

andreastt commented 6 years ago

FWIW I don‘t think this will be so much of an issue once https://bugzilla.mozilla.org/show_bug.cgi?id=1399441 is fixed. I would propose holding off https://github.com/SeleniumHQ/selenium/issues/5129.

AutomatedTester commented 6 years ago

The selenium bug is orthogonal. If a new driver comes online then the bindings should do a better job of managing output from drivers

whimboo commented 6 years ago

@nirhp, given the attached log as port of your first comment on this issue the extension logging is enabled. Do you know where the preference extensions.logging.enabled is getting set to true? This should not be the case for default profiles as created by geckodriver. So maybe your webdriver client is automatically enabling those?