I’m struggling with running tests in Codeception using the headless Chrome browser. When I execute the tests, they keep freezing, and the fail.png screenshot shows just a blank page.
I think this happens because they’re getting stuck on the “Insecure Connection” page. I’ve included the following configurations in my acceptance.suite.yml:
chromeOptions:
args: ["--headless", "--disable-gpu", "--test-type", "--ignore-certificate-errors"]
However, this setup hasn’t solved my issue, and the tests continue to fail. Has anyone else dealt with this SSL certificate warning in headless Chrome with Codeception? What other options could I use to bypass this warning page?
Had the same problem a few months ago. Just using --ignore-certificate-errors wasn’t enough for me. I had to add --ignore-ssl-errors and --allow-running-insecure-content to my chrome options. Also throw in --no-sandbox and --disable-web-security - these can mess with certificate handling in headless mode. Check if you’re dealing with self-signed certs or certificate chain problems too. I also needed --disable-features=VizDisplayCompositor because I was getting blank screenshots from rendering issues. Try adding these flags to your chromeOptions and see if it fixes the freezing.
Adding --acceptInsecureCerts to your webdriver config also worked for me. Codeception sometimes needs both chrome args AND webdriver capabilities set. If you’re running in containers, try --disable-dev-shm-usage too - it fixed my blank page issues when chrome couldn’t allocate enough memory for SSL handshakes.
Those blank screenshots and freezes happen because Chrome’s stuck waiting for you to handle the SSL warning. Try adding --ignore-certificate-errors-spki-list and --ignore-certificate-errors-ssl-errors - they catch specific SSL errors that the basic ignore flags miss. I’ve had luck with --disable-background-timer-throttling too since it stops Chrome from timing out on certificate dialogs. You can also set --user-data-dir to a temp directory so Chrome doesn’t pull certificate policies from your main profile. Testing localhost or internal domains? Add --disable-extensions - extensions sometimes mess with certificate handling in headless mode.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.