1

Just as the question says, I have been unable to use TOR browser with Selenium on Python. I have read this and this answer, and created a MWE for each of them. Both of them give me the error 'Tor failed to start', as shown in the first link. Here's both examples:

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

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

browser = webdriver.Firefox(profile, binary)

page='https://www.google.com/'
browser.get(page)

Otherwise, I tried this too

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

torexe = os.popen(r'C:\Users\Asus\Desktop\Tor 
Browser\Browser\TorBrowser\Tor\tor.exe')
binary = FirefoxBinary(r"C:\Users\Asus\Desktop\Tor Browser\Browser\firefox.exe")
profile = FirefoxProfile(r"C:\Users\Asus\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()

browser = webdriver.Firefox(firefox_profile = profile, firefox_binary = binary, executable_path=r'C:\Users\Asus\Desktop\ome\geckodriver.exe')

page='https://www.google.com/'
browser.get(page)

I am currently using Python 3.7.3. Geckodriver is ver. 0.24.0. Firefox used by TOR is 60ESR. Selenium version is 3.141.0.

Anonymous
  • 41
  • 5
  • I did explain the main difference, however, namely that both solutions seem not to be working for me. How can I make this more specific? – Anonymous Jul 01 '19 at 20:19

0 Answers0