当我在 selenium 中使用代理时,页面不会加载

The page does not loads up when i'm using proxy in selenium

提问人:Abhijeet Gupta 提问时间:10/14/2022 最后编辑:Abhijeet Gupta 更新时间:10/14/2022 访问量:91

问:

我正在使用代理使用 selenium 加载页面。如果我不使用代理,代码可以正常工作,但是当我应用代理时,页面根本无法加载。这是我的代码:

    
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
import time

PROXY = "IP:PORT"
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=%s' % PROXY)
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=chrome_options)
url = "https://whatismyipaddress.com/"
driver.get(url)
time.sleep(10)
python selenium selenium-webdriver chrome-web-driver

评论

0赞 Madison Courto 10/14/2022
我的路由器将其作为恶意软件尝试阻止。所以要么你发布了一个狡猾的代理,要么试图成为一个顽皮的男孩。
0赞 Abhijeet Gupta 10/14/2022
我从这里的免费代理列表中复制了这个 IP geonode.com/free-proxy-list
0赞 Abhijeet Gupta 10/14/2022
但不管代理是什么,页面永远不会加载

答: 暂无答案