Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

session not created: Microsoft Edge failed to start: crashed #160

Open
shanuwed opened this issue Aug 2, 2024 · 3 comments
Open

session not created: Microsoft Edge failed to start: crashed #160

shanuwed opened this issue Aug 2, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@shanuwed
Copy link

shanuwed commented Aug 2, 2024

We have a Selenium automation that works fine when used with ChromeDriver in Azure VMSS. However, when I try with EdgeDriver it crashes:

System.InvalidOperationException: session not created: Microsoft Edge failed to start: crashed.
  (session not created: DevToolsActivePort file doesn't exist)
  (The process started from msedge location C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe is no longer running, so msedgedriver is assuming that msedge has crashed.) (SessionNotCreated)
   at OpenQA.Selenium.WebDriver.UnpackAndThrowOnError(Response errorResponse, String commandToExecute)
   at OpenQA.Selenium.WebDriver.<ExecuteAsync>d__63.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.WebDriver.StartSession(ICapabilities capabilities)
   at OpenQA.Selenium.WebDriver..ctor(ICommandExecutor executor, ICapabilities capabilities)
   at OpenQA.Selenium.Chromium.ChromiumDriver..ctor(ChromiumDriverService service, ChromiumOptions options, TimeSpan commandTimeout)
   at OpenQA.Selenium.Edge.EdgeDriver..ctor(EdgeDriverService service, EdgeOptions options, TimeSpan commandTimeout)

Depending on which Options I use, the error message can be slightly different (like --remote-debugging-port=):

System.InvalidOperationException: session not created: Microsoft Edge failed to start: crashed.
  (chrome not reachable)
  (The process started from msedge location C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe is no longer running, so msedgedriver is assuming that msedge has crashed.) (SessionNotCreated)

This is the code that sets up the Options:

        private DriverOptions GetDriverOptions(Type driverType)
		{
			DriverOptions options = null;
			if (driverType == typeof(ChromeDriver)) 
			{
				options = new ChromeOptions();
                                (options as ChromeOptions).AddArgument("no-sandbox");
                                (options as ChromeOptions).AddArgument("--headless");
                                (options as ChromeOptions).AddArgument("--window-size=1920,1080");
                               (options as ChromeOptions).AddArgument("--start-maximized");
                        }
			else if (driverType == typeof(EdgeDriver))
			{
				options = new EdgeOptions();
			}
                        //... other driverTypes ...
			return options;
		}

I use Edge browser 127.0.2651.74 and the same version of Edge driver, Selenium.WebDriver 4.23.0 on Windows 2016 server. The error seems to happen in prod machine only. I have not been able to repro in other environment (not in windows 11 or non production Windows server.) I've tried these options combinations:

  1. (options as EdgeOptions).AddArgument("--remote-debugging-port=4321");
  2. (options as EdgeOptions).AddArgument("--no-sandbox"); and (options as EdgeOptions).AddArgument("--headless");
  3. (options as EdgeOptions).AddArgument("no-sandbox"); and (options as EdgeOptions).AddArgument("disable-dev-shm-usage");
    None of them worked. ChromeDriver with the options shown in the above code always works.
    Can you help?
@shanuwed shanuwed added the bug Something isn't working label Aug 2, 2024
@midland55
Copy link

midland55 commented Aug 8, 2024

Same issue a @shanuwed with Remote WebDriver session vs Edge (v127.0.2651.86)

@dmytro-makieiev
Copy link

Got similar error to @shanuwed but I am running edge in the container on the linux:
{"traceId": "54fee8d542dc2bbd09d9dc70a0761198","eventTime": 1724889889144116602,"eventName": "exception","attributes": {"driver.url": "http:\u002f\u002flocalhost:22447","exception.message": "Error while creating session with the driver service. Stopping driver service: Could not start a new session. Response code 500. Message: session not created\nfrom chrome not reachable \nHost info: host: 'e551bbeeb7d4', ip: '172.18.0.3'\nBuild info: version: '4.23.1', revision: '656257d8e9'\nSystem info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.153.1-microsoft-standard-WSL2', java.version: '17.0.12'\nDriver info: driver.version: unknown","exception.stacktrace": "org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: session not created\nfrom chrome not reachable \nHost info: host: 'e551bbeeb7d4', ip: '172.18.0.3

@kethamaheswar
Copy link

Hi @shanuwed , @midland55 , @dmytro-makieiev I am also facing same issue can you guys if you have a solution for this please tell me how to resolve this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants