Headless mode does not work on Windows Server

150 views
Skip to first unread message

Mario Lavoro

unread,
Aug 27, 2023, 12:28:19 PM8/27/23
to ChromeDriver Users
Hello,
I'm trying to use chromedriver, let's consider the following piece of C# code:

//--------- MY CODE -----------------------------------------------------------------
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.AddArgument("disable-infobars");
chromeOptions.AddArgument("--no-sandbox");
//other option here... but 
NO headless mode
ChromeDriver driver = new ChromeDriver(path, chromeOptions);
driver.Navigate().GoToUrl(<some url>);
//--------------------------------------------------------------------------------------------

The scenario are the following:
 - if I put MY CODE in my local app console on WIN10 all work fine;
 - if I publish that app console on a windows server 2012 R2 and I manually launch it all work fine;
 - if I publish that app console on a windows server 2016 and I manually launch it all work fine.

 - if I put MY CODE in a .NET framework 4.8 webapi controller and launch it on my local pc with WIN10 all work fine;
 - if I publish that webapi in IIS on a windows server 2012 R2 and I test it, chrome works in background and it's no visible;
 - if I publish that webapi in IIS on a windows server 2016 and I test it, chrome works in background and it's no visible;

 - if I put MY CODE in a .NET 6.0 webapi controller and launch on my local pc with WIN10 all work fine;
 - if I publish that webapi in IIS on a windows server 2012 R2 and I test it, chrome works in background and it's no visible;
 - if I publish that webapi in IIS on a windows server 2016 and I test it, chrome works in background and it's no visible;

- if I create an app console containing MY CODE and I run the exe in a webapi controller (i.e. with a process.start(..) on my local pc with WIN10 all work fine;
 - if I publish that webapi in IIS on a windows server 2012 R2 and I test it, chrome works in background and it's no visible;
 - if I publish that webapi in IIS on a windows server 2016 and I test it, chrome works in background and it's no visible;

When I say "all work fine" I mean I can see chrome running and visible.

I need to see chrome running visible in windows server: someone could tell me what's the reason of different behaviour between windows server and not server version?
And how could I resolve?

Thanks in advance, best regards.
M.




Mario Lavoro

unread,
Aug 28, 2023, 1:41:09 PM8/28/23
to ChromeDriver Users

Hi, nobody can help me?

I would clarify that the issue does not seem depending on chromedriver version, cause on Win Server 2012R2 I installed ChromeDriver 109.0.5414.74 and on Win Server 2016 I installed the latest version.

Thanks in advance, best regards.
M.


C Smith

unread,
Aug 31, 2023, 8:37:18 PM8/31/23
to ChromeDriver Users
Is IIS calling the chromedriver?  I think that would mean chrome is being run by whatever user your IIS Services/w3wp.exe process is being run by, like the "Network Service" account or some other non-user account. You wouldn't see the chrome window being run by a different user.
Reply all
Reply to author
Forward
0 new messages