无法通过Watir连接到Tor-Firefox [英] Can't connect to Tor-Firefox via Watir

查看:171
本文介绍了无法通过Watir连接到Tor-Firefox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我使用Tor浏览器套件。问题是,当我尝试通过Watir(Selenium)连接时,我似乎无法打开Tor,而不是常规的Firefox。



看到类似的问题,我试过以下内容:

 需要'watir-webdriver'
$ b $ profile = Selenium :: WebDriver :: Firefox :: Profile.new

profile ['network.proxy.socks'] ='127.0。 0.1'#代理tor使用
profile ['network.proxy.socks_port'] = 9150 #I不能使用9050,9150当我使用Tor
profile ['network.proxy.type'] = 1

browser = Watir :: Browser.new:firefox,:profile => profile
browser.goto [一个.onion网站]

当我使用前面提到的代码我仍然打开正常的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


不要打扰与配置文件


I am having issues connecting to Tor via Ruby - Watir webdriver.

I use the Tor Browser Bundle. The problem is that when I try to connect via Watir (Selenium) I cannot seem to open Tor instead of regular Firefox.

Looking at similar issues I've tried the following:

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]

When I use the before-mentioned code I nonetheless still open the normal firefox browser, and cannot connect to onion sites.

Any thoughts? Is there another way in which I need to connect the Tor browser to my webdriver profile?

解决方案

The answer:

First, open the Tor browser (it needs to be running already). Then, in your code, make sure to simply start with:

Selenium::WebDriver::Firefox::Binary.path='{location of start_tor_browser*}'
browser = Watir::Browser.new :firefox

*In my case: /home/tor/tor-browser_en-US/start-tor-browser

Nothing else is required - don't bother messing with profile

这篇关于无法通过Watir连接到Tor-Firefox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆