I am a new developer. I am trying to execute selenium code in an already opened tor session. I also tried to find my query on the internet but didn't get a satisfying answer.
My code looks like this:
binary = r'C:\Users\Admin\Desktop\Tor Browser\Browser\firefox.exe'
options = Options()
options.set_preference("network.proxy.type", 1)
options.set_preference("network.proxy.socks", "127.0.0.1")
options.set_preference("network.proxy.socks_port", 9050)
options.set_preference("network.proxy.socks_remote_dns", False)
options.set_capability( "debuggerAddress", f"127.0.0.1:1060")
# options.add_experimental_option("debuggerAddress", f"127.0.0.1:1060")
global browser
# only one instance of a browser opens, remove global for multiple instances
if not browser:
browser=webdriver.Firefox(firefox_binary=binary,options=options,firefox_profile=profile)
return browser
In simple words, this code doesn't connect to the running tor session but creates another session.