Selenium- Docker Infrastructure - Unable to establish an Selenium Grid with Edge Image

1.1k Views Asked by At

I am trying to set up an Selenium Grid to run test in Edge Browser. I am trying to set this up in my local Mac OS machine and if all is good, I will set it up in the Build machine.

The issue I am facing is the Selenium Node ( Edge Image ) not able to communicate with the Selenium hub The edge image is the latest ( https://hub.docker.com/r/selenium/node-edge ) as well as the selenium hub ( https://hub.docker.com/r/selenium/hub )

The remaining nodes are getting connected and I am able to see that in the console.

enter image description here

I logged into the docker container of selenium hub and did a ping to the Edge Node and I am able to see that it is pinging. The port 4444 is open and all is good.

enter image description here

I also did the other way round as in logged into the Edge Node and Pinged selenium hub and all is well. The port 5555 is also open for connections

enter image description here

But the unfortunate thing is, the connection is not getting established between the Node Edge image and Selenium hub.

Quite clueless here as this is an off the shelf solution. Did any one face an issue like this ??

edge_1          | 18:20:41.252 INFO [NodeServer$1.lambda$start$1] - Sending registration event...
edge_1          | 18:20:51.226 INFO [NodeServer$1.lambda$start$1] - Sending registration event...
edge_1          | 18:21:01.229 INFO [NodeServer$1.lambda$start$1] - Sending registration event...
edge_1          | 18:21:11.231 INFO [NodeServer$1.lambda$start$1] - Sending registration event...
edge_1          | 18:21:21.199 INFO [NodeServer$1.lambda$start$1] - Sending registration event...
edge_1          | 18:21:31.201 INFO [NodeServer$1.lambda$start$1] - Sending registration event...
edge_1          | 18:21:41.203 INFO [NodeServer$1.lambda$start$1] - Sending registration event...
edge_1          | 18:21:51.171 INFO [NodeServer$1.lambda$start$1] - Sending registration event...
edge_1          | 18:22:01.173 INFO [NodeServer$1.lambda$start$1] - Sending registration event...
edge_1          | 18:22:11.180 INFO [NodeServer$1.lambda$start$1] - Sending registration event...
edge_1          | 18:22:21.081 INFO [NodeServer$1.lambda$start$1] - Sending registration event...

To my knowledge, the above message indicates that the Node is trying to reach out to hub but for some reason, not able to ...

Is there a place where I can get more details about this error ? Any help and direction would be great.

The link below seems to be helpful https://github.com/SeleniumHQ/selenium/issues/9488

But, I am able to clearly see the machines are able to connect with each other and hence its not a firewall issue/port issue/ network issue

@Alexey - Yes. I am using docker-compose up

version: '3.0'

services:
    selenium-hub:
        image: selenium/hub:latest
        ports:
            - '4442:4442'
            - '4443:4443'
            - '4444:4444'

chrome:
    image: selenium/node-chrome:latest
    volumes:
        - /dev/shm:/dev/shm
    environment:
        - HUB_HOST=selenium-hub
        - HUB_PORT=4444
    depends_on:
        - selenium-hub
    ports:
        - "6900:5900"

firefox:
    image: selenium/node-firefox:latest
    volumes:
        - /dev/shm:/dev/shm
    environment:
        - HUB_HOST=selenium-hub
        - HUB_PORT=4444
    depends_on:
        - selenium-hub
    ports:
        - "6902:5900"

edge:
    image: selenium/node-edge:93.0-20210804

    volumes:
        - /dev/shm:/dev/shm
    environment:
        - HUB_HOST=selenium-hub
        - HUB_PORT=4444
        - SE_EVENT_BUS_HOST=selenium-hub
        - SE_EVENT_BUS_PUBLISH_PORT=4442
        - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
    depends_on:
        - selenium-hub
    ports:
        - "6901:5900"

e2e:
    build: .
    image: wdio
    environment:
        - username=${username:-user}
        - password=${password:-password}
        - headless=${headless:-true}
    volumes:
        - ./results:/wdio/results
    depends_on:
        - chrome
        - firefox
        - edge
    entrypoint: npm run test:local -- --suite all

The docker file is

FROM node:12.16.2-buster-slim

WORKDIR /wdio

COPY package*.json ./
RUN npm install --silent

COPY . .
1

There are 1 best solutions below

0
On

@All - I tried all things what ever I can in my knowledge. Nothing worked. Except one thing

Start all the nodes ( FF, Edge, Chrome ) ...wait for say 1 min and then start the selenium-hub container..

Pretty strange...but this is the only solution which I have so far...though not a clean solution.. I can survive with this for the moment...

This might be helpful for some one who faced the same issue...