1

无法管理牵线木偶驱动程序的冗长!如何设置牵引木偶的详细程度?

环境:

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 

回答

1

geckodriver上发布默认的日志级别构建Mozilla Firefox浏览器的设置为INFO水平。也许你的框架或你正在使用的语言绑定(Java)正在覆盖默认设置。

我们可以设置在以下任一级别的日志级别:

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

下面是代码块设置日志级别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(); 
    } 
} 
+0

感谢您的回复,如果我想添加一些Firefox的期望的能力什么?? –

+0

试过了; DesiredCapabilities ffCapabilities = DesiredCapabilities.firefox(); ffCapabilities.setCapability(FirefoxDriver.PROFILE,firefoxProfile()); ffCapabilities.setCapability(“moz:firefoxOptions”,ffOptions); internalDriver = new FirefoxDriver(ffCapabilities); 但不幸的是firefox选项并未考虑 –

+0

@ Ranjith's尝试'FirefoxOptions'类来设置详细程度。如果我的答案满足了您的问题,请** **接受** **答案**,并根据您的新要求提出一个新问题。我们很乐意为您提供帮助。 – DebanjanB