Using Selenium WebDriver with Tor

后端 未结 5 904
走了就别回头了
走了就别回头了 2020-11-30 03:12

Because Tor Browser Bundle is just a patched version of Firefox, it seems that it should be possible to use a FirefoxDriver with Tor Browser. This is what I\'ve

5条回答
  •  旧时难觅i
    2020-11-30 04:00

    I would try specifying the path of one of the existing profiles and initialize your profile instance for Tor so your code would look something like:

    String torPath = "..\\Tor Browser\\Browser\\firefox.exe";
    String profilePath = "..\\Tor Browser\\Data\Browser\\profile.default";
    FirefoxProfile profile = new FirefoxProfile(new File(profilePath));
    FirefoxBinary binary = new FirefoxBinary(new File(torPath));
    FirefoxDriver driver = new FirefoxDriver(binary, profile);
    driver.get("http://www.google.com");
    

    I didn't try this since I don't have WebDriver setup at home, but this should allow you to specify a profile.

提交回复
热议问题