Hello! Has anyone tried running Selenium-wire with Selenoid? I got them both working independant of eachother but when I combined them i get 502 bad gateway whenever i try to connect to a webpage that is in the same docker-compose as Selenoid.
My docker compose is:
version: '3'
services:
selenoid:
network_mode: bridge
image: aerokube/selenoid:latest-release
volumes:
- "$PWD/config:/etc/selenoid"
- "/var/run/docker.sock:/var/run/docker.sock"
- "$PWD/video:/opt/selenoid/video"
- "$PWD/logs:/opt/selenoid/logs"
ports:
- "4444:4444"
selenoid-ui:
network_mode: bridge
links:
- selenoid
image: aerokube/selenoid-ui
ports:
- "8080:8080"
command: -selenoid-uri http://selenoid:4444
And i try with this Python code:
from seleniumwire import webdriver
sw_options = {
'auto_config': False,
'addr': '
127.0.0.1',
'port': 9922, #setups up proxy on host machine
127.0.0.1:9922}
capabilities = {
"browserName": "chrome",
"selenoid:options": {
"enableVNC": True
},
'goog:chromeOptions': {'extensions': [],
'args': ['--proxy-server=host.docker.internal:9922', # tell selenium that the proxy exists on the host machine
'--ignore-certificate-errors']
}
}
driver = webdriver.Remote(
desired_capabilities=capabilities,
seleniumwire_options=sw_options
)
driver.get("
http://docker.host.internal:7000") # website address localhost:7000
for request in driver.requests:
if request.response:
print(
request.url,
request.response.status_code
)
driver.close()
But, as mentioned i get 502 gateway when trying to connect to my webpage hosted at localhost:7000 which is in the same docker-compose file as Selenoid.