Tor浏览器没有启动,尽管我有Tor.exe的路径

2024-09-27 21:34:43 发布

您现在位置:Python中文网/ 问答频道 /正文

最近我想制作一个打开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")

Tags: import程序browsernetworkfirefoxprofileusersunknown

热门问题