我在Windows 7 Enterprise上使用Geb(Selenium & Webdrivers 3.40)和Chrome 60。Chrome 60启用无头模式下的日志记录
我的GebConfig.groovy
定义了一个chrome
环境,该环境使用以下启动参数--headless --disable-gpu --disable-plugins --enable-logging --v=1
配置Chrome。
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
}
}
}
根据这一post Chrome应该会登录到~/.config/google-chrome
但运行我的盖布的测试后,我无法找到这条道路上的任何记录。我试图启用日志,因为我无法使用HTTPS连接内部网站,而且我需要更多有关错误的信息。
您能否告诉我如何正确启用日志以及在哪里可以找到Google Chromes日志输出?
更新1:
根据这一documentation的日志%LOCALAPPDATA%\Google\Chrome\User Data\chrome_debug.log
下保存。我发现这个日志,但它是空的。 由于我似乎无法通过SSL连接我不知道如何让Chrome能告诉我问题出在哪里。有任何想法吗?
更新2:
看来,每当我跑测试中--headless
模式和访问内部HTTPS URL我从网络驱动器得到如下伪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请求。有没有人知道这样的行为?
首先手动确认日志作品。因为我怀疑它记录了https和其他细节。此外,日志文件是在配置文件目录中创建的'chrome_debug.log'。请参阅https://www.chromium.org/for-testers/enable-logging –