2016-08-25 10 views
4

私はSelenium 2.53.0のJava、Tor 6.0.4、Firefox 43を使用しています。私はfirefoxでtorを実行していますが、profile.defaultアーカイブをFirefoxprofile Firefoxbinary()とfirefox.exe。 Torが起動しますが、起動しません。次の2つのエラーが表示されます。Tor制御ポートに接続できず、Torが起動できませんでした。Selenium WebDriverでTORブラウザを起動しているときにエラーが発生しました

私はUsing Selenium WebDriver with 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 

答えて

0

私はあなたが

は以下しようとFirefoxのドライバの間違ったバージョンを使用しているため、これがあると思う:

public WebDriver driver; 
system.setproperty("webdriver.gecko.driver","path to your firefoxdriver"); 
driver = new FierfoxDriver(); 
関連する問題