python - 每次我尝试使用 selenium 启动 Tor 时,Python 都会崩溃:请不要删除我的问题,其他问题只有 C# 中的答案
问题描述
每次我想运行我的 Program Tor 时都会崩溃。该代码没有错误。路径都是正确的。这是我的代码:
from selenium import webdriver
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
import os
torexe = os.popen(r'C:/Users/Seya Fässler/Desktop/Tor Browser/Browser/TorBrowser/Tor/tor.exe')
profile = FirefoxProfile(r'C:/Users/Seya Fässler/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()
firefox_options = webdriver.FirefoxOptions()
firefox_options.binary_location = r'C:/Users/Seya Fässler/Desktop/Tor Browser/Browser/firefox.exe'
driver = webdriver.Firefox(firefox_profile= profile, options = firefox_options, executable_path=r'C:/Users/Seya Fässler/Webdrivers/geckodriver.exe')
driver.get("https://www.apple.com")
之后,它会显示此警报:
当我按 OK 时,它会打开此窗口并且我无法复制日志,因为它有 0 行。
我使用 Windows 10,作为我使用 anaconda 的环境,tor 浏览器是最新版本(9.5.3),我使用 Python 3.8.3。 请不要因为重复而删除我的问题,另一个问题有答案但仅在 C# 中,它不适用于 python! 谢谢!
解决方案
推荐阅读
- c++ - C++ 问题:不允许抽象类类型“管理器”的对象
- java - sharedpreferences getString() 返回活动三中的空字符串
- django - 获取列“is_routed”不能为空错误。即使认为它在数据库中设置为 default=0
- html - CSS网格最适合内容到矩阵中并保持相等的列宽
- spyder - llvm的python代码问题
- php - 如何显示与 where 子句不同的记录
- resilience4j - 使用 Callable 向 CircuitBreaker 添加回退
- html - CSS动画取决于子元素
- r - mnps 函数中的 twang 包警告
- javascript - 如何使用 HTML / JS 打开我的文件资源管理器