python - 端口 9050 Not Listening tb selenium
问题描述
我想在 linux mint 机器上使用 tbselenium 包进行浏览器自动化。当我尝试运行应该可以工作的代码时,python 会给我错误消息:
tbselenium.exceptions.TBDriverPortError: SOCKS port 9050 is not listening
我试图使用的代码是:
from tbselenium.tbdriver import TorBrowserDriver
import time
with TorBrowserDriver("/home/sas/Videos/tor-browser_en-US/") as driver:
driver.get("https://github.com/mozilla/geckodriver")
有谁知道为什么会这样?答案已公布:)
编辑:我唯一开放的端口是 5060
解决方案
在运行这个“基本用法”示例(https://github.com/webfp/tor-browser-selenium)时,我遇到了同样的问题(SOCKS port 9050 is not listening
):
from tbselenium.tbdriver import TorBrowserDriver
with TorBrowserDriver("/path/to/TorBrowserBundle/") as driver:
driver.get('https://check.torproject.org')
以下命令修复了该问题:
sudo service tor restart
推荐阅读
- gradle - Gradle 未检测到多版本 jar 的兼容 JDK
- spring-boot - Springboot 客户端服务器架构
- xml - 使用 PE 的 Saxon Config 文件:扩展元素在 Saxon-HE 中不可用
- java - MongoDB:类 java.lang.Double 不能转换为类 java.lang.Long
- linux - 为什么交叉编译Apache(httpd-2.4.46)时会有一些警告?
- sql - 带有 Row_Num 的 CASE
- mongodb - pymongo插入时间戳验证错误
- amazon-web-services - 为 Auto Scaling 组中的所有实例设置通用警报
- flutter - Flutter/Dart:如何在应用启动前等待异步任务?
- autocomplete - PhpStorm 中的 TailwindCSS 自动完成功能不起作用