I'm new to playwright (.net), forgive me if I'm doing something wrong. I'm trying to take a screenshot in dark mode, using a headless browser, but everything I tried just doesn't work for me. The closest I got was using a non-headless, which seemed to work. I tried all the colorscheme:dark options using PageEmulateMediaOptions and BrowserNewContextOptions. This didn't work for me. The arg, works, but only in non-headless mode. Their are some differences
var browser = await playwright.Chromium.LaunchAsync(new LaunchOptions { Headless = true, Args = new string[] { "--enable-features=WebContentsForceDark" } });
I feel like I'm just missing something easy..
This thread is trying to answer question "How can I take a screenshot in dark mode using a headless browser in playwright (.net)?"
Hey is your solution for playwright - https://playwright.dev/dotnet/docs/emulation#color-scheme-and-media
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].