Google chrome Firefox的Webdriver日志

Google chrome Firefox的Webdriver日志,google-chrome,firefox,selenium,logging,selenium-webdriver,Google Chrome,Firefox,Selenium,Logging,Selenium Webdriver,和selenium驱动程序都可以记录浏览器端发生的所有事情。通过在初始化驱动程序时指定服务日志路径,可以控制日志将写入的位置。例如,对于chrome(在Python中): 执行代码后,/tmp/log文件将包含有助于调试的服务日志: [0.985][INFO]: Launching chrome: ... [2.620][INFO]: RESPONSE InitSession { "acceptSslCerts": true, "applicationCacheEnabled": f

和selenium驱动程序都可以记录浏览器端发生的所有事情。通过在初始化驱动程序时指定服务日志路径,可以控制日志将写入的位置。例如,对于chrome(在Python中):

执行代码后,
/tmp/log
文件将包含有助于调试的服务日志:

[0.985][INFO]: Launching chrome: ...
[2.620][INFO]: RESPONSE InitSession {
   "acceptSslCerts": true,
   "applicationCacheEnabled": false,
   "browserConnectionEnabled": false,
   "browserName": "chrome",
   "chrome": {
      "userDataDir": "/var/folders/yy/ppdg927x4zv8b0rbzg1f_jzh0000gn/T/.org.chromium.Chromium.ibsof9"
   },
   "cssSelectorsEnabled": true,
   "databaseEnabled": false,
   "handlesAlerts": true,
   "javascriptEnabled": true,
   "locationContextEnabled": true,
   "nativeEvents": true,
   "platform": "Mac OS X",
   "rotatable": false,
   "takesHeapSnapshot": true,
   "takesScreenshot": true,
   "version": "37.0.2062.120",
   "webStorageEnabled": true
}
[2.677][INFO]: Waiting for pending navigations...
[2.696][INFO]: Done waiting for pending navigations
[3.290][INFO]: Waiting for pending navigations...
[4.338][INFO]: Done waiting for pending navigations
[4.338][INFO]: RESPONSE Navigate
[4.339][INFO]: COMMAND CloseWindow {

}
[4.451][INFO]: RESPONSE CloseWindow
有没有一种方法可以使用
Firefox
web驱动程序获取相同的信息

从我在源代码中看到的情况来看,
Chrome
PhantomJS
都通过
subprocess
启动,并将
--log path
参数传递给它。这些服务负责日志记录。至于,它的实现是完全不同的,并且是基于类的


提供的示例和链接与Python相关,但问题基本上是通用的,与语言无关。如果有任何提示,我将不胜感激。

我相信FireFox的登录必须通过配置文件启用。需要进行base64编码

我们提到了一些类似于这些的东西


有什么帮助吗?

您必须在firefox配置文件中设置日志记录选项,就像在开发者提示链接中一样--对于控制台日志,您应该使用:

FirefoxProfile p = new FirefoxProfile();
p.setPreference("webdriver.log.file", "/tmp/firefox_console");
WebDriver driver = new FirefoxDriver(p);
对于浏览器日志,您应该使用

webdriver.firefox.logfile 
()


希望这能有所帮助。

日志文件没有Chrome和PhantomJS服务提供的日志文件那么详细,但这很好,有助于调试。非常感谢你!你们知道chrome浏览器的“浏览器日志”是什么吗?i、 e.webdriver.firefox.logfile,但不适用于Chrome。
webdriver.firefox.logfile