wkeeling / selenium-wire

Extends Selenium's Python bindings to give you the ability to inspect requests made by the browser.
MIT License
1.86k stars 240 forks source link

ERR_PROXY_CONNECTION_FAILED while running selenium wire on Github Actions #719

Closed AlekseyYuvzhikKomodoHealth closed 8 months ago

AlekseyYuvzhikKomodoHealth commented 8 months ago

I'm struggling to fix my configuration: docker-compose file `version: "3" services: selenium-hub: image: selenium/hub:latest container_name: selenium-hub ports:

AlekseyYuvzhikKomodoHealth commented 8 months ago

I found the solution: docker-compose

version: "3"
services:
selenium-hub:
image: selenium/hub:latest
container_name: selenium-hub
ports:
- "4442:4442"
- "4443:4443"
- "4444:4444"
extra_hosts:
- "host.docker.internal:host-gateway"

chrome1:
image: selenium/node-chrome:latest
shm_size: 2gb
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
- SCREEN_WIDTH=1920
- SCREEN_HEIGHT=1080
ports:
- "7900:7900"
extra_hosts:
- "host.docker.internal:host-gateway"

in driver configuration

            while not connected:
                port = Browser.find_available_port()
                sw_options = {
                    'auto_config': False,  # Ensure this is set to False
                    'verify_ssl': False,  # Ensure this is set to False
                    'addr': f'0.0.0.0', 
                    'port': port
                }

                options.add_argument(
                    f'--proxy-server=host.docker.internal:{port}')  # Please use host.docker.internal DNS name, IP could be
                # dynamic
                options.add_argument('ignore-certificate-errors')