【发布时间】:2017-01-01 05:52:25
【问题描述】:
我目前正在尝试使用 Selenium WebDriver (JAVA) 2.53 和 Firefox 43.0 执行 TOR 6.0.4。我已按照这篇文章Using Selenium WebDriver with Tor 中的说明进行操作,但在将 TOR 的 profilePath 加载到 Firefox 二进制文件时出现错误。我已经看到可以通过将 TOR profile.default 存档加载到 firefox binaty 来为 TOR 提供午餐,但是在使用配置文件实例化二进制文件时,我得到了一个驱动程序信息:driver.version:unknown。我已经尝试更改Firefox版本并且仍然如此。在我启动驱动程序的代码下方。我也在使用 Windows。
String torPath = "C:\\Users\\Jose Bernhardt\\Desktop\\Tor Browser\\Start Tor Browser.exe";
String profilePath = "C:\\Users\\Jose Bernhardt\\Desktop\\Tor Browser\\Browser\\TorBrowser\\Data\\Browser\\profile.default";
File torProfileDir = new File(profilePath);
FirefoxBinary binary = new FirefoxBinary(new File(torPath));
FirefoxProfile torProfile = new FirefoxProfile(torProfileDir);
FirefoxDriver driver = new FirefoxDriver();
driver.get("http://www.google.com/webhp?complete=1&hl=en");
查看下面抛出的异常:
Exception in thread "main" org.openqa.selenium.WebDriverException: Specified firefox binary location does not exist or is not a real file: C:\Users\Jose Bernhardt\Desktop\Tor Browser\Start Tor Browser.exe
【问题讨论】:
标签: java selenium webdriver tor