Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome 60 enable logging in headless mode

I'm using Geb (Selenium & Webdrivers 3.40) with Chrome 60 on Windows 7 Enterprise.

My GebConfig.groovy defines a chrome environment that configures Chrome with the following start arguments --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
        }
    }
}

According to this post Chrome should log to ~/.config/google-chrome but after running my Geb tests I cannot find any log on that path. I'm trying to enable the log since I have trouble connecting a internal website using HTTPS and I need more information on what is going wrong.

Can you tell me how to enable the log correctly and where I can find Google Chromes log output?

Update 1:

According to this documentation the log is saved under %LOCALAPPDATA%\Google\Chrome\User Data\chrome_debug.log. I found that log but its empty. Since I cannot seem to connect over SSL I wonder how I can get Chrome to tell me where the problem lies. Any ideas?

Update 2:

It seems that whenever I ran the tests in --headless mode and accessing an internal HTTPS URL I get the following Dummy HTML from the Web Driver.

<!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>

In the servers log I cannot see any incoming HTTP request. Does anyone know such a behaviour?

like image 496
saw303 Avatar asked Oct 19 '25 07:10

saw303


1 Answers

According to this page, the logging depends on the platform:

On Linux:

--enable-logging=stderr --v=1

On Windows:

--enable-logging --v=1
--enable-logging=stderr --v=1 > log.txt 2>&1  # Seems to capture more output

I've tested on Linux and it works fine.

The logs are saved on the Chrome's user data directory.

like image 105
Cyril N. Avatar answered Oct 21 '25 22:10

Cyril N.