Tor Browser is eessentiallyessentially Firefox, with a couple of patches. I don't think that the patches would affect the use of Selenium when compared to normal Firefox.
The Selenium documentation shows how to create a Firefox based WebDriver project.
The FirefoxDriver in particular can take parameters to the location of Firefox, and the profile to use. You should update these to point to the TorBrowser. The useExistinguseExisting flag looks promising for once you've started the Tor Browser Bundle.
I haven't tested any of this, but I expect this is enough to point you in the right direction. I expect someone else will come along and contribute a fullermore verbose answer.