3
我正在尝试使用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 info:driver.version:unknown。我试图改变Firefox的版本,仍然。在我启动驱动程序的代码下面。我也使用Windows。用Selenium WebDriver运行TOR浏览器
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
现在应该使用FireFoxOptions来代替。此构造函数重载现在已被弃用。 http://imgur.com/tAnzNhs –