Python/selenium 如何使用未检测到的 chromedriver 代理

问题描述 投票:0回答:2

每当我尝试使用带有 undetted-chromedriver 的代理时,它就不起作用并显示我的 ip。 当我使用普通的 webdriver 时,它工作得很好。

from selenium import webdriver
from time import sleep


ip_port = "ip:port"

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=%s' % ip_port)
driver = uc.Chrome(use_subprocess=True, chrome_options=chrome_options)

driver.get('https://www.myexternalip.com/raw')
sleep(999)

如何使代理与未检测到的 chromedriver 一起工作?

这是网站https://www.myexternalip.com/raw: 使用未检测到的 chromedriver(给出我的实际 ip)

感谢您的帮助。

python selenium proxy selenium-chromedriver undetected-chromedriver
2个回答
0
投票

适用于:

chrome_options = Options()
chrome_options.add_argument('--proxy-server=ip:port')
driver = uc.Chrome(options=chrome_options)
driver.get('https://www.myexternalip.com/raw')

0
投票

您可以使用 chrome 扩展程序通过代理更改您的 IP。 例如我使用SwitchyOmega。然后我在扩展中设置了代理,它工作得很好。

© www.soinside.com 2019 - 2024. All rights reserved.