首页 > 解决方案 > 无法通过代理链运行 selenium python 脚本

问题描述

简介 我使用 Python3 制作了一个小脚本,可以打开 gecko webdriver 并打开任何网站。然后我添加了一些其他功能,比如循环打开窗口多次。

错误 脚本在正常运行时工作,使用:

Python3 运行.py

但是,当使用代理链运行同样的事情时,我收到错误“拒绝”。下面的所有脚本逻辑和错误消息..

脚本 - 运行

driver = webdriver.Firefox(firefox_profile=profile)
driver.get("https://www.youtube.com/")
time.sleep(delay_time)
driver.close()

脚本 - 旋转

for x in range(rotations):
        print(f"Session: {x} started")
        run_driver(delay) # function for running driver

代理链错误

ProxyChains-3.1 (http://proxychains.sf.net)
Loading useragent file .. 

Session: 0 started
|R-chain|-<>-127.0.0.1:9050-<><>-127.0.0.1:46985-<--denied
|R-chain|-<>-127.0.0.1:9050-<><>-127.0.0.1:46985-<--denied
|DNS-request| localhost 
|R-chain|-<>-127.0.0.1:9050-<><>-4.2.2.2:53-<><>-OK
|DNS-response| localhost is 127.0.0.1
|R-chain|-<>-127.0.0.1:9050-<><>-127.0.0.1:46985-<--denied
|DNS-request| localhost 
|R-chain|-<>-127.0.0.1:9050-<><>-4.2.2.2:53-<><>-OK
|DNS-response| localhost is 127.0.0.1
|R-chain|-<>-127.0.0.1:9050-<><>-127.0.0.1:46985-<--denied
|DNS-request| localhost 
|R-chain|-<>-127.0.0.1:9050-<><>-4.2.2.2:53-<><>-OK
|DNS-response| localhost is 127.0.0.1
|R-chain|-<>-127.0.0.1:9050-<><>-127.0.0.1:46985-<--denied
|DNS-request| localhost 
|R-chain|-<>-127.0.0.1:9050-<><>-4.2.2.2:53-<><>-OK
|DNS-response| localhost is 127.0.0.1
|R-chain|-<>-127.0.0.1:9050-<><>-127.0.0.1:46985-<--denied
^Z
[1]+  Stopped                 proxychains python3 run.py --num 1 --delay 1 --ripper 0

任何帮助表示赞赏。谢谢你。

标签: pythonseleniumproxy

解决方案


推荐阅读