You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Selenium(Python+Chrome)中通过代理加载HTTPS网站?

Fixes for Selenium Chrome Proxy HTTPS Timeout (ERR_TIMED_OUT)

1. Confirm Proxy Supports HTTPS Traffic

Most HTTP proxies block the CONNECT method required to tunnel HTTPS traffic. Test your proxy directly with curl to verify:

curl -x http://118.69.134.2:80 https://httpbin.org/ip

If this command fails, your proxy doesn’t handle HTTPS—switch to a proxy that explicitly supports both HTTP and HTTPS protocols.

2. Explicitly Define Proxy Protocols

Some setups require separate proxy configurations for HTTP and HTTPS. Update your --proxy-server argument to include both:

from selenium import webdriver
from selenium.webdriver.common.by import By

proxy_config = "http://118.69.134.2:80;https://118.69.134.2:80"
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument(f'--proxy-server={proxy_config}')
driver = webdriver.Chrome(options=chrome_options)
driver.get("https://httpbin.org/ip")
print(driver.find_element(By.TAG_NAME, "body").text)
driver.quit()

3. Add Proxy Authentication (If Required)

If your proxy uses username/password authentication, include credentials directly in the proxy URL:

http_proxy = "http://your_username:your_password@118.69.134.2:80"

Note: Avoid hardcoding credentials in production code—use environment variables instead.

4. Rule Out SSL Certificate Issues (Test Only)

Temporarily disable Chrome’s SSL verification to check if certificate errors are causing the timeout (never use this in production):

chrome_options.add_argument('--ignore-certificate-errors')
chrome_options.add_argument('--ignore-ssl-errors')

5. Test with a Functional Proxy

The proxy 118.69.134.2:80 may be offline or blocked. Try a known-working proxy to confirm the issue isn’t specific to this server.

内容的提问来源于stack exchange,提问作者کیا عباسی

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.04 22:32:38