Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
serizava01 opened this issue Sep 27, 2024 · 7 comments
Closed

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

serizava01 opened this issue Sep 27, 2024 · 7 comments
Labels
G-chromedriver Requires fixes in ChromeDriver

Comments

@serizava01
Copy link

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

Copy link

@serizava01, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@serizava01 serizava01 changed the title [🐛 Bug]: Bug Report: Headless Mode Results in White Screen in Selenium [🐛 Bug]: Headless Mode Results in White Screen in Selenium Sep 27, 2024
@serizava01 serizava01 changed the title [🐛 Bug]: Headless Mode Results in White Screen in Selenium [🐛 Bug]: Headless Mode Results in White Screen in Selenium [C#] Sep 27, 2024
@diemol diemol added G-chromedriver Requires fixes in ChromeDriver and removed I-defect needs-triaging labels Sep 27, 2024
Copy link

Hi, @serizava01.
This issue has been determined to require fixes in ChromeDriver.

You can see if the feature is passing in the Web Platform Tests.

If it is something new, please create an issue with the ChromeDriver team.
Feel free to comment the issues that you raise back in this issue. Thank you.

@Skryppy
Copy link

Skryppy commented Oct 8, 2024

change
options.AddArgument("--headless")
on
options.AddArgument("--headless=old")

@khxql
Copy link

khxql commented Oct 8, 2024

Depending on the new headless mode, now you can use --headless=old, but Selenium should make it more compatible so that it detect when to use --headless or --headless=old. Because me myself I am not sure when to use these in a project I want to publish soon and it should be compatible.

I am confused of what versions of Selenium and Chrome the --headless or --headless=old should be used, also be sure that only the new headless mode will be used in upcoming updates of Chrome depending on that they say:
image_2024-10-08_220726349

Purpose of this

image

@serizava01
Copy link
Author

Thanks everyone I fixed it <3

@rickeho
Copy link

rickeho commented Oct 11, 2024

Did you fix it by using "--headless=old" instead? @serizava01

@serizava01
Copy link
Author

Did you fix it by using "--headless=old" instead? @serizava01

Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
G-chromedriver Requires fixes in ChromeDriver
Projects
None yet
Development

No branches or pull requests

5 participants