java – 在Marionette驱动程序中禁用日志跟踪

当MarionetteDriver推出时,它会为每个操作提供打印日志声明.就像

1465882610065   Marionette  TRACE   conn0 -> [0,138,"executeScript",{"args":[],"newSandbox":false,"script":"return Math.max(document.body.scrollHeight, document.documentElement.scrollHeight,document.body.offsetHeight, document.documentElement.offsetHeight,document.body.clientHeight, document.documentElement.clientHeight);","scriptTimeout":null,"specialPowers":false}]
1465882610066   Marionette  TRACE   conn0 <- [1,138,null,{"value":895}]
1465882610070   Marionette  TRACE   conn0 -> [0,139,"executeScript",{"args":[],"newSandbox":false,"script":"window.devicePixelRatio = window.devicePixelRatio || window.screen.deviceXDPI / window.screen.logicalXDPI; var pr = window.devicePixelRatio; if (pr != undefined && pr != null) return pr; else return 1.0;","scriptTimeout":null,"specialPowers":false}]
1465882610071   Marionette  TRACE   conn0 <- [1,139,null,{"value":1}]
1465882610319   Marionette  TRACE   conn0 -> [0,140,"findElements",{"using":"css selector","value":".logOut"}]
1465882610321   Marionette  TRACE   conn0 <- [1,140,null,[{"element-6066-11e4-a52e-4f735466cecf":"f9d9adc3-58df-446a-953d-eb793ac27025","ELEMENT":"f9d9adc3-58df-446a-953d-eb793ac27025"}]]
1465882610325   Marionette  TRACE   conn0 -> [0,141,"isElementDisplayed",{"id":"f9d9adc3-58df-446a-953d-eb793ac27025"}]
1465882610335   Marionette  TRACE   conn0 <- [1,141,null,{"value":true}]
1465882610338   Marionette  TRACE   conn0 -> [0,142,"isElementEnabled",{"id":"f9d9adc3-58df-446a-953d-eb793ac27025"}]
1465882610340   Marionette  TRACE   conn0 <- [1,142,null,{"value":true}]
1465882610343   Marionette  TRACE   conn0 -> [0,143,"clickElement",{"id":"f9d9adc3-58df-446a-953d-eb793ac27025"}]
1465882610372   Marionette  TRACE   conn0 <- [1,143,null,{}]
1465882610398   Marionette  TRACE   conn0 -> [0,144,"quitApplication",{"flags":["eForceQuit"]}]
1465882610399   Marionette  TRACE   conn0 <- [1,144,null,{}]
1465882610404   addons.xpi  DEBUG   Calling bootstrap method shutdown on @spritzfirefox version 4.1.5b
1465882610415   addons.xpi  DEBUG   Calling bootstrap method shutdown on e10srollout@mozilla.org version 1.0
1465882610416   addons.xpi  DEBUG   Calling bootstrap method shutdown on firefox@getpocket.com version 1.0.2
1465882610416   addons.xpi  DEBUG   Calling bootstrap method shutdown on loop@mozilla.org version 1.3.2

我正在推出MarionetteDriver

System.setProperty("webdriver.gecko.driver", "geckodriver.exe");
WebDriver driver = new MarionetteDriver();

是否有任何功能可以禁用日志

最佳答案 Firefox应该可以选择在about:config属性marionette.logging中设置Marionette的日志记录级别,但这显然不存在于47及更高版本的构建中.

显然,构建47中没有正式支持Marionette,这很不幸,因为FirefoxDriver也不再适用于此版本.目前唯一支持的选项是降级(并使用FirefoxDriver)或等待更新.

从理论上讲,这将在47.0.1或48中修复,可能已经在夜间.

资料来源:https://github.com/mozilla/geckodriver/issues/89

点赞