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

SessionNotCreatedException: Could not start a new session. Response code 500. Message: session not created: Microsoft Edge failed to start: was killed. #147

Closed
kagg886 opened this issue Jun 9, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@kagg886
Copy link

kagg886 commented Jun 9, 2024

I want to start edge-driver on my virtual machine(Windows 11)
make sure that the msedgedriver's version is equal to the browser's version, then i writing some code to try launch it:

val driver = EdgeDriver(EdgeDriverService.createDefaultService(), object : EdgeOptions() {
            init {
                addArguments("headless")
                addArguments("--disable-gpu")
                addArguments("lang=lang=zh_CN.UTF-8")
                setBinary(root)
            }
        })

but when i run it crash happened:(the root is right)

2024-06-09 23:23:46.064 [AWT-EventQueue-0] WARN  WelcomeViewModel - init edge driver failed:
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: session not created: Microsoft Edge failed to start: was killed.
  (session not created: DevToolsActivePort file doesn't exist)
  (The process started from msedge location C:\Users\kagg886\Desktop\cctr-desktop\driver\WINDOWS_125.0.2535.92\MicrosoftWebDriver.exe is no longer running, so msedgedriver is assuming that msedge has crashed.)
Host info: host: 'DESKTOP-N94K0PR', ip: '192.168.1.9'
Build info: version: '4.20.0', revision: '866c76ca80'
System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '21.0.3'
Driver info: org.openqa.selenium.edge.EdgeDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: MicrosoftEdge, ms:edgeOptions: {args: [headless, --disable-gpu, lang=lang=zh_CN.UTF-8], binary: C:\Users\kagg886\Desktop\cc..., extensions: []}}]}]
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:114)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:75)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:61)
        at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:162)
        at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:216)
        at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:174)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:518)
        at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:232)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:161)
        at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:114)
        at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:60)
        at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:56)
        at top.kagg886.cctr.driver.WebDriverProducer.newHeadlessDriver(WebDriverProducer.kt:17)
        at top.kagg886.cctr.driver.WebDriverDispatcher.init(WebDriverDispatcher.kt:30)
        at top.kagg886.cctr.desktop.page.welcome.WelcomeViewModel$onAction$2$1.invokeSuspend(WelcomeViewModel.kt:45)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
        at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:111)
        at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99)
        at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:585)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:802)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:706)
        at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:693)

how can i get more details and fix this bug? pls help me thk :D

@kagg886 kagg886 added the bug Something isn't working label Jun 9, 2024
@jbakeri4
Copy link

@kagg886 What version of Edge are you using? According to the Selenium documentation for EdgeDriver, the below flag should be used to start a headless session:

addArguments("--headless=new")

You might also want to set a window-size even though the browser is headless:

addArguments("--window-size=1920,1080")

@kagg886 kagg886 closed this as completed Jun 10, 2024
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

2 participants