[英]Error while launching TOR browser with Selenium WebDriver
我正在使用Selenium 2.53.0 Java,Tor 6.0.4和Firefox 43.我正在使用firefox执行tor,方法是使用firefox.exe加载带有Firefoxprofile()和Firefoxbinary()的profile.default存档。 Tor启动,但它没有启动,它显示两个错误:无法连接到Tor控制端口,Tor无法启动。
我已经按照这篇文章使用Selenium WebDriver和Tor来设置Firefox驱动程序。
见下面的代码。 谢谢!
String torPath = "C:\\Users\\Jose Bernhardt\\Desktop\\Tor Browser\\Browser\\firefox.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(binary, torProfile);
这些是引发的异常:
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
Exception in thread "main" org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(C:\Users\Jose Bernhardt\Desktop\Tor Browser\Browser\firefox.exe) on port 7055; process output follows
我想这是因为你使用的是错误版本的firefox驱动程序
尝试以下:
public WebDriver driver;
system.setproperty("webdriver.gecko.driver","path to your firefoxdriver");
driver = new FierfoxDriver();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.