elgalu / docker-selenium

[NOT MAINTAINED] Please use <https://github.com/SeleniumHQ/docker-selenium>
https://github.com/SeleniumHQ/docker-selenium
Other
1.42k stars 333 forks source link

Accessing Chrome devtools in Chrome docker container #353

Open bimalviswam opened 4 years ago

bimalviswam commented 4 years ago

I am using mac Mojave version 10.14.6 and trying to set up a grid using selenium hub latest and Chrome latest images. My goal is to access the chrome dev tools and intercept a request and eventually the whole set up will be moved to Jenkins. Copied the docker compose below

version: "3.7"
services:
  selenium_hub_ix:
    container_name: selenium_hub_ix
    image: selenium/hub:latest
    environment:
      SE_OPTS: "-port 4445"
    ports:
      - 4445:4445
  chrome_ix:
    image: selenium/node-chrome:latest
    container_name: chrome_node_ix
    depends_on:
      - selenium_hub_ix
    ports:
      - 5905:5900
      - 5903:5555
    environment:
      - no_proxy=localhost
      - HUB_PORT_4444_TCP_ADDR=selenium_hub_ix
      - HUB_PORT_4444_TCP_PORT=4445
      - NODE_MAX_INSTANCES=5
      - NODE_MAX_SESSION=5
      - TZ=America/Chicago
      - remote-debugging-port=9222
    volumes:
      - /dev/shm:/dev/shm

I was under the assumption that if I dont specify the remote debugging port, it will be automatically assigned with 9222 . But when I create a driver with below line of code, some random port is retrieved in goog:chromeOptions.debuggerAddress . with neither of those ports, I am not able to create a CDP connection on the chrome on docker container? Did I get some basics wrong?