Skip to content

Instantly share code, notes, and snippets.

@tyjeon24
Created March 14, 2020 03:22
Show Gist options
  • Save tyjeon24/6344254c299d313d7431eed617b41c97 to your computer and use it in GitHub Desktop.
Save tyjeon24/6344254c299d313d7431eed617b41c97 to your computer and use it in GitHub Desktop.
Python:Selenium with Tor
# Before running the code
# 1. Tor service should one service or tor.exe is running.
from selenium import webdriver
PROXY = "socks5://localhost:9050"
options = webdriver.ChromeOptions()
options.add_argument('--proxy-server=%s' % PROXY)
driver = webdriver.Chrome(options=options, executable_path=r'chromedriver.exe')
driver.get("http://check.torproject.org")
html = driver.page_source
print(html)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment