Today, I updated the Chrome browser to the latest version (129). After the update, running Chrome in headless mode produces an unusual result: a blank white window appears, matching the size of the browser.
I was using Puppeteer and Selenium with Chrome 129 on Windows.
Why did this blank window start appearing? Is this a bug with Chrome 129?
Test Result:
Chrome128 | Chrome129 | Chrome130 | |
---|---|---|---|
Puppeteer(v23.4.0) | O | X | O |
Selenium(v4.0) | O | X | O |
Playwright(v1.47.1) | O | X | O |
Update:
MacOS, Linux no problem.
3
options.add_argument("--headless=old")
2
A bug ticket was filed for this: https://issues.chromium.org/issues/359921643.
This affects Windows users of headless Chromium 129, where Chromium changed the default headless
mode from the old one (--headless=old
) to the new one (--headless=new
).
If you read all the Stack Overflow comments of /a/73840130/7058266, you’ll find that the old headless mode is being retired this year. (It’s already not the default headless mode anymore.)
To keep using Chrome’s new headless mode (which has more features than the old one), here’s my temporary fix for the bug:
--window-position=-2400,-2400
options.add_argument("--window-position=-2400,-2400")
(I moved the window far off-screen so that it’s not seen.)
Or, for now, you can switch back to the old headless mode (--headless=old
), but that’s being retired soon, and lacks the features of the new headless mode. Plus, the PR with the fix has already been merged: https://chromium-review.googlesource.com/c/chromium/src/+/5789117 (so things will work again soon without workarounds needed).
2
After struggling for hours on Chrome 129, the answer by Filipe Branquinho works for me:
options.add_argument("--headless=old")
However, this is likely just a temporary fix and it would be better to simply move to a different Chrome version that’s unaffected by the bug.
Russ is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
–headless=old If you do this, your problems will be solved
Şahin Bölükbaşı is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Try the New Headless Mode Flag: –headless=new
const browser = await puppeteer.launch({
headless: true, // Use legacy headless mode
args: [‘–headless=chrome’, ‘–disable-gpu’, ‘–no-sandbox’]
});
Possible Causes:
Chrome 129 Headless Mode Behavior Change:
Chrome’s headless mode has undergone significant changes in recent versions. Since Chrome 109, there’s a new mode called headless mode v2 (–headless=new), which changes how rendering is handled. It’s possible that Chrome 129 has either enforced or further modified this behavior.
Missing or Incorrect Flags:
The blank white window often indicates that the correct flags for headless mode are not being passed. Headless mode requires specific flags to ensure the browser runs correctly without rendering a visible window.
Rendering Issues with Puppeteer/Selenium:
Puppeteer and Selenium may need updates to handle the changes in Chrome 129’s headless mode. If they are not up to date or properly configured for the latest Chrome version, rendering may fail, resulting in a blank window.
Driver or Compatibility Issues:
The ChromeDriver used by Selenium and Puppeteer might not be fully compatible with Chrome 129, especially if the headless mode behavior has changed. Ensuring that ChromeDriver is updated to the latest version that matches Chrome 129 is crucial.
1