Selenium 网格 4:无法启动新会话。可能原因是远程服务器地址无效或浏览器启动失败错误

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

尝试使用以下 docker-compose 文件设置 selenium 4 网格,但收到“无法启动新会话。可能的原因是远程服务器或浏览器的地址无效启动失败”错误,需要一些帮助来修复它。

docker-编写文件:

# 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"

运行 命令:

mvn clean install

这将通过 testing.xml 文件中提到的测试运行程序触发一个黄瓜测试场景的执行。

看起来设置已经基本完成,日志在这里:

    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[=12=]] - 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[=12=]] - No network connection, guessing name: 9d9b6ded1846
selenium-sessions       | 21:02:28.624 INFO [BaseServerOptions.lambda$getExternalUri[=12=]] - 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[=12=]] - No network connection, guessing name: 8885bd19bf09
chrome_1                | 21:02:32.908 INFO [BaseServerOptions.lambda$getExternalUri[=12=]] - 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[=12=]] - 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[=12=]] - 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[=12=]] - 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.start] - Starting registration process for node id adb8ff56-c40d-4d5b-8298-01df3135a951
selenium-router         | 21:02:51.758 INFO [BaseServerOptions.lambda$getExternalUri[=12=]] - 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.lambda$start] - 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.lambda$start] - Sending registration event...
chrome_1                | 21:03:11.927 INFO [NodeServer.lambda$start] - Sending registration event...

在 运行 一次测试中完成错误日志:

 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.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.resolveInstance(BasicComponentParameter.java:118)
        at org.picocontainer.parameters.ComponentParameter.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.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.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[=13=](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.lambda$createClient(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

或者,当我尝试打开集线器 url 时,我得到以下信息:

这是调用远程驱动程序对象的方式。

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

笔记本电脑配置: Mac m1 512GB

我怎样才能解决这个问题?

根据 this 问题,目前尚不支持 M1 架构,在他们提供之前,该问题将会出现。