how to get selenium-grid node id and dockers-novnc port id mapping

95 Views Asked by At

I have started selenium docker compose file with novnc enabled and scaled the browser from 1 to 3.

I can get the session id and node id from the api http://localhost:4444/status. But is there any way i can get the port mapping wrt node id?

Step to reproduce:

  1. Docker compose file:
version: "3"
services:
  edge:
    image: selenium/node-edge:latest
    shm_size: 2gb
    depends_on:
      - selenium-hub
    environment:
      - SE_EVENT_BUS_HOST=selenium-hub
      - SE_EVENT_BUS_PUBLISH_PORT=4442
      - SE_EVENT_BUS_SUBSCRIBE_PORT=4443
      - SE_NODE_MAX_INSTANCES=1
      - SE_NODE_MAX_SESSIONS=1
      - SE_VNC_NO_PASSWORD=1
      - SE_NODE_SESSION_TIMEOUT=60
    ports:
      - "7901-7903:7900"
  selenium-hub:
    image: selenium/hub:latest
    container_name: selenium-hub
    ports:
      - "4442:4442"
      - "4443:4443"
      - "4444:4444"`
  1. Start docker compose

docker-compose -f docker-composer.yml up

  1. scale docker compose browser

docker-compose -f docker-composer.yml up --scale edge=3

  1. Trigger any test on remote url: 'http://localhost:4444/wd/hub'

  2. Open any of the below url to see the live test running http://localhost:7901/ , http://localhost:7902/ , http://localhost:7903/

  3. To get session id and node id trigger below api

Get: http://localhost:4444/status

I am expecting to get a mapping in between node id and the novnc port(7901-7903) so that in step 5 I exactly know which url I have to open to view my test rather than trying to open one by one and checking each of them.

0

There are 0 best solutions below