首页 > 解决方案 > 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")

标签: pythonseleniumselenium-webdriver

解决方案


推荐阅读