1

Is there any way to open TorBrowser via Selenium on Windows? I tried many things from other similar questions:

from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile

binary = FirefoxBinary(r"C:\Users\usr\Desktop\Tor Browser\Browser\firefox.exe")
profile = FirefoxProfile(r"C:\Users\usr\Desktop\Tor Browser\Browser\TorBrowser\Data\Browser\profile.default")

self.driver = webdriver.Firefox(profile, binary, executable_path=r'C:\TestFiles\geckodriver.exe')

# yes, I have TB on desktop
# I also tried some other code, but everything gives me the same result

And the only result what I get is:

Tor failed to start.
        |OK|

and after clicking ok:

enter image description here

Also, the code "works" only when I give executable_path, in argument. Where may be the problem? How to open TorBrowser on Windows using Python Selenium? I use Python 3.8, Windows 7, newest TorBrowser 9.5 and geckodriver v0.26.0 (I think) And I need the TorBrowser, not only things that TorBrowser do, like IP changing.

Jan Černý
  • 1,268
  • 2
  • 17
  • 31
AquaUpcald
  • 11
  • 2

0 Answers0