Error starting TOR browser using Selenium WebDriver

I use Selenium 2.53.0 Java, Tor 6.0.4 and Firefox 43. I start firefox by loading the profile.default archive with Firefoxprofile () and Firefoxbinary () with firefox.exe. Tor starts, but it does not start, it shows two errors: it was not possible to connect to the Tor management port, and Tor could not start.

I read this post in using Selenium WebDriver with Tor to configure the Firefox driver.

See below code. Thank!

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);

These are the exceptions:

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
+4
source share
1 answer

I think this is because you are using the wrong version of the firefox driver

try below:

public WebDriver driver;
system.setproperty("webdriver.gecko.driver","path to your firefoxdriver");
driver = new FierfoxDriver();
0

Source: https://habr.com/ru/post/1652395/


All Articles