Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to turn off the Marionette/gecko driver logs in selenium 3

I need to turn off the Marionette/GeckoDriver logging; is there is any way to do that? I've been searching a lot, but I am not getting the proper answer. The INFO logs were:

 1484653905833  geckodriver INFO    Listening on 127.0.0.1:15106
    Jan 17, 2017 5:21:46 PM org.openqa.selenium.remote.ProtocolHandshake createSession
    INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
    1484653906715   mozprofile::profile INFO    Using profile path C:\Users\vtiger\AppData\Local\Temp\3\rust_mozprofile.7d2LEwDKoE8J
    1484653906720   geckodriver::marionette INFO    Starting browser C:\Program Files\Mozilla Firefox\firefox.exe
    1484653906731   geckodriver::marionette INFO    Connecting to Marionette on localhost:58602
    1484653908388   addons.manager  DEBUG   Application has been upgraded
    1484653908843   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/addons/XPIProvider.jsm: ["XPIProvider"]
    1484653908846   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/LightweightThemeManager.jsm: ["LightweightThemeManager"]
    1484653908852   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/addons/GMPProvider.jsm
    1484653908855   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/addons/PluginProvider.jsm
    1484653908857   addons.manager  DEBUG   Starting provider: XPIProvider
    1484653908857   addons.xpi  DEBUG   startup
    1484653908858   addons.xpi  INFO    SystemAddonInstallLocation directory

How do I turn off this logging?

like image 554
Suresh Kumar Avatar asked Jan 17 '17 12:01

Suresh Kumar


People also ask

How do I disable marionette?

turning off marionette : Turning off marionette is no more a solution while we work with Selenium 3. x and recent Mozilla Firefox Browser releases. By forcefully setting "marionette" to false through DesiredCapabilities class you won't be able to open Mozilla Firefox Browser above version 48.

Can we disable low level GeckoDriver logs when we run Selenium script on Firefox?

New Selenium IDE After the execution of tests, there are logs generated because of Firefox logging in with geckodriver. This log generation by Firefox can be disabled by certain parameters setting. We can stop these logs from being recorded in the console and capture them in a different file.

What is Gecko driver in selenium?

GeckoDriver serves as a proxy between WebDriver enabled clients and the Firefox browser. In other words, GeckoDriver is a link between Selenium tests and the Firefox browser. It is a proxy for using W3C WebDriver-compatible clients that lets them interact with Gecko-based browsers.


2 Answers

You can disable the logs by sending them to /dev/null via a system property like so:

System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE,"/dev/null");

return new FirefoxDriver();
like image 102
Michael Medina Avatar answered Oct 11 '22 06:10

Michael Medina


Working solution on Windows and Linux.

# python 3

# windows
PATH_TO_DEV_NULL = 'nul'
FIREFOX_DRIVER_PATH = 'D:\\path\\to\\geckodriver.exe'

# linux
PATH_TO_DEV_NULL = '/dev/null'
FIREFOX_DRIVER_PATH = '/path/to/geckodriver'

# start browser
driver = webdriver.Firefox(executable_path=FIREFOX_DRIVER_PATH,
                           service_log_path=PATH_TO_DEV_NULL)

like image 29
Михаил Чеботарев Avatar answered Oct 11 '22 08:10

Михаил Чеботарев