Olmdf
Olmdf

Reputation: 11

Error ERR_TUNNEL_CONNECTION_FAILED Selenium

I'm learning Python and faced the following problem: While studying the Selenium library, an error occurs:

selenium.common.exceptions.WebDriverException: Message: unknown error: net::ERR_TUNNEL_CONNECTION_FAILED (Session info: chrome=97.0.4692.99) Here is the code itself:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
import time
from selenium.webdriver.common.proxy import Proxy, ProxyType

proxy_ip_port = '91.132.151.232:80'
proxy = Proxy()
proxy.proxy_type = ProxyType.MANUAL
proxy.http_proxy = proxy_ip_port
proxy.ssl_proxy = proxy_ip_port

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

s = Service("C:\\Users\\Anton\\PycharmProjects\\pythonProject\\access\\chromedriver.exe")

driver = webdriver.Chrome(service=s, desired_capabilities=capabilities)

driver.get('https://2ip.ru/')

time.sleep(10)
driver.quit()

Upvotes: 1

Views: 4713

Answers (1)

Gurdain Bhalla
Gurdain Bhalla

Reputation: 71

This error is most likely not generated by Selenium, but by the browser you are using. There can be a number of issues that can throw the aforementioned error. By a quick search on the web I found out the possible causes behind your issue, namely

  1. Incorrect website domain configuration.

  2. Conflicting browser data.

  3. DNS Connection Issues.

  4. Proxy settings incorrectly entered.

These issues are common to chrome, but might be similar for other browsers as well. Go through this list to find your issue.

I also encountered this issue and for me it was a non-working proxy.

Upvotes: 1

Related Questions