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

[🐛 Bug]:When Run In Docker, I Get This: SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. #15104

Closed
flychmove opened this issue Jan 17, 2025 · 2 comments

Comments

@flychmove
Copy link

What happened?

When I run a selenium jar in the docker container, the new ChromeDriver() function can not run in its way, and i get this error.
And the code can run successfully in the host computer.
How can I fix it?

the wrong message:
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Host info: host: 'auto-test-59cdb8b5f4-rskcf', ip: '10.233.107.152'
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:563)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:245)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:174)
at org.openqa.selenium.chromium.ChromiumDriver.(ChromiumDriver.java:114)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:88)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:83)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:72)
at com.fmsh.test.testng.AbstractBaseTest.setUpDriver(AbstractBaseTest.java:233)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)
at org.testng.internal.invokers.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:69)
at org.testng.internal.invokers.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:393)
at org.testng.internal.invokers.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:326)
at org.testng.TestRunner.invokeTestConfigurations(TestRunner.java:661)
at org.testng.TestRunner.beforeRun(TestRunner.java:650)
at org.testng.TestRunner.run(TestRunner.java:612)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:443)
at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:481)
at org.testng.internal.thread.ThreadUtil.lambda$execute$0(ThreadUtil.java:58)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: org.openqa.selenium.WebDriverException: Driver server process died prematurely.
Build info: version: '4.27.0', revision: 'd6e718d134'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.0-195-generic', java.version: '21.0.5'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:246)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:117)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:545)
... 23 more

How can we reproduce the issue?

make a simple code to jar, and run it in the docker container

Relevant log output

org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Host info: host: 'auto-test-59cdb8b5f4-rskcf', ip: '10.233.107.152'
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:563)
        at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:245)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:174)
        at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:114)
        at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:88)
        at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:83)
        at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:72)
        at com.fmsh.test.testng.AbstractBaseTest.setUpDriver(AbstractBaseTest.java:233)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139)
        at org.testng.internal.invokers.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:69)
        at org.testng.internal.invokers.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:393)
        at org.testng.internal.invokers.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:326)
        at org.testng.TestRunner.invokeTestConfigurations(TestRunner.java:661)
        at org.testng.TestRunner.beforeRun(TestRunner.java:650)
        at org.testng.TestRunner.run(TestRunner.java:612)
        at org.testng.SuiteRunner.runTest(SuiteRunner.java:443)
        at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:481)
        at org.testng.internal.thread.ThreadUtil.lambda$execute$0(ThreadUtil.java:58)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: org.openqa.selenium.WebDriverException: Driver server process died prematurely.
Build info: version: '4.27.0', revision: 'd6e718d134'
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.0-195-generic', java.version: '21.0.5'
Driver info: driver.version: ChromeDriver
        at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:246)
        at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:117)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:545)
        ... 23 more

Operating System

docker of ubuntu

Selenium version

4.27.0

What are the browser(s) and version(s) where you see this issue?

chrome 132 by selenium manager

What are the browser driver(s) and version(s) where you see this issue?

chromeDriver 132 by selenium manager

Are you using Selenium Grid?

no

Copy link

@flychmove, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@flychmove flychmove changed the title [🐛 Bug]: [🐛 Bug]:When Run In Docker, I Get This: SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. Jan 17, 2025
@diemol
Copy link
Member

diemol commented Jan 17, 2025

You need to install a display and a window manager to have it working. Something like Xvfb and Fluxbox. You can check https://github.com/SeleniumHQ/docker-selenium for guidance.

@diemol diemol closed this as not planned Won't fix, can't repro, duplicate, stale Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants