title: One last hurdle with running Tor contolled by Python Selenium
body: <p>I use the following code to run Tor controlled by Selenium in Lubuntu:</p>
  <pre><code>from selenium import webdriver
  from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
  
  torexe = os.popen(r'/home/sergey/.local/share/torbrowser/tbb/x86_64/tor-browser_en-US/Browser/firefox')
  profile = FirefoxProfile(r&quot;/home/sergey/.local/share/torbrowser/tbb/x86_64/tor-browser_en-US/Browser/TorBrowser/Data/Browser/profile.default&quot;)
  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(&quot;network.proxy.socks_remote_dns&quot;, False)
  profile.update_preferences()
  driver = webdriver.Firefox(firefox_profile=profile, executable_path=r'/usr/local/bin/geckodriver')
  driver.get(&quot;https://www.google.com&quot;)
  ...
  </code></pre>
  <p>It works, but in somewhat strange manner. Running it results in opening two windows, one window is Tor's while the other one being that of Firefox. Selenium controls the FF window only. The Tor window just sits there idly.</p>
  <p>It is not to say that makes life unbearable, as I have said every thing works, but I am merely curious to know how to «make it completely right» (by this, I mean executing Selenium script in the only window of Tor).</p>