Google chrome Chrome 60在无头模式下启用日志记录

Google chrome Chrome 60在无头模式下启用日志记录,google-chrome,selenium,selenium-chromedriver,geb,Google Chrome,Selenium,Selenium Chromedriver,Geb,我在Windows7企业版上使用带有Chrome60的Geb(Selenium&WebDrivers3.40) MyGebConfig.groovy定义了一个chrome环境,该环境使用以下开始参数配置chrome--headless--disable gpu--disable plugins--enable logging--v=1 environments { chrome { ChromeDriverManager.instance.setup()

我在Windows7企业版上使用带有Chrome60的Geb(Selenium&WebDrivers3.40)

My
GebConfig.groovy
定义了一个
chrome
环境,该环境使用以下开始参数配置chrome
--headless--disable gpu--disable plugins--enable logging--v=1

environments {

    chrome {
        ChromeDriverManager.instance.setup()
        driver = {

            ChromeOptions options = new ChromeOptions()
            options.addArguments('--headless', '--disable-gpu', '--disable-plugins', '--enable-logging', '--v=1')

            def capabilities = DesiredCapabilities.chrome()
            capabilities.setCapability(ChromeOptions.CAPABILITY, options)

            def driver = new ChromeDriver(capabilities)
            return driver
        }
    }
}
根据这一点,Chrome应该登录到
~/.config/google Chrome
,但在运行我的Geb测试后,我在该路径上找不到任何日志。我正在尝试启用日志,因为我在使用HTTPS连接内部网站时遇到问题,我需要更多关于出错原因的信息

您能告诉我如何正确启用日志以及在哪里可以找到Google Chromes日志输出吗

更新1:

据此,日志保存在
%LOCALAPPDATA%\Google\Chrome\User Data\Chrome\u debug.log
下。我找到了那个日志,但它是空的。 由于我似乎无法通过SSL连接,我想知道如何让Chrome告诉我问题所在。有什么想法吗

更新2:

似乎每当我在
--headless
模式下运行测试并访问内部HTTPS URL时,我都会从Web驱动程序中获得以下虚拟HTML

<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
    <pre style="word-wrap: break-word; white-space: pre-wrap;"></pre><iframe name="chromedriver dummy frame" src="about:blank"></iframe>
</body>
</html>


在服务器日志中,我看不到任何传入的HTTP请求。有人知道这种行为吗?

我认为您的最后一个参数应该是

'--enable-logging=v=1'
将两者结合起来

我找到的调试日志也在应用程序安装目录中

C:\Program Files (x86)\Google\Chrome\Application\<chrome version>
根据,日志记录取决于平台:

在Linux上:

--enable-logging=stderr --v=1
在Windows上:

--enable-logging --v=1
--enable-logging=stderr --v=1 > log.txt 2>&1  # Seems to capture more output
我在Linux上进行了测试,效果很好


日志保存在Chrome的用户数据目录中。

首先手动验证日志是否有效。因为我怀疑它会记录https和其他细节。此外,日志文件是在概要文件目录中创建的
chrome\u debug.log
。请参阅:使用headless模式时,我找不到chrome_debug.log文件。你也面临同样的问题吗?对我来说不起作用。以下文档说明如下>要启用日志记录,请使用以下命令行标志启动Chrome:>
--启用日志记录--v=1
在windows上,这些是chrom的命令行开关,适用于我;chrome--enable logging--v=1--headless--disable gpu--dump dom您可以尝试将其作为一个参数添加,而不使用=?所以'--enable logging--v=4'
--dump dom some url.com
将dom转储到?到标准输出,尽管您可以通过在末尾添加'>filename.html'将dom保存到文件中。这将把它保存在chrome执行目录中,因此与我添加到答案的文件夹相同。有没有办法禁用日志记录?
C:\Program Files (x86)\Google\Chrome\Application\<chrome version>