Ruby Selenium WebDriver将Firefox路径更改为Tor

Ruby Selenium WebDriver将Firefox路径更改为Tor,ruby,selenium-webdriver,watir,watir-webdriver,tor,Ruby,Selenium Webdriver,Watir,Watir Webdriver,Tor,我正在尝试将ruby中的webdriver更改为打开tor浏览器,而不是默认的firefox浏览器。我正在使用以下代码,在运行此代码之前,我打开了tor浏览器 path='C:\Users\Bonnnie\Downloads\Tor Browser\App\tor.exe' Selenium::WebDriver::Firefox.path = path driver = Selenium::WebDriver.for :firefox 我得到以下错误: unable to obtain st

我正在尝试将ruby中的webdriver更改为打开tor浏览器,而不是默认的firefox浏览器。我正在使用以下代码,在运行此代码之前,我打开了tor浏览器

path='C:\Users\Bonnnie\Downloads\Tor Browser\App\tor.exe'
Selenium::WebDriver::Firefox.path = path
driver = Selenium::WebDriver.for :firefox
我得到以下错误:

unable to obtain stable firefox connection in 60 seconds

我想我可能链接到了错误的tor文件。

以下内容适用于我在Ubuntu Linux 15.04上使用selenium webdriver 2.48.1和tor Browser Bundle 5.0.3的情况

require 'selenium-webdriver'

tor_dir = '/opt/tor-browser_en-US'
# The Tor binary relies on these shared libraries
ENV['LD_LIBRARY_PATH']= [
  File.join(tor_dir, 'Browser/'),
  File.join(tor_dir, 'Browser/TorBrowser/Tor/')
].join(':')
Selenium::WebDriver::Firefox::Binary.path =
  File.join(tor_dir, 'Browser/firefox')
profile = Selenium::WebDriver::Firefox::Profile.new(
  File.join(tor_dir, 'Browser/TorBrowser/Data/Browser/profile.default'))
driver = Selenium::WebDriver.for :firefox, :profile => profile
driver.get('https://check.torproject.org/')

您使用的selenium webdriver版本和FireFox版本是什么?FireFox v22.0和webdriver v2.35我不知道您的意思,但我确认:FireFox v22.0和webdriver v2。35@RichardFriedman现在行了吗?你可能想看看我的答案