Search code examples
selenium-webdriverselenium-gridapple-m1selenium4selenium-docker

Selenium grid 4 : Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure error


Trying to set up selenium 4 grid with the below docker-compose file but getting the "Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure" error and need some help to fix the same.

docker-compose file:

# To execute this docker-compose yml file use `docker-compose -f docker-compose-v3-full-grid.yml up`
# Add the `-d` flag at the end for detached execution
# To stop the execution, hit Ctrl+C, and then `docker-compose -f docker-compose-v3-full-grid.yml down`
version: "3"
services:
  selenium-event-bus:
    image: selenium/event-bus:4.0.0-20211013
    container_name: selenium-event-bus
    ports:
      - "4442:4442"
      - "4443:4443"
      - "5557:5557"

  selenium-sessions:
    image: selenium/sessions:4.0.0-20211013
    container_name: selenium-sessions
    ports:
      - "5556:5556"
    depends_on:
      - selenium-event-bus
    environment:
      - SE_EVENT_BUS_HOST=selenium-event-bus
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443

  selenium-session-queue:
    image: selenium/session-queue:4.0.0-20211013
    container_name: selenium-session-queue
    ports:
      - "5559:5559"
    depends_on:
      - selenium-event-bus
    environment:
      - SE_EVENT_BUS_HOST=selenium-event-bus
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443

  selenium-distributor:
    image: selenium/distributor:4.0.0-20211013
    container_name: selenium-distributor
    ports:
      - "5553:5553"
    depends_on:
      - selenium-event-bus
      - selenium-sessions
      - selenium-session-queue
    environment:
      - SE_EVENT_BUS_HOST=selenium-event-bus
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
      - SE_SESSIONS_MAP_HOST=selenium-sessions
      - SE_SESSIONS_MAP_PORT=5556
      - SE_SESSION_QUEUE_HOST=selenium-session-queue
      - SE_SESSION_QUEUE_PORT=5559

  selenium-router:
    image: selenium/router:4.0.0-20211013
    container_name: selenium-router
    ports:
      - "4444:4444"
    depends_on:
      - selenium-distributor
      - selenium-sessions
      - selenium-session-queue
    environment:
      - SE_DISTRIBUTOR_HOST=selenium-distributor
      - SE_DISTRIBUTOR_PORT=5553
      - SE_SESSIONS_MAP_HOST=selenium-sessions
      - SE_SESSIONS_MAP_PORT=5556
      - SE_SESSION_QUEUE_HOST=selenium-session-queue
      - SE_SESSION_QUEUE_PORT=5559

  chrome:
    image: selenium/node-chrome:4.0.0-20211013
    shm_size: 2gb
    depends_on:
      - selenium-event-bus
    environment:
      - SE_EVENT_BUS_HOST=selenium-event-bus
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
    ports:
      - "6900:5900"

Run command:

mvn clean install

This will trigger the execution of one cucumber test scenario thru the test runner mentioned in the testing.xml file.

It looks like the setup is pretty much completed and the logs here:

    0.3s
dhamo@Dhamo-Mac expressqa_ecom_web % docker-compose -f docker-compose-v3-full-grid.yml up  
[+] Running 7/7
 ⠿ Network expressqa_ecom_web_default     Created                                                                                                             0.1s
 ⠿ Container selenium-event-bus           Started                                                                                                             3.5s
 ⠿ Container expressqa_ecom_web_chrome_1  Started                                                                                                             5.3s
 ⠿ Container selenium-session-queue       Started                                                                                                             4.7s
 ⠿ Container selenium-sessions            Started                                                                                                             5.2s
 ⠿ Container selenium-distributor         Started                                                                                                             5.6s
 ⠿ Container selenium-router              Started                                                                                                             6.4s
Attaching to chrome_1, selenium-distributor, selenium-event-bus, selenium-router, selenium-session-queue, selenium-sessions
selenium-distributor    | 2021-10-18 21:02:16,505 INFO spawned: 'selenium-grid-distributor' with pid 20
selenium-distributor    | Starting Selenium Grid Distributor...
selenium-distributor    | 2021-10-18 21:02:16,682 INFO success: selenium-grid-distributor entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
selenium-router         | 2021-10-18 21:02:17,426 INFO Included extra file "/etc/supervisor/conf.d/selenium-grid-router.conf" during parsing
selenium-router         | 2021-10-18 21:02:17,434 INFO supervisord started with pid 12
chrome_1                | Configuring server...
chrome_1                | Setting up SE_NODE_HOST...
chrome_1                | Setting up SE_NODE_PORT...
chrome_1                | Setting up SE_NODE_GRID_URL...
selenium-router         | 2021-10-18 21:02:18,447 INFO spawned: 'selenium-grid-router' with pid 18
selenium-router         | Starting Selenium Grid Router...
selenium-router         | 2021-10-18 21:02:18,607 INFO success: selenium-grid-router entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
chrome_1                | Selenium Grid Node configuration: 
chrome_1                | [events]
chrome_1                | publish = "tcp://selenium-event-bus:4442"
chrome_1                | subscribe = "tcp://selenium-event-bus:4443"
chrome_1                | 
chrome_1                | [node]
chrome_1                | session-timeout = "300"
chrome_1                | override-max-sessions = false
chrome_1                | detect-drivers = false
chrome_1                | max-sessions = 1
chrome_1                | 
chrome_1                | [[node.driver-configuration]]
chrome_1                | display-name = "chrome"
chrome_1                | stereotype = '{"browserName": "chrome", "browserVersion": "94.0", "platformName": "Linux"}'
chrome_1                | max-sessions = 1
chrome_1                | 
chrome_1                | Starting Selenium Grid Node...
selenium-event-bus      | 21:02:19.503 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
selenium-session-queue  | 21:02:19.845 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
selenium-event-bus      | 21:02:20.194 INFO [BoundZmqEventBus.<init>] - XPUB binding to [binding to tcp://*:4442, advertising as tcp://172.24.0.2:4442], XSUB binding to [binding to tcp://*:4443, advertising as tcp://172.24.0.2:4443]
selenium-sessions       | 21:02:20.568 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
selenium-sessions       | 21:02:20.828 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
selenium-event-bus      | 21:02:21.517 INFO [UnboundZmqEventBus.<init>] - Connecting to tcp://172.24.0.2:4442 and tcp://172.24.0.2:4443
selenium-event-bus      | 21:02:22.199 INFO [UnboundZmqEventBus.<init>] - Sockets created
selenium-sessions       | 21:02:22.602 INFO [UnboundZmqEventBus.<init>] - Connecting to tcp://selenium-event-bus:4442 and tcp://selenium-event-bus:4443
selenium-event-bus      | 21:02:23.238 INFO [UnboundZmqEventBus.<init>] - Event bus ready
selenium-session-queue  | 21:02:23.839 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
selenium-distributor    | 21:02:23.759 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
selenium-sessions       | 21:02:23.971 INFO [UnboundZmqEventBus.<init>] - Sockets created
selenium-distributor    | 21:02:23.987 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
selenium-sessions       | 21:02:25.028 INFO [UnboundZmqEventBus.<init>] - Event bus ready
selenium-session-queue  | 21:02:25.443 INFO [UnboundZmqEventBus.<init>] - Connecting to tcp://selenium-event-bus:4442 and tcp://selenium-event-bus:4443
selenium-distributor    | 21:02:25.711 INFO [UnboundZmqEventBus.<init>] - Connecting to tcp://selenium-event-bus:4442 and tcp://selenium-event-bus:4443
selenium-router         | 21:02:25.948 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
selenium-router         | 21:02:26.012 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
selenium-session-queue  | 21:02:26.349 INFO [UnboundZmqEventBus.<init>] - Sockets created
selenium-distributor    | 21:02:26.883 INFO [UnboundZmqEventBus.<init>] - Sockets created
selenium-event-bus      | 21:02:27.149 INFO [BaseServerOptions.lambda$getExternalUri$0] - No network connection, guessing name: 13687f81574b
selenium-session-queue  | 21:02:27.419 INFO [UnboundZmqEventBus.<init>] - Event bus ready
selenium-event-bus      | 21:02:27.508 WARN [MacAddressUtil.defaultMachineId] - Failed to find a usable hardware address from the network interfaces; using random bytes: c4:5c:a7:6e:6e:8d:0a:e3
selenium-distributor    | 21:02:27.932 INFO [UnboundZmqEventBus.<init>] - Event bus ready
chrome_1                | 21:02:28.316 INFO [LoggingOptions.configureLogEncoding] - Using the system default encoding
chrome_1                | 21:02:28.394 INFO [OpenTelemetryTracer.createTracer] - Using OpenTelemetry for tracing
selenium-event-bus      | 21:02:28.417 INFO [EventBusCommand.execute] - Started Selenium EventBus 4.0.0 (revision 3a21814679): http://13687f81574b:5557
selenium-session-queue  | 21:02:28.435 INFO [BaseServerOptions.lambda$getExternalUri$0] - No network connection, guessing name: 9d9b6ded1846
selenium-sessions       | 21:02:28.624 INFO [BaseServerOptions.lambda$getExternalUri$0] - No network connection, guessing name: 7dbac3cddaa7
selenium-session-queue  | 21:02:28.872 WARN [MacAddressUtil.defaultMachineId] - Failed to find a usable hardware address from the network interfaces; using random bytes: 28:9e:a1:e5:f8:f2:8f:d6
selenium-sessions       | 21:02:28.929 WARN [MacAddressUtil.defaultMachineId] - Failed to find a usable hardware address from the network interfaces; using random bytes: 83:83:18:81:93:d2:80:1b
selenium-sessions       | 21:02:29.453 INFO [SessionMapServer.execute] - Started Selenium SessionMap 4.0.0 (revision 3a21814679): http://7dbac3cddaa7:5556
selenium-session-queue  | 21:02:29.551 INFO [NewSessionQueueServer.execute] - Started Selenium SessionQueue 4.0.0 (revision 3a21814679): http://9d9b6ded1846:5559
chrome_1                | 21:02:29.976 INFO [UnboundZmqEventBus.<init>] - Connecting to tcp://selenium-event-bus:4442 and tcp://selenium-event-bus:4443
chrome_1                | 21:02:30.655 INFO [UnboundZmqEventBus.<init>] - Sockets created
chrome_1                | 21:02:31.736 INFO [UnboundZmqEventBus.<init>] - Event bus ready
selenium-router         | 21:02:32.709 INFO [BaseServerOptions.lambda$getExternalUri$0] - No network connection, guessing name: 8885bd19bf09
chrome_1                | 21:02:32.908 INFO [BaseServerOptions.lambda$getExternalUri$0] - No network connection, guessing name: 8646325b6e37
chrome_1                | 21:02:32.943 INFO [NodeServer.createHandlers] - Reporting self as: http://8646325b6e37:5555
chrome_1                | 21:02:32.989 INFO [BaseServerOptions.lambda$getExternalUri$0] - No network connection, guessing name: 8646325b6e37
chrome_1                | 21:02:33.441 INFO [NodeOptions.getSessionFactories] - Detected 4 available processors
selenium-distributor    | 21:02:33.943 INFO [BaseServerOptions.lambda$getExternalUri$0] - No network connection, guessing name: d8e53d166441
selenium-distributor    | 21:02:35.974 WARN [MacAddressUtil.defaultMachineId] - Failed to find a usable hardware address from the network interfaces; using random bytes: e1:2b:2f:38:b2:02:67:c4
chrome_1                | 21:02:36.783 INFO [NodeOptions.report] - Adding chrome for {"browserVersion": "94.0","browserName": "chrome","platformName": "Linux","se:vncEnabled": true} 1 times
selenium-distributor    | 21:02:45.369 INFO [DistributorServer.execute] - Started Selenium Distributor 4.0.0 (revision 3a21814679): http://d8e53d166441:5553
chrome_1                | 21:02:46.857 INFO [Node.<init>] - Binding additional locator mechanisms: id, name, relative
selenium-distributor    | /opt/bin/start-selenium-grid-distributor.sh: line 66:    24 Killed                  java ${JAVA_OPTS} -jar /opt/selenium/selenium-server.jar distributor --sessions-host "${SE_SESSIONS_MAP_HOST}" --sessions-port "${SE_SESSIONS_MAP_PORT}" --sessionqueue-host "${SE_SESSION_QUEUE_HOST}" --sessionqueue-port "${SE_SESSION_QUEUE_PORT}" --publish-events tcp://"${SE_EVENT_BUS_HOST}":"${SE_EVENT_BUS_PUBLISH_PORT}" --subscribe-events tcp://"${SE_EVENT_BUS_HOST}":"${SE_EVENT_BUS_SUBSCRIBE_PORT}" --bind-bus false ${HOST_CONFIG} ${PORT_CONFIG} ${SE_OPTS}
selenium-distributor    | 2021-10-18 21:02:50,661 INFO exited: selenium-grid-distributor (exit status 137; not expected)
chrome_1                | 21:02:51.371 INFO [BaseServerOptions.lambda$getExternalUri$0] - No network connection, guessing name: 8646325b6e37
chrome_1                | 21:02:51.513 WARN [MacAddressUtil.defaultMachineId] - Failed to find a usable hardware address from the network interfaces; using random bytes: 9f:65:82:c3:22:f7:b7:d4
chrome_1                | 21:02:51.757 INFO [NodeServer$1.start] - Starting registration process for node id adb8ff56-c40d-4d5b-8298-01df3135a951
selenium-router         | 21:02:51.758 INFO [BaseServerOptions.lambda$getExternalUri$0] - No network connection, guessing name: 8885bd19bf09
chrome_1                | 21:02:51.769 INFO [NodeServer.execute] - Started Selenium node 4.0.0 (revision 3a21814679): http://8646325b6e37:5555
chrome_1                | 21:02:51.797 INFO [NodeServer$1.lambda$start$1] - Sending registration event...
selenium-router         | 21:02:52.642 WARN [MacAddressUtil.defaultMachineId] - Failed to find a usable hardware address from the network interfaces; using random bytes: 74:60:3b:79:d9:3b:52:1e
selenium-router         | 21:02:52.800 INFO [RouterServer.execute] - Started Selenium Router 4.0.0 (revision 3a21814679): http://8885bd19bf09:4444
chrome_1                | 21:03:01.893 INFO [NodeServer$1.lambda$start$1] - Sending registration event...
chrome_1                | 21:03:11.927 INFO [NodeServer$1.lambda$start$1] - Sending registration event...

Complete error logs while running one test:

 org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'Dhamo-Mac.local', ip: 'fe80:0:0:0:84c:43e7:38de:c02b%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '11.6', java.version: '11.0.12'
Driver info: driver.version: RemoteWebDriver
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:573)
        at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:144)
        at core.DriverManager.createRemoteDriver(DriverManager.java:82)
        at core.DriverManager.createDriver(DriverManager.java:44)
        at core.DriverManager.getDriver(DriverManager.java:34)
        at core.CoreBase.<init>(CoreBase.java:10)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at org.picocontainer.injectors.AbstractInjector.newInstance(AbstractInjector.java:145)
        at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:342)
        at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
        at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
        at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
        at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
        at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
        at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
        at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
        at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
        at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
        at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
        at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
        at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)
        at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)
        at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
        at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
        at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
        at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
        at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
        at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
        at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
        at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:678)
        at io.cucumber.picocontainer.PicoFactory.getInstance(PicoFactory.java:49)
        at io.cucumber.java.AbstractGlueDefinition.invokeMethod(AbstractGlueDefinition.java:47)
        at io.cucumber.java.JavaHookDefinition.execute(JavaHookDefinition.java:59)
        at io.cucumber.core.runner.CoreHookDefinition.execute(CoreHookDefinition.java:46)
        at io.cucumber.core.runner.HookDefinitionMatch.runStep(HookDefinitionMatch.java:21)
        at io.cucumber.core.runner.ExecutionMode$1.execute(ExecutionMode.java:10)
        at io.cucumber.core.runner.TestStep.executeStep(TestStep.java:92)
        at io.cucumber.core.runner.TestStep.run(TestStep.java:64)
        at io.cucumber.core.runner.TestCase.run(TestCase.java:110)
        at io.cucumber.core.runner.Runner.runPickle(Runner.java:73)
        at io.cucumber.testng.TestNGCucumberRunner.lambda$runScenario$0(TestNGCucumberRunner.java:117)
        at io.cucumber.core.runtime.CucumberExecutionContext.runTestCase(CucumberExecutionContext.java:117)
        at io.cucumber.testng.TestNGCucumberRunner.runScenario(TestNGCucumberRunner.java:114)
        at io.cucumber.testng.AbstractTestNGCucumberTests.runScenario(AbstractTestNGCucumberTests.java:31)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133)
        at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:598)
        at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173)
        at org.testng.internal.TestMethodWithDataProviderMethodWorker.call(TestMethodWithDataProviderMethodWorker.java:77)
        at org.testng.internal.TestMethodWithDataProviderMethodWorker.call(TestMethodWithDataProviderMethodWorker.java:15)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.io.IOException: unexpected end of stream on Connection{localhost:4444, proxy=DIRECT hostAddress=localhost/0:0:0:0:0:0:0:1:4444 cipherSuite=none protocol=http/1.1}
        at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:208)
        at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:88)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at org.openqa.selenium.remote.internal.OkHttpClient$Factory$1.lambda$createClient$1(OkHttpClient.java:152)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
        at okhttp3.RealCall.execute(RealCall.java:77)
        at org.openqa.selenium.remote.internal.OkHttpClient.execute(OkHttpClient.java:103)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:105)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:74)
        at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
        ... 63 more
Caused by: java.io.EOFException: \n not found: limit=0 content=…
        at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:237)
        at okhttp3.internal.http1.Http1Codec.readHeaderLine(Http1Codec.java:215)
        at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:189)
        ... 86 more

Alternatively, when I try to open the hub url, I get the following: enter image description here

It's how the remote driver object gets called.

case CHROME:
            ChromeOptions options = getChromeOptions();
            try {
                driver = new RemoteWebDriver(new URL("http://localhost:4444"), options);
            } catch (MalformedURLException e) {
                e.printStackTrace();
            }

Laptop config: Mac m1 512GB

How can I possibly get rid of the issue?


Solution

  • As of January 20th, 2022, Selenium container images are built and published on Docker Hub for armhf, arm64, and amd64 architectures. They're multi-arch images, so they run on all 3 of these platforms.

    This allows developers and testers using Mac M1/M2 aarch64 (arm64) machines to run Selenium Grids in Docker, as well as older Raspberry Pi users whose architectures match armhf (armv7l).

    The source can be found on GitHub in the docker-seleniarm fork of docker-selenium. See the README for more details.

    Disclaimer: I am the maintainer of this open source fork.