SeleniumHQ / SeleniumHQ/docker-selenium

[🐛 Bug]:Use dynamic grid error

Open
#2,895 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs-triaging
Dominant language
Go
Stars
8.7k
Forks
2.5k
Avg merge
10h 16m
Merged PRs (30d)
20

Description

What happened?

use dynamic grid error ,i use nodedocker to create a node that build only for webdriver

my config :
`services:
#==================

Selenium Hub

#==================
selenium-hub:
image: selenium/hub:latest
container_name: selenium-hub
ports:
- "4442:4442"
- "4443:4443"
- "4444:4444"
environment:
# - SE_LOG_LEVEL=DEBUG
- SE_NODE_SESSION_TIMEOUT=100
- SE_SESSION_REQUEST_TIMEOUT=30
- SE_ENABLE_TRACING=true
- SE_LOG_LEVEL=DEBUG
# volumes:
# # 挂载Hub配置文件
# - ./config/grid-config.toml:/opt/selenium/config.toml:ro
networks:
- selenium-grid

#==================

Node-Docker (直接使用宿主机Docker)

#==================
node-docker:
image: selenium/node-docker:latest
container_name: selenium-node-docker
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
- SE_NODE_DOCKER_CONFIG_FILENAME=docker.toml
# - SE_ENABLE_TRACING=true
# - SE_LOG_LEVEL=DEBUG
volumes:
- ./assets:/opt/selenium/assets
- /var/run/docker.sock:/var/run/docker.sock
- ./config/node-docker-config.toml:/opt/selenium/docker.toml
privileged: true
depends_on:
- selenium-hub
networks:
- selenium-grid

#==================

Portainer (可选 - Docker管理界面)

#==================
portainer:
image: portainer/portainer-ce:latest
container_name: portainer
ports:
- "9000:9000"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- portainer-data:/data
networks:
- selenium-grid
restart: unless-stopped

#==================

网络配置

#==================
networks:
selenium-grid:
driver: bridge

#==================

数据卷

#==================
volumes:
portainer-data: `

Command used to start Selenium Grid with Docker (or Kubernetes)
this is my chromedirver file :
FROM selenium/node-base:4.33.0-20250606

USER root

#==================
# 安装基础依赖包
#------------------
# ca-certificates - SSL 客户端
# curl - 数据传输工具
# wget - 网络下载工具
# unzip - 解压工具
# adb - Android Debug Bridge
# xvfb - X virtual framebuffer
# fonts-liberation - 字体库
#==================
RUN apt-get update && apt-get install -y \
    ca-certificates \
    curl \
    wget \
    unzip \
    android-tools-adb \
    xvfb \
    fonts-liberation \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

#==================
# 注意:此节点仅安装 ChromeDriver,不安装 Chrome 浏览器
# 主要用于 Android WebView 和远程 Chrome 实例的自动化测试
#==================

#==================
# 使用本地 ChromeDriver 文件
#==================
ENV CHROMEDRIVER_VERSION=128.0.6613.0
RUN mkdir -p /opt/chromedriver
COPY node/chromedriver-128/chromedriver /opt/chromedriver/chromedriver
RUN chmod +x /opt/chromedriver/chromedriver

#==================
# 设置环境变量
#==================
ENV PATH="/opt/chromedriver:${PATH}"
ENV DISPLAY=:99
ENV CHROMEDRIVER_BIN=/opt/chromedriver/chromedriver

#==================
# 创建必要的目录和权限
#==================
RUN mkdir -p /tmp/.X11-unix \
    && chmod 1777 /tmp/.X11-unix \
    && mkdir -p /home/seluser/.android \
    && chown -R seluser:seluser /home/seluser/.android

#==================
# 复制配置文件
#==================
COPY node/node_config/chromedriver-node.toml /opt/selenium/chromedriver-node.toml

#==================
# 切换到 selenium 用户
#==================
USER seluser

#==================
# 设置工作目录
#==================
WORKDIR /home/seluser

#==================
# 健康检查
#==================
HEALTHCHECK --interval=15s --timeout=30s --start-period=5s --retries=3 \
    CMD curl -sSL http://localhost:5555/status || exit 1

#==================
# 启动脚本
#==================
COPY node/chromedriver-entrypoint.sh /opt/bin/chromedriver-entrypoint.sh
USER root
RUN chmod +x /opt/bin/chromedriver-entrypoint.sh
USER seluser

ENTRYPOINT ["/opt/bin/chromedriver-entrypoint.sh"]
Relevant log output
`2025-07-11 21:00:05.636 | ERROR    | __main__:connect_remote:507 - RemoteWebDriver 创建失败: Message: Could not start a new session. New session request timed out
Build info: version: '4.1.1', revision: 'e8fcc2cecf'
System info: host: '2d098ea37739', ip: '172.18.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-140-generic', java.version: '11.0.13'
Driver info: driver.version: unknown
Stacktrace:
    at org.openqa.selenium.grid.sessionqueue.local.LocalNewSessionQueue.addToQueue (LocalNewSessionQueue.java:202)
    at org.openqa.selenium.grid.sessionqueue.NewSessionQueue.lambda$new$0 (NewSessionQueue.java:68)
    at org.openqa.selenium.remote.http.Route$TemplatizedRoute.handle (Route.java:192)
    at org.openqa.selenium.remote.http.Route.execute (Route.java:68)
    at org.openqa.selenium.remote.http.Route$CombinedRoute.handle (Route.java:336)
    at org.openqa.selenium.remote.http.Route.execute (Route.java:68)
    at org.openqa.selenium.grid.sessionqueue.NewSessionQueue.execute (NewSessionQueue.java:120)
    at org.openqa.selenium.remote.tracing.SpanWrappedHttpHandler.execute (SpanWrappedHttpHandler.java:86)
    at org.openqa.selenium.remote.http.Filter$1.execute (Filter.java:64)
    at org.openqa.selenium.remote.http.Route$CombinedRoute.handle (Route.java:336)
    at org.openqa.selenium.remote.http.Route.execute (Route.java:68)
    at org.openqa.selenium.grid.router.Router.execute (Router.java:91)
    at org.openqa.selenium.grid.web.EnsureSpecCompliantResponseHeaders.lambda$apply$0 (EnsureSpecCompliantResponseHeaders.java:34)
    at org.openqa.selenium.remote.http.Filter$1.execute (Filter.java:64)
    at org.openqa.selenium.remote.http.Route$CombinedRoute.handle (Route.java:336)
    at org.openqa.selenium.remote.http.Route.execute (Route.java:68)
    at org.openqa.selenium.remote.http.Route$NestedRoute.handle (Route.java:270)
    at org.openqa.selenium.remote.http.Route.execute (Route.java:68)
    at org.openqa.selenium.remote.http.Route$CombinedRoute.handle (Route.java:336)
    at org.openqa.selenium.remote.http.Route.execute (Route.java:68)
    at org.openqa.selenium.remote.http.Route$CombinedRoute.handle (Route.java:336)
    at org.openqa.selenium.remote.http.Route.execute (Route.java:68)
    at org.openqa.selenium.remote.AddWebDriverSpecHeaders.lambda$apply$0 (AddWebDriverSpecHeaders.java:35)
    at org.openqa.selenium.remote.ErrorFilter.lambda$apply$0 (ErrorFilter.java:44)
    at org.openqa.selenium.remote.http.Filter$1.execute (Filter.java:64)
    at org.openqa.selenium.remote.ErrorFilter.lambda$apply$0 (ErrorFilter.java:44)
    at org.openqa.selenium.remote.http.Filter$1.execute (Filter.java:64)
    at org.openqa.selenium.netty.server.SeleniumHandler.lambda$channelRead0$0 (SeleniumHandler.java:44)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:515)
    at java.util.concurrent.FutureTask.run (FutureTask.java:264)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1128)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:628)
    at java.lang.Thread.run (Thread.java:829)`
Operating System

linux

Docker Selenium version (image tag)

4.33.0-20250606

Selenium Grid chart version (chart version)

4.33.0-20250606

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied Docker Compose configuration and Dockerfile, then inspect chromedriver-node.toml and chromedriver-entrypoint.sh alongside the Grid logs. Reproduce the session request timeout using the stated 4.33.0-20250606 images and verify node registration, readiness, and driver startup; done means the custom node can create a WebDriver session reliably.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, linux
Domain
devops, distributed-systems, infrastructure, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.