为什么设置了代理还是会报错ERR_CONNECTION_TIMED_OUT
能帮忙看下是什么原因吗?
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
edge_options = webdriver.EdgeOptions()
proxy = '127.0.0.1:1080'
# 设置代理
edge_options.add_argument('–proxy-server=http://' + proxy)
edge = webdriver.Edge(options=edge_options, service=Service(r"G:\桌面\Foreign Affairs 爬虫\edgedriver_win64\msedgedriver.exe"))
edge.get('https://www.foreignaffairs.com/issues/2023/102/1')
print(edge.page_source)
edge.quit() #退出
以下是AI给出的答案:
根据您提供的错误代码,可能是以下原因导致ERR_CONNECTION_TIMED_OUT:
你还可以参考这篇文章:http://www.idcbaby.com/63867/