Error with Proxy Selenium Webdriver Python : ERR_TUNNEL_CONNECTION_FAILED

Viewed 2708

I have made a bot in python with selenium but i have an error that i can't pass.

My script run X number of time , each time with a new proxy, the problem is sometimes the proxy don't work and the script crash

I have message "can't reach this site" or "err_connection_failed", i have try with webdriverwait , do a loop to try if it can pass but still blocked, when the driver.get.url can't connect to the website , the script crash.

Screen of error

Thanks for your help

raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: net::ERR_TUNNEL_CONNECTION_FAILED (Session info: chrome=87.0.4280.88)

2 Answers
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from webdriver_manager.utils import ChromeType

temp = True
while temp:
    try:
        # Add your proxxy change code here
        driver = webdriver.Chrome(options=options)
        driver.get("https://www.google.com")
        temp = False
    except Exception as e:
        print(e)
        driver.quit()

you can add something like this to catch the exception and try again until it passes

try adding:

webdriver.DesiredCapabilities.CHROME['acceptSslCerts']=True

like suggest here. It worked for me.

Related