I have an ASP.NET MVC CORE 3.0
app, my requirement is to run Selenium
on IIS 10
. When I host my app InProcess
it works, as soon as I switch to IIS
it stops working (without any error message and regardless of app pool profile). I have the following code, but I believe that the code is irrelevant to this particular issue.
public void OpenOrReuseDriver(bool headlessMode = false, bool reuse = true)
{
if (!_driver.IsClosed()) return;
if (reuse && _drivers.Any() && _drivers.Last().IsOpen())
_driver = _drivers.Last();
else
{
var chromeService = ChromeDriverService.CreateDefaultService($@"{AppDomain.CurrentDomain.BaseDirectory}"); // Directory.GetCurrentDirectory() // AppDomain.CurrentDomain.BaseDirectory // Directory.GetCurrentDirectory()}\wwwroot
var chromeOptions = new ChromeOptions
{
BinaryLocation = @"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
};
if (headlessMode)
{
chromeOptions.AddArguments(new List<string>
{
"--silent-launch",
"--no-startup-window",
"no-sandbox",
"headless"
});
chromeService.HideCommandPromptWindow = true;
}
_driver = new ChromeDriver(chromeService, chromeOptions);
var size = new Size(1240, 720);
_driver.Manage().Window.Size = size;
_driver.Manage().Window.Position = PointUtils.CenteredWindowTopLeft(size).ToDrawingPoint();
_driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(60);
_driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30);
_drivers.Add(_driver);
}
}
I would like to know the steps that will make Selenium
work with IIS
.