0

I already looked into a lot of topics & answers, but I still can't get it working.

I get the following errors while launching Tor with Selenium: "Tor failed to start" and "Could not connect to Tor control port"

My code:

import re
import sys
import time
import datetime
import pyautogui
import os
import subprocess
import random
import math
from selenium import webdriver
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

binary = FirefoxBinary(r'D:\Desktop\Tor\Tor Browser\Browser\firefox.exe')

profile = FirefoxProfile(r'D:\Desktop\Tor\Tor\Browser\Browser\TorBrowser\Data\Browser\profile.default')

driver = webdriver.Firefox(profile, binary)

driver.get("google.com")

I also have the geckodriver installed.

Please help me! Thank you.

coder
  • 12,832
  • 5
  • 39
  • 53
  • possible duplicate: https://stackoverflow.com/q/15316304/8332700 – Verv Sep 22 '17 at 19:28
  • Also you may want to show a more complete code – Verv Sep 22 '17 at 19:28
  • Yeah i already tried that answer they posted there. edited the post with full code –  Sep 22 '17 at 19:32
  • What is the error you get? – Tarun Lalwani Sep 23 '17 at 11:49
  • "Tor failed to start" and "Could not connect to tor control point" –  Sep 25 '17 at 07:55
  • Did you remember to comment out in your torrc the control port 9051 and one of the password methods to control the port, i.e. set the hashed password field properly? If you are passing in the hash itself instead of the password then you are doing it wrong. Stem only works with passing in the auth to control tor like in the linked answer above. by @Verv. I would do `tor --hash-password "my_password"` then update my torrc file to include the resulting hash: `HashedControlPassword 16:E600ADC1B52C80BB6022A0E999A7734571A451EB6AE50FED489B72E3DF` below the ControlPort line – james-see Oct 05 '17 at 16:31
  • I am very late here, but you might want to try this in a virtual linux OS. I am also unable to get it to work on windows, but works find on macOS. – Joe B Feb 19 '21 at 05:37

0 Answers0