0

I have been trying to add authenticated proxies to my selenium code. I came across selenium wire after alot of research. When I ran the can it threw me this error?

selenium.common.exceptions.WebDriverException: Message: unknown error: net::ERR_TUNNEL_CONNECTION_FAILED
  (Session info: headless chrome=102.0.5005.115)

import seleniumwire
from seleniumwire import webdriver
import time

options = {
        'proxy': {
            'https': 'https://proxy.proxyverse.io:443', 
            'http': 'http://proxy.proxyverse.io:443',
        }  
    }

# other chrome options
op = webdriver.ChromeOptions()
op.add_argument("window-size=1920,1080")
op.add_experimental_option("excludeSwitches", ["enable-automation"])
op.add_argument("--headless") 
op.add_experimental_option('useAutomationExtension', False)
op.add_argument("start-maximized")

driver = webdriver.Chrome("path/chromedriver.exe" ,options=op,seleniumwire_options=options)

driver.get("https://google.com/")

I need to know what is causing this because without proxies the driver is working fine. Thanks

1 Answer 1

0

SeleniumWire with Proxy Network:

I would not recommend SeleniumWire as there is an unresolved issue with the TLS fingerprint and the driver will be quickly detected by CloudFlare. The normal Selenium package has a method of proxy configuration but it only works with "host:port" proxies:

from selenium import webdriver
from selenium.webdriver.common.proxy import Proxy, ProxyType

prox = Proxy()
prox.proxy_type = ProxyType.MANUAL
prox.http_proxy = "ip_addr:port"
prox.socks_proxy = "ip_addr:port"
prox.ssl_proxy = "ip_addr:port"

capabilities = webdriver.DesiredCapabilities.CHROME
prox.add_to_capabilities(capabilities)

driver = webdriver.Chrome(desired_capabilities=capabilities)

The above configuration does NOT work with the proxy network endpoint method ("https://proxy.proxyverse.io:443") and there seems to be no current solution.


For more detail and current tracking: Python Selenium Proxy Network

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.