[Python] ERR_TUNNEL_CONNECTION_FAILED for selenium webdriver HTTPS scraping attempt

Discussão em 'Python' iniciado por Stack, Fevereiro 13, 2025.

  1. Stack

    Stack Membro Participativo

    I'm currently working on a scraping project and facing some issues with using a proxy from Webshare. This is my first time using a proxy, and I can't seem to access the target webpage.

    Every time I try to open the webpage, I encounter an ERR_TUNNEL_CONNECTION_FAILED error. I've tried various methods, including writing custom Chrome extensions to handle the authentification, but nothing seems to work. Help!

    from seleniumwire import webdriver
    from selenium.webdriver.chrome.service import Service
    from selenium.webdriver.chrome.options import Options

    options = {
    'proxy': {
    'http': 'http://user:pass@proxyIP:proxyPort',
    'https': 'http://user:pass@proxyIP:proxyPort',
    'no_proxy': 'localhost,127.0.0.1'
    }
    }

    # Path to ChromeDriver
    chrome_driver_path = "C:\\Program Files (x86)\\chromedriver.exe"
    service = Service(chrome_driver_path)
    chrome_options = Options()

    # Initialize Chrome driver with seleniumwire options
    driver = webdriver.Chrome(service=service, options=chrome_options, seleniumwire_options=options)

    driver.get('https://example.com')
    driver.implicitly_wait(8)

    driver.quit()

    Continue reading...

Compartilhe esta Página