Skip to content

[🐛 Bug]: Headless Mode Results in White Screen in Selenium [C#] #14544

@serizava01

Description

@serizava01

What happened?

I have encountered an issue while using Selenium with the headless argument. When running the browser in headless mode, the page renders as a blank (white) screen, even though the site works fine when running in non-headless mode. The page appears to load successfully (based on network logs and console messages), but no content is visible.

Steps to Reproduce:

Set up a Selenium WebDriver (Chrome) with the headless option enabled.
Navigate to a webpage that renders correctly in non-headless mode.
Observe that the content does not display, and the screen remains white in headless mode.
Expected Behavior: The page should render as it does in non-headless mode, displaying the full content.

Actual Behavior: The page appears as a blank white screen

Thank you!
สกรีนช็อต 2024-09-27 164412

How can we reproduce the issue?

ChromeOptions options = new ChromeOptions();
            if (!checkBox1.Checked)
            {
                options.AddArgument("--headless");  
                options.AddArgument("window-size=1920x1080");
               
               
            }
            ChromeDriver driver = new ChromeDriver(options);
            driver.Navigate().GoToUrl("https://www.google.com/");

Relevant log output

Starting ChromeDriver 129.0.6668.70 (df87d5cf12b1397be7495a04cab2db6239b227a8-refs/branch-heads/6668@{#1420}) on port 58239
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully on port 58239.

DevTools listening on ws://127.0.0.1:58242/devtools/browser/f686c0cd-e61e-46c1-8192-d5882dbf1477

Operating System

11 Pro

Selenium version

4.25.0

What are the browser(s) and version(s) where you see this issue?

129.0.6668.70

What are the browser driver(s) and version(s) where you see this issue?

Latest version comes with selenium

Are you using Selenium Grid?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    G-chromedriverRequires fixes in ChromeDriver

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions