python+selenium设置代理IP报错,求大神解决

是香香本人 2020-11-18 10:01:08

from selenium import webdriver

chromeOptions = webdriver.ChromeOptions()

# 设置代理
chromeOptions.add_argument("--proxy-server=http://202.20.16.82:10152")
browser = webdriver.Chrome(chrome_options=chromeOptions)

# 查看本机ip,查看代理是否起作用
browser.get("http://httpbin.org/ip")
# browser.get("http://www.baidu.com")

print(browser.page_source)

# 退出,清除浏览器缓存
browser.quit()


Traceback (most recent call last):
File "E:/pythonProject_1/接口测试(基于代码实现)/for_test.py", line 24, in <module>
browser.get("http://httpbin.org/ip")
File "E:\pythonProject_1\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 213, in get
self.execute(Command.GET, {'url': url})
File "E:\pythonProject_1\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 201, in execute
self.error_handler.check_response(response)
File "E:\pythonProject_1\venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 181, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: net::ERR_PROXY_CONNECTION_FAILED
(Session info: chrome=86.0.4240.183)
(Driver info: chromedriver=86.0.4240.22 (398b0743353ff36fb1b82468f63a3a93b4e2e89e-refs/branch-heads/4240@{#378}),platform=Windows NT 10.0.17763 x86_64)


进程已结束,退出代码 1

...全文
945 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
tzyyy1 2021-03-19
  • 打赏
  • 举报
回复
引用 1 楼 weixin_38898933 的回复:
你好,请问你解决这个问题了吗,我现在也是设置代理ip后,请求网站打不开
我也遇到了,不要账号密码还是比较简单,用账号密码就有点麻烦
weixin_38898933 2021-02-07
  • 打赏
  • 举报
回复
你好,请问你解决这个问题了吗,我现在也是设置代理ip后,请求网站打不开
  • 举报
回复
@weixin_38898933 加一,请问你解决了吗
m0_69469527 2023-05-16
  • 举报
回复
@大脸猫����� 问题解决了吗?

3,424

社区成员

发帖
与我相关
我的任务
社区描述
其他开发语言 其他开发语言
社区管理员
  • 其他开发语言社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧