'Chrome WebDriver does not open when called from IIS

I have a really strange issue (And I have a really strong suspicion - that it will be on the IIS side).

I have .NETCORE6 application, which uses Selenium via IHostedService.

There are cases that work:

  • If I launch the application from Visual Studio's IIS locally the browser is opened
  • If I launch the application from CMD (as self-hosted) the browser is opened
  • If I launch the application from CMD (as self-hosted) on the server the browser is opened

BUT

If I launch the application from IIS on the server - the tests are running (looks like in headless mode) but the browser is not shown.

Does anybody have experience with IIS?

I have tried different IIS Pool Identity - and executed the app as a DefaulPoolIdentity, LocalService, LocalSystem, and even as my user which has admin rights - but the browser is still hidden.

Additional Notes:

  • I also checked - that the browser is launching in maximized mode and on the correct screen

So the question is how to launch the app from the server via IIS with the web browser opened? (There just must be the solution for that right?)



Solution 1:[1]

Lex Li's answer is the correct one - so if anyone else finds the answer please read the article https://blog.lextudio.com/web-application-differences-in-visual-studio-and-iis-60fec7e311b3

Solution 2:[2]

It seems that if you start chromedriver manually and then call it using Selenium Grid the browser will open.

Driver configuration would be something like

var uri = new Uri("http://localhost:9515/"); --my chromedriver uri
var driver = new RemoteWebDriver(uri, new ChromeOptions());
...

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Josef Šir??ka
Solution 2 Flavio Spedaletti