python - Tor 浏览器没有启动,虽然我有 totor.exe 的路径
问题描述
最近我想制作一个打开 Tor 的程序,但是当我启动该程序时,它会打开 Firefox 并且没有错误。我很确定路径是正确的,因为我在另一个问题上看到了它们。实际上它可以工作,但是使用了错误的浏览器。在我写下个人资料偏好之前它起作用了。
from selenium import webdriver
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
import os
#Profile Configurations
torexe = os.popen(r'C:/Users/Seya Unknown/Desktop/Tor Browser/Browser/TorBrowser/Tor/tor.exe')
profile = FirefoxProfile(r'C:/Users/Seya Unknown/Desktop/Tor Browser/Browser/TorBrowser/Data/Browser/profile.default')
profile.set_preference('network.proxy.type', 1)
profile.set_preference('network.proxy.socks', '127.0.0.1')
profile.set_preference('network.proxy.socks_port', 9050)
profile.set_preference("network.proxy.socks_remote_dns", False)
profile.update_preferences()
#Driver Configurations
driver = webdriver.Firefox(firefox_profile= profile, executable_path=r'C:/Users/Seya Unknown/Webdrivers/geckodriver.exe')
#Driver get
driver.get("http://check.torproject.org")
解决方案
推荐阅读
- java - 为什么一直重印菜单提示,后面跟着,monitor语句。我需要它重新启动并再次运行,直到使用进入退出。
- basic - Visual Basic 输出
- python-3.x - sqlite3.OperationalError:靠近“The”:语法错误/参数化 sql
- mongodb - Mongoose 通过不替换 ID 字段自动递增
- android - 在 Kotlin 中使用 Generic 时发现类型不匹配
- sql - 在 SQL 中将行更改为列
- java - 来自 Ubuntu 16 的 java 中的 ZeroMQ 绑定
- xml - XSLT:多次复制嵌套元素
- laravel-5 - 如何将多维数组转换为内爆值的索引数组?
- c# - 当时区不同时,发送 DateTime 的 WCF 服务的值会发生变化