diff --git a/selenium/README.md b/selenium/README.md index ad00e0b..d67c9a8 100644 --- a/selenium/README.md +++ b/selenium/README.md @@ -8,73 +8,9 @@ Watch [this][2] video to get started. ## Server -docker-compose.yml - -```yaml -firefox: - image: selenium/standalone-firefox-debug - ports: - - "4444:4444" - - "5900:5900" - environment: - - JAVA_OPTS=-Xmx512m - restart: always -``` - -docker-compose-grid.yml - -```yaml -hub: - image: selenium/hub - container_name: hub - ports: - - "4444:4444" - environment: - - GRID_TIMEOUT=60 - - GRID_BROWSER_TIMEOUT=30 - restart: always - -chrome: - image: selenium/node-chrome - container_name: chrome - ports: - - "5555" - links: - - hub - restart: always - -firefox: - image: selenium/node-firefox - container_name: firefox - ports: - - "5555" - links: - - hub - restart: always -``` - -> Access grid console at - -docker-compose-node.yml - -```yaml -firefox: - image: selenium/node-firefox - ports: - - "5555:5555" - - "5900:5900" - environment: - - JAVA_OPTS=-Xmx512m - - NODE_MAX_INSTANCES=2 - - NODE_MAX_SESSION=2 - - SE_OPTS=-host 5.6.7.8 -port 5555 - - HUB_PORT_4444_TCP_ADDR=1.2.3.4 - - HUB_PORT_4444_TCP_PORT=4444 - restart: always -``` - ```bash $ docker-compose up -d +$ curl http://127.0.0.1:4444/ ``` > Another way to start selenium server: @@ -154,7 +90,7 @@ driver.quit(); ```bash # VNC -$ open vnc://:secret@127.0.0.1:5900 +$ open vnc://127.0.0.1:5900 $ open http://127.0.0.1:7900 # PYTHON diff --git a/selenium/docker-compose-grid.yml b/selenium/docker-compose-grid.yml deleted file mode 100644 index 7bc3a22..0000000 --- a/selenium/docker-compose-grid.yml +++ /dev/null @@ -1,40 +0,0 @@ -hub: - image: selenium/hub - ports: - - "4444:4444" - environment: - - GRID_TIMEOUT=60 - - GRID_BROWSER_TIMEOUT=30 - restart: always - -firefox: - image: selenium/node-firefox-debug - ports: - - "5555" - - "5901:5900" - links: - - hub - environment: - - JAVA_OPTS=-Xmx768m - - SCREEN_WIDTH=1024 - - SCREEN_HEIGHT=768 - - SCREEN_DEPTH=16 - - NODE_MAX_INSTANCES=5 - - NODE_MAX_SESSION=5 - restart: always - -chrome: - image: selenium/node-chrome-debug - ports: - - "5555" - - "5902:5900" - links: - - hub - environment: - - JAVA_OPTS=-Xmx768m - - SCREEN_WIDTH=1024 - - SCREEN_HEIGHT=768 - - SCREEN_DEPTH=16 - - NODE_MAX_INSTANCES=5 - - NODE_MAX_SESSION=5 - restart: always diff --git a/selenium/docker-compose-node.yml b/selenium/docker-compose-node.yml deleted file mode 100644 index d857110..0000000 --- a/selenium/docker-compose-node.yml +++ /dev/null @@ -1,16 +0,0 @@ -firefox: - image: selenium/node-firefox-debug - ports: - - "5555:5555" - - "5900:5900" - environment: - - JAVA_OPTS=-Xmx512m - - SCREEN_WIDTH=1024 - - SCREEN_HEIGHT=768 - - SCREEN_DEPTH=16 - - NODE_MAX_INSTANCES=2 - - NODE_MAX_SESSION=2 - - SE_OPTS=-host 5.6.7.8 -port 5555 - - HUB_PORT_4444_TCP_ADDR=1.2.3.4 - - HUB_PORT_4444_TCP_PORT=4444 - restart: always diff --git a/selenium/docker-compose.yml b/selenium/docker-compose.yml index 6104182..91b0aef 100644 --- a/selenium/docker-compose.yml +++ b/selenium/docker-compose.yml @@ -1,3 +1,7 @@ +# +# https://github.com/SeleniumHQ/docker-selenium/blob/trunk/docker-compose-v3.yml +# + version: "3.8" services: @@ -22,19 +26,10 @@ services: - SE_NODE_OVERRIDE_MAX_SESSIONS=true - SE_NODE_MAX_SESSIONS=4 - SE_NODE_SESSION_TIMEOUT=180 + - START_XVFB=true + - VNC_NO_PASSWORD=1 + - VNC_VIEW_ONLY=1 shm_size: 2gb depends_on: - hub restart: unless-stopped - - video: - image: selenium/video - volumes: - - ./data:/videos - environment: - - DISPLAY_CONTAINER_NAME=chrome - - FILE_NAME=output.mp4 - shm_size: 2gb - depends_on: - - chrome - restart: unless-stopped diff --git a/selenium/docker-stack.yml b/selenium/docker-stack.yml index 4d6b675..2291194 100644 --- a/selenium/docker-stack.yml +++ b/selenium/docker-stack.yml @@ -40,6 +40,8 @@ services: - SE_NODE_MAX_SESSIONS=8 - SE_NODE_SESSION_TIMEOUT=180 - START_XVFB=true + - VNC_NO_PASSWORD=1 + - VNC_VIEW_ONLY=1 depends_on: - hub deploy: diff --git a/selenium/grid/docker-compose-hub.yml b/selenium/grid/docker-compose-hub.yml index 3fcf4b7..16ffda7 100644 --- a/selenium/grid/docker-compose-hub.yml +++ b/selenium/grid/docker-compose-hub.yml @@ -3,17 +3,14 @@ version: '3.8' services: hub: - image: selenium/hub:3.141.59 + image: selenium/hub:4 ports: + - "4442:4442" + - "4443:4443" - "4444:4444" - environment: - - JAVA_OPTS=-Xmx512m - - GRID_TIMEOUT=60 - - GRID_BROWSER_TIMEOUT=30 healthcheck: test: ["CMD", "/opt/bin/check-grid.sh", "--host", "127.0.0.1", "--port", "4444"] interval: 15s timeout: 30s retries: 5 - shm_size: 2gb restart: unless-stopped diff --git a/selenium/grid/docker-compose-node.yml b/selenium/grid/docker-compose-node.yml index 5528962..0f42244 100644 --- a/selenium/grid/docker-compose-node.yml +++ b/selenium/grid/docker-compose-node.yml @@ -3,14 +3,21 @@ version: '3.8' services: chrome: - image: selenium/node-chrome:3.141.59 + image: selenium/node-chrome:4 ports: - - "5555:5555" + - "5900:5900" + - "7900:7900" environment: - - HUB_HOST=10.0.0.21 - - HUB_PORT=4444 - - REMOTE_HOST=http://10.0.0.22:5555 - - NODE_MAX_INSTANCES=2 - - NODE_MAX_SESSION=2 + - SE_EVENT_BUS_HOST=hub + - SE_EVENT_BUS_PUBLISH_PORT=4442 + - SE_EVENT_BUS_SUBSCRIBE_PORT=4443 + - SE_NODE_OVERRIDE_MAX_SESSIONS=true + - SE_NODE_MAX_SESSIONS=4 + - SE_NODE_SESSION_TIMEOUT=180 + - START_XVFB=true + - VNC_NO_PASSWORD=1 + - VNC_VIEW_ONLY=1 + extra_hosts: + - hub:x.x.x.x shm_size: 2gb restart: unless-stopped