Selenium-Hub泊坞窗无法连接到点头

时间:2020-10-26 02:07:17

标签: docker selenium

我正在尝试使用Selenium-hub和docker部署自动化测试。我使用docker swarm和caddy进行配置。我的操作系统是Manjaro Linux。我的配置是这样的

version: '3'

networks:
  swarm_dev:
    external: true

services:
  caddy:
    #change image to lucaslorentz/caddy-docker-proxy:0.3-nanoserver-1803 in windows
    image: lucaslorentz/caddy-docker-proxy:0.3.0-alpine
    ports:
      - "80:80"
      - "443:443"
      - "2015:2015"
    networks:
      - swarm_dev
    volumes:
      - ./caddy:/root/.caddy
      - /var/run/docker.sock:/var/run/docker.sock
    deploy:
      mode: global
      placement:
        constraints:
          - node.role == manager
      restart_policy:
        condition: any
      update_config:
        parallelism: 1
        delay: 60s
      resources:
        reservations:
          cpus: '0.1'
          memory: 200M
  hub:
    image: selenium/hub
    ports:
      - 4444:4444
    networks:
      - swarm_dev
    environment:
      GRID_MAX_SESSION: 16
      GRID_BROWSER_TIMEOUT: 3000
      GRID_TIMEOUT: 3000
    deploy:
      labels:
        caddy.address: selenium.tool.vm
        caddy.targetport: "4444"
        caddy.tls: "/root/.caddy/local-cert.pem /root/.caddy/local-key.pem"

  chrome:
    image: selenium/node-chrome-debug
    depends_on:
      - hub
    environment:
      HUB_PORT_4444_TCP_ADDR: hub
      HUB_PORT_4444_TCP_PORT: 4444
      NODE_MAX_SESSION: 4
      NODE_MAX_INSTANCES: 4
    volumes:
      - /dev/shm:/dev/shm
    networks:
      - swarm_dev
      
volumes:
  hub:
    driver: local
  chrome:
    driver: local

当我部署到docker并运行时,一切都很好,但是当我在浏览器中打开selenium hub控制台时,它说 DefaultRemoteProxy未知版本,无法连接到/172.22.0.4:5555 。我也无法打开VNC。

,日志硒集线器容器说:

02:00:11.893 INFO [Hub.start] - Selenium Grid hub is up and running
02:00:11.894 INFO [Hub.start] - Nodes should register to http://172.22.0.3:4444/grid/register/
02:00:11.894 INFO [Hub.start] - Clients should connect to http://172.22.0.3:4444/wd/hub
02:00:17.742 INFO [DefaultGridRegistry.add] - Registered a node http://172.22.0.4:5555

并登录Chrome容器说

2:00:17.397 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 5555
02:00:17.397 INFO [GridLauncherV3.lambda$buildLaunchers$7] - Selenium Grid node is up and ready to register to the hub
02:00:17.423 INFO [SelfRegisteringRemote$1.run] - Starting auto registration thread. Will try to register every 5000 ms.
02:00:17.701 INFO [SelfRegisteringRemote.registerToHub] - Registering the node to the hub: http://hub:4444/grid/register
02:00:17.743 INFO [SelfRegisteringRemote.registerToHub] - The node is registered to the hub and ready to use

0 个答案:

没有答案