-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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