【发布时间】:2015-02-06 10:51:39
【问题描述】:
我需要一个 Tor 的 Webdriver 实例,以便能够从 selenium、Windows 中的 java 代码在 Tor 中启动 google.com,并能够搜索目标字符串
我的代码在下面
String torPath = "..Installations\\Tor\\Tor Browser\\Browser\\firefox.exe";
String profilePath = "..Installations\\Tor\\TorBrowser\\Browser\\TorBrowser\\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");
这会导致打开一个空白的 Tor 浏览器页面。它不会根据需要加载 google.com。我知道配置文件有效/兼容,因为我可以成功启动浏览器和配置文件:
binary.startProfile(profile, profilePath, ""));
我看过类似的问题,但没有得到满意的答案。
可以吗?如果是,如何? 我正在寻找 Java 代码。
【问题讨论】:
标签: java firefox selenium selenium-webdriver tor