Reputation: 11
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
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
Incorrect website domain configuration.
Conflicting browser data.
DNS Connection Issues.
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