Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Chromium headless work on Windows Server Core 2016?

Background

I am tasked with replacing our IE based printing logic with Chromium so that we can eventually support running our current server software on Windows Server Core or potentially other operating systems that support .Net Core. My current thought is to either use Chromium embedded framework or to make use of Puppeteer. I am leaning towards the later because I feel it would be easier to port between operating systems.

Issue

Originally it failed to start with an error about sandboxing so I added the no-sandbox flag. Now when I try to load Chromium it fails to start with the exception below stating that it cannot load chrome.dll

 PS C:\Program Files (x86)\Google\Chrome\Application>> .\chrome --headless --enable-logging --disable-gpu --screenshot="C:\screen.png" "https://www.chromestatus.com/"

Which yields the following error in the debug.log file:

[0813/133208.016:ERROR:main_dll_loader_win.cc(134)] Failed to load Chrome DLL from c:\Program Files (x86)\Google\Chrome\Application\68.0.3440.106\chrome.dll: The specified module could not be found. (0x7E)

I have checked around the internet and found a few mentions of this error but the suggested fixes don't seem to fix the issue.

like image 484
Joshua Cain Avatar asked Aug 15 '18 13:08

Joshua Cain


2 Answers

I was able to download Chromium 72.0.3592.0 via Chocolatey and the issue is resolved in that version. I tested using Server Core 2016 LTSB.

choco install chromium --pre -y

chrome --headless --disable-gpu --dump-dom --enable-logging https://www.chromestatus.com/ --no-first-run


Edit:

If you are attempting to run Selenium Tests using Docker windowsservercore and chromium: The command line tests of chromium chrome.exe appear to never work from the container command line.

However when you run dotnet test app.csproj or dotnet vstest app.dll inside the container the webdriver successfully starts and drives the browser

like image 56
J.D. Cain Avatar answered Nov 02 '22 16:11

J.D. Cain


This has been reported to the Chromium team. It appears that Chromium 68+ might have issues with Windows Server 2016.

https://bugs.chromium.org/p/chromium/issues/detail?id=873097

like image 37
Joshua Cain Avatar answered Nov 02 '22 16:11

Joshua Cain