Мой вопрос уже существует. У меня есть ссылки из сообщений Использование Selenium WebDriver с Tor и Запуск браузера TOR с Selenium WebDriver Но когда я следую за ответами, это не получается. «тор не удалось запустить»
String document = System.getProperty("user.home") + File.separatorChar + "My Documents\\";
FirefoxProfile firefoxProfile = new FirefoxProfile(new File(document + "Tor Browser\\Browser\\TorBrowser\\Data\\Browser\\profile.default"));
firefoxProfile.setPreference("network.proxy.type",1);
firefoxProfile.setPreference("network.proxy.socks", "127.0.0.1");
firefoxProfile.setPreference("network.proxy.socks_port", 9050);
firefoxProfile.setPreference("network.proxy.socks_remote_dns", false);
firefoxProfile.setPreference("webdriver.load.strategy", "unstable");
FirefoxBinary firefoxBinary = new FirefoxBinary(new File(document + "Tor Browser\\Browser\\firefox.exe"));
System.setProperty("webdriver.gecko.driver", "geckodriver.exe");
FirefoxOptions options = new FirefoxOptions();
options.setBinary(firefoxBinary);
options.setProfile(firefoxProfile);
WebDriver webDriver = new FirefoxDriver(options);
webDriver.manage().window().maximize();
webDriver.get("http://check.torproject.org");
Сообщение об ошибке в netbean
--- exec-maven-plugin:1.2.1:exec (default-cli) @ traffic ---
1586823225966 mozrunner::runner INFO Running command: "C:\\Users\\AutoSync\\My Documents\\Tor Browser\\Browser\\firefox.exe" "-marionette" "-foreground" "-no-remote" "-profile" "C:\\Users\\AutoSync\\AppData\\Local\\Temp\\rust_mozprofilemNXASy"
Exception in thread "main" org.openqa.selenium.TimeoutException: connection refused
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'AUTOSYNC-PC', ip: '192.168.1.2', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_202'
Driver info: driver.version: FirefoxDriver
remote stacktrace:
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.W3CHandshakeResponse.lambda$errorHandler$0(W3CHandshakeResponse.java:62)
at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:464)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:128)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:74)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:147)
at s.selemium.TorprojectService.getWebDriver(TorprojectService.java:43)
at s.selemium.TorprojectService.main(TorprojectService.java:24)
Пожалуйста, помогите мне