如何使用SeleniumWebDriver(java)使用tor浏览器?到目前为止,我已经尝试了下面的代码,但得到的消息是:';tor无法启动';
到目前为止,我已经尝试了上面的代码,但收到消息:“tor无法启动”。是否有人可以帮助您了解上述代码需要做哪些更改。您正在尝试使用FireFox驱动程序。 请尝试使用其自述文件中指定的TorBrowserDriver: 或者,如果您想使用firefox,请使用GeckoDriver,可从下一个链接下载:如何使用SeleniumWebDriver(java)使用tor浏览器?到目前为止,我已经尝试了下面的代码,但得到的消息是:';tor无法启动';,java,selenium,selenium-webdriver,automation,tor,Java,Selenium,Selenium Webdriver,Automation,Tor,到目前为止,我已经尝试了上面的代码,但收到消息:“tor无法启动”。是否有人可以帮助您了解上述代码需要做哪些更改。您正在尝试使用FireFox驱动程序。 请尝试使用其自述文件中指定的TorBrowserDriver: 或者,如果您想使用firefox,请使用GeckoDriver,可从下一个链接下载: import java.io.File; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.Fi
import java.io.File;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxBinary;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.firefox.FirefoxProfile;
public class torr1 {
public static void main(String[] args) {
System.setProperty("webdriver.firefox.marionette",
"C:\\Users\\ghorh\\Documents\\selenium-bazinga\\Drivers\\geckodriver.exe");
String torPath = "C:\\Users\\ghorh\\Desktop\\Tor Browser\\Browser\\firefox.exe";
String profilePath = "C:\\Users\\ghorh\\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);
FirefoxOptions options = new FirefoxOptions();
options.setBinary(binary);
options.setProfile(torProfile);
options.setCapability(FirefoxOptions.FIREFOX_OPTIONS, options);
WebDriver driver = new FirefoxDriver(options);
driver.get("http://google.co.in");
}
}