Selenium WebDriver + Tor as proxy with Stem? Selenium WebDriver + Tor as proxy with Stem? selenium selenium

Selenium WebDriver + Tor as proxy with Stem?


Stem can't create a tor process, its only a library for connecting to an existing tor server for inspection/control via the control port.

To create the tor process itself, you need to have your system start it up with upstart/launchctl/etc. Alternatively, you can just type tor from the commandline if its installed and it'll run in the foreground.

With that, to use stem you'll need to edit your torrc to a. enable the ControlPort, and b. set an authentication method (cookieauth or hashed password stored in your torrc). The default tor SocksPort is 9050 and ControlPort is 9051.

The SocksPort is the one you route your traffic (i.e. firefox) through, the ControlPort is what you connect stem to.Mind you, only if you even need stem, since it just seems like you're trying to start a tor instance with it (and thats not do-able), if you get it running on your system vanilla, it'll work with selenium/firefox as you've got it configured (well, default port is 9050 not 9000)