Skip to content

Instantly share code, notes, and snippets.

@ShlomiRex
Created October 30, 2021 22:56
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ShlomiRex/1d9d7b7b341d8af535b53c657309fcad to your computer and use it in GitHub Desktop.
Save ShlomiRex/1d9d7b7b341d8af535b53c657309fcad to your computer and use it in GitHub Desktop.
Python Selenium - Brave + Tor
_brave_path = r'C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe'
def get_brave_tor_driver():
option = webdriver.ChromeOptions()
option.binary_location = _brave_path
option.add_argument("--tor") # Launch in Tor mode
driver = webdriver.Chrome(executable_path=_chrome_driver_path, chrome_options=option)
return driver
@ottogutierrez
Copy link

Hello! Thank you for this trick!

One question. I'm having an issue where the driver opens two windows, and it says that the client is blocking the content. I can only interact from it until it has secured the Tor connection, and only if I close the second window. Have you encountered the same issue?

@ShlomiRex
Copy link
Author

It should open 1 window only in Tor mode. Didn't encountered this issue before.

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