2016-08-24 10 views
3

現在、Selenium WebDriver(JAVA)2.53とFirefox 43.0でTOR 6.0.4を実行しようとしています。私はこの投稿Using Selenium WebDriver with Torの指示に従ってきましたが、FirefoxバイナリにTORのprofilePathをロードする際にエラーが発生しました。私はTOR profile.defaultアーカイブをfirefox binatyにロードすることでTORを点滅させることが可能であることを見てきましたが、ドライバ情報を取得しています:driver.version:プロファイルでバイナリをインスタンス化するときは不明です。私はまだFirefoxのバージョンを変更しようとしました。私はドライバを起動するコードの下に。私もWindowsを使用しています。Serenium 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 

答えて

3

は私がTor.exeをロードして、代わりに私がTorのアーカイブからfirefox.exeををロードしなければならなかったようです。私は自分の道を変えて働いています。また、プロファイルとバイナリをドライバコンストラクタに送信していないことを修正しました。

"C:\\Users\\Jose Bernhardt\\Desktop\\Tor Browser\\Browser\\firefox.exe" 
FirefoxDriver driver = new FirefoxDriver(binary, torProfile); 
+0

代わりにFireFoxOptionsを使用してください。このコンストラクタのオーバーロードは廃止されました。 http://imgur.com/tAnzNhs –

関連する問題