无法通过 Watir 连接到 Tor-Firefox
·
问题:无法通过 Watir 连接到 Tor-Firefox
我在通过 Ruby - Watir webdriver 连接到 Tor 时遇到问题。
我使用 Tor 浏览器捆绑包。问题是当我尝试通过 Watir (Selenium) 连接时,我似乎无法打开 Tor 而不是普通的 Firefox。
查看类似的问题,我尝试了以下方法:
require 'watir-webdriver'
profile = Selenium::WebDriver::Firefox::Profile.new
profile['network.proxy.socks'] = '127.0.0.1' #the proxy tor uses
profile['network.proxy.socks_port'] = 9150 #I cannot use 9050, 9150 works when I use Tor
profile['network.proxy.type'] = 1
browser = Watir::Browser.new :firefox, :profile => profile
browser.goto [an .onion website]
当我使用前面提到的代码时,我仍然打开普通的 Firefox 浏览器,并且无法连接到洋葱站点。
有什么想法吗?我需要将 Tor 浏览器连接到我的 webdriver 配置文件吗?
解答
答案:
首先,打开 Tor 浏览器(它需要已经运行)。然后,在您的代码中,确保简单地从以下内容开始:
Selenium::WebDriver::Firefox::Binary.path='{location of start_tor_browser*}'
browser = Watir::Browser.new :firefox
*在我的例子中:/home/tor/tor-browser_en-US/start-tor-browser
不需要其他任何东西 - 不要打扰个人资料
更多推荐

所有评论(0)