Chrome Headless – ERROR Disconnected because no message in 30000 ms
June 7, 2024 2024-06-01 16:31Chrome Headless – ERROR Disconnected because no message in 30000 ms
If you may gets an error when you trying to use the Chorme Headless in Unit Test Cases in the Jenkin Pipeline “ERROR Disconnected because no message in 30000 ms” issue in Chrome Headless often indicates that the browser instance isn’t communicating with your script as expected. Here are several steps you can take to troubleshoot and resolve this issue:
07 06 2024 08:33:36.724:WARN [launcher]: ChromeHeadless was not killed in 2000 ms,
sending SIGKILL.
07 06 2024 08:33:52.414:INFO [karma]: Karma v3.0.0 server started athttp://0.0.0.0:9876/
07 06 2024 08:33:52.445:INFO [launcher]: Launching browser ChromiumHeadlessConfigured with unlimited concurrency
07 06 2024 08:33:52.348:INFO [launcher]: Starting browser ChromeHeadless
07 06 2024 08:34:36.084:INFO [HeadlessChrome 0.0.0 (Linux 0.0.0)]: Connected on socket bWQDT9taY4WS0BRjAAAB with id 21832231
07 06 2024 08:35:06.011:WARN [HeadlessChrome 0.0.0 (Linux 0.0.0)]: Disconnected (1 times), because no message in 30000 ms. HeadlessChrome 0.0.0 (Linux 0.0.0) ERROR Disconnected, because n
We need to modify the karma.conf.js file and verify the details below,
Increase Browser No Activity Timeout:
Increase the browserNoActivityTimeout
in your karma.config.js
to give the browser more time to send a message.
Increase Capture Timeout
Increase the captureTimeout
in your karma.config.js
to allow more time for the browser to capture.
captureTimeout: 300000,
browserDisconnectTolerance: 3,
browserDisconnectTimeout : 300000,
browserNoActivityTimeout : 300000,
browserNoActivityTimeout: 60000,
So, the sample source code looks like,
module.exports = function(config) {
config.set({
// other configurations...
captureTimeout: 300000,
browserDisconnectTolerance: 3,
browserDisconnectTimeout : 300000,
browserNoActivityTimeout : 300000,
browserNoActivityTimeout: 60000, });
};