How can we define container parameters for Selenium dynamic grid?

29 Views Asked by At

We just start using Dynamic Grid.
While running with the following configuration especially the screen resolution - chrome driver crashes.
But while removing the screen resolution we are able to run without any issues.
I assume this is related to the shm_size container parameter.
The new container receives default value of shm_size which is not enought.
How can I define shm_size container parameter for dynamically created container?

The configurations are:
docker compose file:

version: "3"
services:
  selenium-docker:
    image: selenium/standalone-docker:4.9.0-20230421
    shm_size: "8gb"
    ports:
      - "4444:4444"
    volumes:
      - /dev/shm:/dev/shm
      - ${PWD}/config.toml:/opt/bin/config.toml
      - ${PWD}/assets:/opt/selenium/assets
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - SE_EVENT_BUS_HOST=selenium-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
      - SE_VNC_NO_PASSWORD=1
      - SE_JAVA_OPTS=-Xmx512m

config.toml file:

[node]
detect-drivers = false
max-sessions = 100

[docker]
# Configs have a mapping between the Docker image to use and the capabilities that need to be matched to
# start a container with the given image.

configs = [
    "selenium/standalone-chrome:112.0-chromedriver-112.0-grid-4.9.0-20230421", '{"browserName": "chrome"}'
]

# URL for connecting to the docker daemon
# Most simple approach, leave it as http://127.0.0.1:2375, and mount /var/run/docker.sock.
# 127.0.0.1 is used because internally the container uses socat when /var/run/docker.sock is mounted
# If var/run/docker.sock is not mounted:
# Windows: make sure Docker Desktop exposes the daemon via tcp, and use http://host.docker.internal:2375.
# macOS: install socat and run the following command, socat -4 TCP-LISTEN:2375,fork UNIX-CONNECT:/var/run/docker.sock,
# then use http://host.docker.internal:2375.
# Linux: varies from machine to machine, please mount /var/run/docker.sock. If this does not work, please create an issue.
url = "http://127.0.0.1:2375"
# Docker image used for video recording
video-image = "selenium/video:ffmpeg-6.1-20240224"

# Uncomment the following section if you are running the node on a separate VM
# Fill out the placeholders with appropriate values
#[server]
#host = <ip-from-node-machine>
#port = <port-from-node-machine>

Driver chrome capabilities:

chromeOptions.setCapability("se:recordVideo", true);
chromeOptions.setCapability("se:timeZone", "US/Pacific");
chromeOptions.setCapability("se:screenResolution", "1920x1200");
0

There are 0 best solutions below