Skip to content

Instantly share code, notes, and snippets.

@a12b
Created October 27, 2019 15:14
Show Gist options
  • Save a12b/3767043f1bfbc83874a6afcfd444df86 to your computer and use it in GitHub Desktop.
Save a12b/3767043f1bfbc83874a6afcfd444df86 to your computer and use it in GitHub Desktop.
Selenium Fake IP Address with Tor Network
#Install Tor Browser, open Tor Browser, run selenium with Chrome Browser and Tor Exit Node.
CHROME_GOOGLE = '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
chrome_options = webdriver.ChromeOptions()
chrome_options.binary_location = CHROME_GOOGLE
chrome_options.add_argument('--proxy-server=socks5://127.0.0.1:9150')
driver = webdriver.Chrome(DRIVER_PATH, chrome_options=chrome_options)
driver.get('https://check.torproject.org/')
@nafanz
Copy link

nafanz commented Dec 4, 2020

*Sorry. You are not using Tor. *

Can you please tell me where is the error?

from selenium import webdriver

options = webdriver.FirefoxOptions()
options.add_argument('--proxy-server=socks5://localhost:9150')

driver = webdriver.Firefox(executable_path=r'/home/nafanz/Документы/git/github/Notes/home/selenium/geckodriver', firefox_options=options)
driver.get('https://check.torproject.org/')

@AlgorithMan-de
Copy link

driver = webdriver.Firefox(executable_path=r'/home/nafanz/Документы/git/github/Notes/home/selenium/geckodriver', firefox_options=options)

I think executable_path must be the location of firefox, not the driver

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment