seleniumwire.py投掷err_tunnel_connection_failed使用代理时

发布于 2025-02-09 14:23:49 字数 1030 浏览 1 评论 0原文

我一直在尝试将身份验证的代理添加到我的硒代码中。经过很多研究,我遇到了硒电线。当我运行时,它会给我带来这个错误吗?

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 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

陌上青苔 2025-02-16 14:23:49

Seleniumwire具有代理网络:

我不建议Seleniumwire,因为有一个未解决的 TLS指纹的问题,驱动器将被Cloudflare迅速检测到。普通的硒软件包具有代理配置的方法,但它仅与“主机:端口”代理使用:

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)

上面的配置不适用于代理网络端点方法(“ https://proxy.proxy.proxyverse) .io:443“),似乎没有当前的解决方案。


有关更多详细信息和当前跟踪: python selenium proxy网络

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文