Skip to content

Error: No connection to WebDriver Bidi was established – Only in Docker (CodeceptJS + Selenium Grid) #5008

Open
@myrepojuly

Description

@myrepojuly

We are encountering the following error when executing tests inside a Docker container using the selenium/standalone-chrome image.

The same tests run without any issue locally:

Error: No connection to WebDriver Bidi was established
...
Error: connect ETIMEDOUT 172.17.0.2:4444

Environment Details:

Node.js Version: 22.15.0
CodeceptJS Version: ^3.7.3
WebdriverIO Version: ^9.15.0
Docker Image: selenium/standalone-chrome:134.0.6998.165-20250525

Docker Command Used:

docker run -d -p 4444:4444 -p 7900:7900 --shm-size="2g" selenium/standalone-chrome:134.0.6998.165-20250525

Config:

export const config: CodeceptJS.MainConfig = {
  tests: './*test.ts',
  output: './output',
  helpers: {
    WebDriver: {
      url: 'https://github.com',
      host: 'localhost',
      port: 4444,
      path: '/wd/hub',
      browser: 'chrome',
    }
  },
  include: {
    I: './steps_file'
  },
  name: 'codeceptjs_Check'
}

Docker Logs Show Successful Session Creation:
The Selenium logs indicate that the WebSocket URL is exposed correctly:

se:gridWebSocketUrl: ws://localhost:26046/session/...
webSocketUrl: ws://172.17.0.2:4444/session/...

Additional Details:
The hub status was 'Ready' before the tests were executed

node_modules\mocha\lib\runner.js:961
    throw err;
    ^

Error: connect ETIMEDOUT 172.17.0.2:4444
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1636:16)
Emitted 'error' event on WebSocket instance at:
    at emitErrorAndClose (\node_modules\webdriver\node_modules\ws\lib\websocket.js:1041:13)
    at ClientRequest.<anonymous> (\node_modules\webdriver\node_modules\ws\lib\websocket.js:881:5)
    at ClientRequest.emit (node:events:518:28)
    at ClientRequest.emit (node:domain:489:12)
    at emitErrorEvent (node:_http_client:104:11)
    at Socket.socketErrorListener (node:_http_client:518:5)
    at Socket.emit (node:events:518:28)
    at Socket.emit (node:domain:489:12)
    at emitErrorNT (node:internal/streams/destroy:170:8)
    at emitErrorCloseNT (node:internal/streams/destroy:129:3) {
  errno: -4039,
  code: 'ETIMEDOUT',
  syscall: 'connect',
  address: '172.17.0.2',
  port: 4444
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions