1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2024-12-23 01:39:27 +02:00

update selenium

This commit is contained in:
kev 2022-01-11 17:33:20 +08:00
parent 34e7e4ea54
commit dd52cbd8b8
7 changed files with 28 additions and 147 deletions

View File

@ -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 <http://127.0.0.1:4444/grid/console>
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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -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