0

I want to use tor browser to bypass censorship but using the Firefox Profile and the tor daemon doesn't work. here's my code:

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

torexe = os.popen(r'C:\Users\fathollahy\Desktop\Tor Browser\Browser\TorBrowser\Tor\tor.exe')
profile = FirefoxProfile(r'C:\Users\fathollahy\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()
driver = webdriver.Firefox(firefox_profile= profile, executable_path=r'geckodriver.exe')
driver.get("http://check.torproject.org")

Browser Snapshot: doesn't work

and normal sites don't open and just loading. I got the code from here.

1 Answers1

0

Actually, You should change the sock_port to 9150.

  • 1
    the problem with normal sites solved, but I cannot connect to censored sites. –  Dec 28 '19 at 11:09