My current objective is to have Jenkins spin up Windows Servercore docker container that has chrome installed, which my selenium test will run locally via headless mode.
I am stuck and have done a fair amount of research. Most people mentioned that adding "--no-sandbox" argument will resolve this issue. However, it is not the case for me. I've also added quite a few arguments as people mentioned but no luck:
options.AddArguments("--headless");
options.AddArguments("--no-sandbox");
options.AddArguments("--disable-gpu");
options.AddArguments("--disable-dev-shm-usage");
I've made sure that both the chromedriver and chrome installed are the same:
- Chrome driver from Nuget: Selenium.WebDriver.ChromeDriver.80.0.3987.10600
- Chrome browser installed via chocolatey: ChromeDriver 80.0.3987.106
Does anyone else have a solution that I have not tried yet? Stack trace below
Starting ChromeDriver 80.0.3987.106 (f68069574609230cf9b635cd784cfb1bf81bb53a-refs/branch-heads/3987@{#882}) on port 49205
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
TestLibrary.Tests.Test1 [STARTING]
TestLibrary.Tests.Test1 [FAIL]
OpenQA.Selenium.WebDriverException : unknown error: Chrome failed to start: crashed.
(chrome not reachable)
(The process started from chrome location C:\Program Files (x86)\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stack Trace:
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout)
at OpenQA.Selenium.Chrome.ChromeDriver..ctor(String chromeDriverDirectory, ChromeOptions options, TimeSpan commandTimeout)
TestLibrary\Setup.cs(56,0): at TestLibrary.Setup.LocalChromeDriver()
TestLibrary\Pages\PageBase.cs(77,0): at TestLibrary.Pages.PageBase.InitializeDriverAndWait()
TestLibrary\Pages\PageBase.cs(87,0): at TestLibrary.Pages.PageBase..ctor(Boolean navigateImmediately)
at TestLibrary.Pages.LoginPage..ctor()
TestLibrary\Actions.cs(33,0): at TestLibrary.Actions.Login(String username, String password)
TestLibrary\Fixtures\AutoFixture.cs(34,0): at TestLibrary.Fixtures.AutoFixture.Login()
TestLibrary\Fixtures\AutoFixture.cs(23,0): at TestLibrary.Fixtures.AutoFixture..ctor()
TestLibrary.Tests.Test1 [FINISHED] Time: 0s
Finished: TestLibrary