无法抑制Geckodriver中的浏览器日志

时间:2017-06-01 14:34:13

标签: selenium-firefoxdriver geckodriver

我正在运行Geckodriver(和Firefox),显然Gecko充满了来自FF的错误(见下文)。我没有使用任何插件,我也不知道为什么会这样。我想抑制它,以便日志不包含浏览器中的任何内容。我将日志级别设置为致命,但它似乎只会影响geckodriver自己的日志,但不会影响浏览器的日志。

我用这个命令启动geckodriver:

./geckodriver.exe --port=4567 --binary="C:\Program Files (x86)\Mozilla Firefox\firefox.exe" --log fatal

然后我通过手动将HTTP请求POST请求发送到\ session:

来创建会话
{
  "desiredCapabilities": {
    "acceptInsecureCerts": true,
    "loggingPrefs": {
      "server": "OFF",
      "performance": "OFF",
      "driver": "OFF",
      "browser": "OFF",
      "client": "OFF"
    },
    "browserName": "firefox",
    "moz:firefoxOptions": {
      "args": []
    },
    "version": "",
    "platform": "ANY"},
  "requiredCapabilities": {},
  "capabilities": {
    "desiredCapabilities": {
      "acceptInsecureCerts": true,
      "loggingPrefs": {
        "server": "OFF",
        "performance": "OFF",
        "driver": "OFF",
        "browser": "OFF",
        "client": "OFF"
      },
      "browserName": "firefox",
      "version": "",
      "platform": "ANY"
    },
    "requiredCapabilities": {},
    "alwaysMatch": {
      "acceptInsecureCerts": true
    }
  }
}

这是我在前几秒内得到的输出:

1496327277282   addons.manager  ERROR   startup failed: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIFile.create]"  nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)"  location: "JS frame :: resource://gre/modules/FileUtils.jsm :: FileUtils_getDir :: line 70"  data: no] Stack trace: FileUtils_getDir()@resource://gre/modules/FileUtils.jsm:70 < FileUtils_getFile()@resource://gre/modules/FileUtils.jsm:42 < validateBlocklist()@resource://gre/modules/AddonManager.jsm:671 < startup()@resource://gre/modules/AddonManager.jsm:834 < startup()@resource://gre/modules/AddonManager.jsm:3129 < observe()@resource://gre/components/addonManager.js:65
JavaScript error: resource://gre/modules/AddonManager.jsm, line 1657: NS_ERROR_NOT_INITIALIZED: AddonManager is not initialized
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
LdrLoadDll: Blocking load of 'hook.dll' -- see http://www.mozilla.com/en-US/blocklist/
...

此行每秒重复数百次

如何抑制此日志或修复根本原因?

编辑: 经过一些研究后,我发现当我从命令行运行firefox.exe时,这行被打印到标准输出中(没有gecko)

1 个答案:

答案 0 :(得分:0)

我将Eclipse IDE用于Java开发人员版本:2019-12(4.14.0), Firefox75.0(64位), ng 7.1.0, 硒java 3.141.59 蚀控制台显示 LdrLoadDll:阻止加载“ safemon64.dll”-请参阅http://www.mozilla.com/en-US/blocklist/ 我不知道如何处理。