如何设置木偶驱动程序的详细程度

如何设置木偶驱动程序的详细程度

本文介绍了如何设置木偶驱动程序的详细程度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无法控制木偶驾驶员的冗长!!

Unable to manage verbosity of marionette driver!!

环境:

Gecko driver 0.17.0
Selenium java 3.5.3
Firefox 52.3

尝试:

FirefoxOptions options = new FirefoxOptions();
options.addPreference("log", "{level: info}");
DesiredCapabilities ffCapabilities = DesiredCapabilities.firefox();
ffCapabilities.setCapability("moz:firefoxOptions", options);
ffCapabilities.setCapability("marionette", true);
driver = new FirefoxDriver(ffCapabilities);

日志信息:

INFO: Preferring the firefox binary in these options (/Applications/Firefox.app/Contents/MacOS/firefox-bin rather than /Applications/Firefox.app/Contents/MacOS/firefox-bin)
Sep 01, 2017 3:41:19 PM org.openqa.selenium.firefox.FirefoxOptions toCapabilities
INFO: Preferring the firefox binary in these options (/Applications/Firefox.app/Contents/MacOS/firefox-bin rather than /Applications/Firefox.app/Contents/MacOS/firefox-bin)
1504276879424   geckodriver     INFO    Listening on 127.0.0.1:3902
1504276879955   addons.manager  DEBUG   Application has been upgraded
1504276879998   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/addons/XPIProvider.jsm: ["XPIProvider"]
1504276880006   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/LightweightThemeManager.jsm: ["LightweightThemeManager"]
1504276880014   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/addons/GMPProvider.jsm
1504276880017   addons.manager  DEBUG   Loaded provider scope for resource://gre/modules/addons/PluginProvider.jsm
1504276880018   addons.manager  DEBUG   Starting provider: XPIProvider
1504276880019   addons.xpi      DEBUG   startup
1504276880019   addons.xpi      INFO    SystemAddonInstallLocation directory is missing
1504276880021   addons.xpi      INFO    Mapping [email protected] to /Applications/Firefox.app/Contents/Resources/browser/features/[email protected]
1504276880021   addons.xpi      INFO    Mapping [email protected] to /Applications/Firefox.app/Contents/Resources/browser/features/[email protected]
1504276880023   addons.xpi      INFO    Mapping [email protected] to /Applications/Firefox.app/Contents/Resources/browser/features/[email protected]
1504276880024   addons.xpi      INFO    Mapping [email protected] to /Applications/Firefox.app/Contents/Resources/browser/features/[email protected]
1504276880025   addons.xpi      INFO    Mapping {972ce4c6-7e08-4474-a285-3208198ce6fd} to /Applications/Firefox.app/Contents/Resources/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi
1504276880026   addons.xpi      DEBUG   checkForChanges
1504276880027   addons.xpi      INFO    SystemAddonInstallLocation directory is missing
1504276880029   addons.xpi      DEBUG   Loaded add-on state from prefs: {}
1504276880031   addons.xpi      DEBUG   New add-on [email protected] in app-system-defaults
1504276880034   addons.xpi      DEBUG   getModTime: Recursive scan of [email protected]
1504276880035   addons.xpi      DEBUG   New add-on [email protected] in app-system-defaults
1504276880036   addons.xpi      DEBUG   getModTime: Recursive scan of [email protected]
1504276880037   addons.xpi      DEBUG   New add-on [email protected] in app-system-defaults
1504276880038   addons.xpi      DEBUG   getModTime: Recursive scan of [email protected]
1504276880038   addons.xpi      DEBUG   New add-on [email protected] in app-system-defaults
1504276880040   addons.xpi      DEBUG   getModTime: Recursive scan of [email protected]
1504276880043   addons.xpi      DEBUG   New add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} in app-global
1504276880044   addons.xpi      DEBUG   getModTime: Recursive scan of {972ce4c6-7e08-4474-a285-3208198ce6fd}
1504276880045   addons.xpi      DEBUG   getInstallState changed: true, state: {"app-system-defaults":{"[email protected]":{"d":"/Applications/Firefox.app/Contents/Resources/browser/features/[email protected]","st":1504018117000},"[email protected]":{"d":"/Applications/Firefox.app/Contents/Resources/browser/features/[email protected]","st":1504018117000},"[email protected]":{"d":"/Applications/Firefox.app/Contents/Resources/browser/features/[email protected]","st":1504018117000},"[email protected]":{"d":"/Applications/Firefox.app/Contents/Resources/browser/features/[email protected]","st":1504018117000}},"app-global":{"{972ce4c6-7e08-4474-a285-3208198ce6fd}":{"d":"/Applications/Firefox.app/Contents/Resources/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi","st":1504018117000}}}
1504276880065   addons.xpi-utils        DEBUG   Opening XPI database /var/folders/6x/hw5060n54m7gfvnvd9zn_9q40000gn/T/rust_mozprofile.cnQmhI7DMu0T/extensions.json
1504276880067   addons.xpi-utils        DEBUG   New add-on [email protected] installed in app-system-defaults
*** Blocklist::_loadBlocklistFromFile: blocklist is disabled
1504276880091   DeferredSave.extensions.json    DEBUG   Save changes
1504276880093   addons.xpi-utils        DEBUG   New add-on [email protected] installed in app-system-defaults
1504276880098   DeferredSave.extensions.json    DEBUG   Starting timer
1504276880101   DeferredSave.extensions.json    DEBUG   Save changes
1504276880102   addons.xpi-utils        DEBUG   New add-on [email protected] installed in app-system-defaults
1504276880118   DeferredSave.extensions.json    DEBUG   Save changes
1504276880118   addons.xpi-utils        DEBUG   New add-on [email protected] installed in app-system-defaults
1504276880129   DeferredSave.extensions.json    DEBUG   Save changes
1504276880131   addons.xpi-utils        DEBUG   New add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} installed in app-global
1504276880136   DeferredSave.extensions.json    DEBUG   Save changes
1504276880137   addons.manager  DEBUG   Registering startup change 'installed' for [email protected]
1504276880160   addons.xpi      DEBUG   Loading bootstrap scope from /Applications/Firefox.app/Contents/Resources/browser/features/[email protected]
1504276880171   addons.xpi      DEBUG   Calling bootstrap method install on [email protected] version 2.0
1504276880174   addons.xpi-utils        DEBUG   Make addon app-system-defaults:[email protected] visible
1504276880176   DeferredSave.extensions.json    DEBUG   Save changes
1504276880177   addons.manager  DEBUG   Registering startup change 'installed' for [email protected]
1504276880179   addons.xpi      DEBUG   Loading bootstrap scope from /Applications/Firefox.app/Contents/Resources/browser/features/[email protected]
1504276880186   addons.xpi      DEBUG   Calling bootstrap method install on [email protected] version 1.10
1504276880192   addons.xpi-utils        DEBUG   Make addon app-system-defaults:[email protected] visible
1504276880201   DeferredSave.extensions.json    DEBUG   Save changes
1504276880204   addons.manager  DEBUG   Registering startup change 'installed' for [email protected]
1504276880209   addons.xpi      DEBUG   Loading bootstrap scope from /Applications/Firefox.app/Contents/Resources/browser/features/[email protected]
1504276880213   addons.xpi      DEBUG   Calling bootstrap method install on [email protected] version 1.0.5
1504276880213   addons.xpi-utils        DEBUG   Make addon app-system-defaults:[email protected] visible
1504276880214   DeferredSave.extensions.json    DEBUG   Save changes
1504276880215   addons.manager  DEBUG   Registering startup change 'installed' for [email protected]
1504276880217   addons.xpi      DEBUG   Loading bootstrap scope from /Applications/Firefox.app/Contents/Resources/browser/features/[email protected]
1504276880223   addons.xpi      DEBUG   Calling bootstrap method install on [email protected] version 1.0
1504276880225   addons.xpi-utils        DEBUG   Make addon app-system-defaults:[email protected] visible
1504276880229   DeferredSave.extensions.json    DEBUG   Save changes
1504276880230   addons.xpi-utils        DEBUG   Make addon app-global:{972ce4c6-7e08-4474-a285-3208198ce6fd} visible

推荐答案

在Mozilla Firefox发行版中,geckodriver的默认日志级别设置为INFO级别.也许您正在使用的框架或语言绑定(Java)覆盖了默认设置.

The default log level for geckodriver on release builds of Mozilla Firefox is set to INFO level. Perhaps your framework or the language binding you are using (Java) is overriding the default settings.

我们可以将日志级别设置为以下级别之一:

We can set the log level at either of the following levels:

  • All
  • CONFIG
  • FINE
  • FINER
  • FINEST
  • INFO
  • OFF
  • SEVERE
  • WARNING
  • All
  • CONFIG
  • FINE
  • FINER
  • FINEST
  • INFO
  • OFF
  • SEVERE
  • WARNING

这是将日志级别设置为 OFF 的代码块:

Here is the code block to set log level to OFF:

package demo;

import java.util.logging.Level;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;

public class Gecko_TRACE_LOGS
{
    public static void main(String[] args)
    {
        System.setProperty("webdriver.gecko.driver", "C:\\Utility\\BrowserDrivers\\geckodriver.exe");
        FirefoxOptions options = new FirefoxOptions();
        options.setLogLevel(Level.OFF);
        WebDriver driver =  new FirefoxDriver(options);
        driver.get("https://stackoverflow.com");
        System.out.println("Application opened");
        System.out.println("Page Title is : "+driver.getTitle());
        driver.quit();
    }
}

这篇关于如何设置木偶驱动程序的详细程度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-20 18:53