Skip to main content
1 of 2

Tor failed to start

Trying to connect to tor via selenium for the first time. Using Windows 7 64 ...Getting this error code..

selenium.common.exceptions.WebDriverException: Message: Process unexpectedly closed with status 0

and a pop-up saying tor failed to start. Here is my code.

from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
binary = FirefoxBinary(r'C:\Users\Abhi\Desktop\Tor Browser\Browser\firefox.exe')
torexe = os.popen(r'C:\Users\Abhi\Desktop\Tor Browser\Browser\TorBrowser\Tor\tor.exe')
profile = FirefoxProfile(r'C:\Users\Abhi\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', 9150)
profile.set_preference("network.proxy.socks_remote_dns", False)
profile.update_preferences()
driver = webdriver.Firefox(firefox_profile= profile, executable_path=r'C:\Users\Abhi\Desktop\geckodriver.exe', firefox_binary=binary)
driver.get("http://check.torproject.org")

Any help is appreciated.Thanks guys.