当前位置:  开发笔记 > 后端 > 正文

如何关闭硒3中的木偶/壁虎驱动程序日志

如何解决《如何关闭硒3中的木偶/壁虎驱动程序日志》经验,为你挑选了1个好方法。

我需要关闭Marionette/GeckoDriver日志记录; 有没有办法做到这一点?我一直在寻找,但我没有得到正确的答案.INFO日志是:

 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

如何关闭此日志记录?



1> 小智..:

您可以使用以下代码行来显示牵线木偶日志:

System.setProperty("webdriver.gecko.driver","src/main/resources/drivers/geckodriver.exe");
System.setProperty(FirefoxDriver.SystemProperty.DRIVER_USE_MARIONETTE,"true");
System.setProperty(FirefoxDriver.SystemProperty.BROWSER_LOGFILE,"/dev/null");

return new FirefoxDriver();


即使省略了DRIVER_USE_MARIONETTE行,这对我也有用
推荐阅读
放ch养奶牛
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有