Skip to content

Commit f2cfe42

Browse files
committed
update instructions
1 parent 78e9201 commit f2cfe42

File tree

1 file changed

+83
-68
lines changed
  • blog/2023-02-14-selenium-integration

1 file changed

+83
-68
lines changed

blog/2023-02-14-selenium-integration/index.md

Lines changed: 83 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ request a dedicated instance at contact@windmill.dev
2020

2121
:::
2222

23-
![Integrattion between Selenium and Windmill](./0-header.png "Connect Selenium with Windmill")
23+
![Integrattion between Selenium and Windmill](./0-header.png 'Connect Selenium with Windmill')
2424

2525
## Prerequisite
2626

@@ -46,7 +46,6 @@ It should look something like this:
4646
version: '3.7'
4747

4848
services:
49-
5049
db:
5150
image: postgres:14
5251
restart: unless-stopped
@@ -59,7 +58,7 @@ services:
5958
POSTGRES_PASSWORD: ${DB_PASSWORD}
6059
POSTGRES_DB: windmill
6160
healthcheck:
62-
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
61+
test: ['CMD-SHELL', 'pg_isready -U postgres']
6362
interval: 10s
6463
timeout: 5s
6564
retries: 5
@@ -70,8 +69,8 @@ services:
7069
replicas: 1
7170
restart: unless-stopped
7271
ports:
73-
- "8000:8000"
74-
- "9920-9930:9920-9930" # <- added this; only 10 ports are opened; if you want to open more ports increase the 2nd number respectively
72+
- '8000:8000'
73+
- '9920-9930:9920-9930' # <- added this; only 10 ports are opened; if you want to open more ports increase the 2nd number respectively
7574
environment:
7675
- DATABASE_URL=postgres://postgres:${DB_PASSWORD}@db/windmill?sslmode=disable
7776
- BASE_URL=http://${WM_BASE_URL}
@@ -99,8 +98,9 @@ add the following:
9998

10099
```bash
101100
DB_PASSWORD=changeme
101+
#use your public base url here
102102
WM_BASE_URL=http://localhost
103-
CADDY_REVERSE_PROXY=http://localhost
103+
CADDY_REVERSE_PROXY=":80"
104104
```
105105

106106
This is the PostgreSQL database password used by Windmill and the base URL of
@@ -119,28 +119,28 @@ We will also use Docker to configue Selenoid.
119119

120120
```json
121121
{
122-
"firefox": {
123-
"default": "104.0",
124-
"versions": {
125-
"104.0": {
126-
"image": "selenoid/firefox:104.0",
127-
"port": "4444",
128-
"path": "/wd/hub",
129-
"env": ["TZ=Europe/Berlin"]
130-
}
131-
}
132-
},
133-
"chrome": {
134-
"default": "104.0",
135-
"versions": {
136-
"104.0": {
137-
"image": "selenoid/chrome:104.0",
138-
"port": "4444",
139-
"path": "/",
140-
"env": ["TZ=Europe/Berlin"]
141-
}
142-
}
143-
}
122+
"firefox": {
123+
"default": "104.0",
124+
"versions": {
125+
"104.0": {
126+
"image": "selenoid/firefox:104.0",
127+
"port": "4444",
128+
"path": "/wd/hub",
129+
"env": ["TZ=Europe/Berlin"]
130+
}
131+
}
132+
},
133+
"chrome": {
134+
"default": "104.0",
135+
"versions": {
136+
"104.0": {
137+
"image": "selenoid/chrome:104.0",
138+
"port": "4444",
139+
"path": "/",
140+
"env": ["TZ=Europe/Berlin"]
141+
}
142+
}
143+
}
144144
}
145145
```
146146

@@ -168,29 +168,37 @@ add these two containers (`selenoid` and `selenoid-ui`). Don't forget to change
168168
the path to your `config` directory path.
169169

170170
```yml
171-
selenoid:
172-
network_mode: bridge
173-
image: aerokube/selenoid:latest-release
174-
volumes:
175-
- "/path/to/config:/etc/selenoid" # <- change this
176-
- "/path/to/config/video:/opt/selenoid/video" # <- change this
177-
- "/path/to/config/logs:/opt/selenoid/logs" # <- change this
178-
- "/var/run/docker.sock:/var/run/docker.sock"
179-
environment:
180-
- OVERRIDE_VIDEO_OUTPUT_DIR=./config/video
181-
command: ["-conf", "/etc/selenoid/browsers.json", "-video-output-dir", "/opt/selenoid/video", "-log-output-dir", "/opt/selenoid/logs"]
182-
ports:
183-
- "4444:4444"
184-
185-
selenoid-ui:
186-
image: "aerokube/selenoid-ui"
187-
network_mode: bridge
188-
restart: always
189-
links:
190-
- selenoid
191-
ports:
192-
- "8080:8080"
193-
command: ["--selenoid-uri", "http://selenoid:4444"]
171+
selenoid:
172+
network_mode: bridge
173+
image: aerokube/selenoid:latest-release
174+
volumes:
175+
- '/path/to/config:/etc/selenoid' # <- change this
176+
- '/path/to/config/video:/opt/selenoid/video' # <- change this
177+
- '/path/to/config/logs:/opt/selenoid/logs' # <- change this
178+
- '/var/run/docker.sock:/var/run/docker.sock'
179+
environment:
180+
- OVERRIDE_VIDEO_OUTPUT_DIR=./config/video
181+
command:
182+
[
183+
'-conf',
184+
'/etc/selenoid/browsers.json',
185+
'-video-output-dir',
186+
'/opt/selenoid/video',
187+
'-log-output-dir',
188+
'/opt/selenoid/logs'
189+
]
190+
ports:
191+
- '4444:4444'
192+
193+
selenoid-ui:
194+
image: 'aerokube/selenoid-ui'
195+
network_mode: bridge
196+
restart: always
197+
links:
198+
- selenoid
199+
ports:
200+
- '8080:8080'
201+
command: ['--selenoid-uri', 'http://selenoid:4444']
194202
```
195203

196204
Your `docker-compose.yml` should look like something like this:
@@ -199,7 +207,6 @@ Your `docker-compose.yml` should look like something like this:
199207
version: '3.7'
200208
201209
services:
202-
203210
db:
204211
image: postgres:14
205212
restart: unless-stopped
@@ -212,7 +219,7 @@ services:
212219
POSTGRES_PASSWORD: ${DB_PASSWORD}
213220
POSTGRES_DB: windmill
214221
healthcheck:
215-
test: [ "CMD-SHELL", "pg_isready -U postgres" ]
222+
test: ['CMD-SHELL', 'pg_isready -U postgres']
216223
interval: 10s
217224
timeout: 5s
218225
retries: 5
@@ -223,8 +230,8 @@ services:
223230
replicas: 1
224231
restart: unless-stopped
225232
ports:
226-
- "8000:8000"
227-
- "9920-9930:9920-9930" # <- added this; only 10 ports are opened; if you want to open more ports increase the 2nd number respectively
233+
- '8000:8000'
234+
- '9920-9930:9920-9930' # <- added this; only 10 ports are opened; if you want to open more ports increase the 2nd number respectively
228235
environment:
229236
- DATABASE_URL=postgres://postgres:${DB_PASSWORD}@db/windmill?sslmode=disable
230237
- BASE_URL=${WM_BASE_URL}
@@ -247,25 +254,33 @@ services:
247254
network_mode: bridge
248255
image: aerokube/selenoid:latest-release
249256
volumes:
250-
- "/path/to/config:/etc/selenoid" # <- change this
251-
- "/path/to/config/video:/opt/selenoid/video" # <- change this
252-
- "/path/to/config/logs:/opt/selenoid/logs" # <- change this
253-
- "/var/run/docker.sock:/var/run/docker.sock"
257+
- '/path/to/config:/etc/selenoid' # <- change this
258+
- '/path/to/config/video:/opt/selenoid/video' # <- change this
259+
- '/path/to/config/logs:/opt/selenoid/logs' # <- change this
260+
- '/var/run/docker.sock:/var/run/docker.sock'
254261
environment:
255262
- OVERRIDE_VIDEO_OUTPUT_DIR=./config/video
256-
command: ["-conf", "/etc/selenoid/browsers.json", "-video-output-dir", "/opt/selenoid/video", "-log-output-dir", "/opt/selenoid/logs"]
263+
command:
264+
[
265+
'-conf',
266+
'/etc/selenoid/browsers.json',
267+
'-video-output-dir',
268+
'/opt/selenoid/video',
269+
'-log-output-dir',
270+
'/opt/selenoid/logs'
271+
]
257272
ports:
258-
- "4444:4444"
273+
- '4444:4444'
259274
260275
selenoid-ui:
261-
image: "aerokube/selenoid-ui"
276+
image: 'aerokube/selenoid-ui'
262277
network_mode: bridge
263278
restart: always
264279
links:
265280
- selenoid
266281
ports:
267-
- "8080:8080"
268-
command: ["--selenoid-uri", "http://selenoid:4444"]
282+
- '8080:8080'
283+
command: ['--selenoid-uri', 'http://selenoid:4444']
269284
270285
volumes:
271286
db_data: null
@@ -277,7 +292,7 @@ Final structure:
277292
.
278293
├── config/
279294
│ ├── browsers.json
280-
│ ├── video
295+
│ ├── video
281296
│ └── logs
282297
├── .env
283298
└── docker-compose.yml
@@ -324,7 +339,7 @@ def initiateDriver(macM1=False):
324339
}
325340
326341
driver = webdriver.Remote(command_executor='http://{}:4444/wd/hub'.format(HOST),
327-
desired_capabilities=chrome_capabilities,seleniumwire_options=options)
342+
desired_capabilities=chrome_capabilities,seleniumwire_options=options)
328343
329344
print(f"initiated successfully with port:{i}")
330345
break
@@ -360,12 +375,12 @@ def initiateDriver(macM1=False):
360375
}
361376
362377
driver = webdriver.Remote(command_executor='http://{}:4444/wd/hub'.format(HOST),
363-
desired_capabilities=chrome_capabilities,seleniumwire_options=options)
378+
desired_capabilities=chrome_capabilities,seleniumwire_options=options)
364379
365380
print(f"initiated successfully with port:{i}")
366381
break
367382
except:
368-
print(f"initiating driver with port:{i}")
383+
print(f"initiating driver with port:{i}")
369384
if i > 9930:
370385
print("port limit exceeded")
371386
break

0 commit comments

Comments
 (0)