gpt4 book ai didi

firefox - 无法通过 Watir 连接到 Tor-Firefox

转载 作者:行者123 更新时间:2023-12-01 00:59:58 26 4
gpt4 key购买 nike

我在通过 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

不需要其他任何东西 - 不要打扰个人资料

关于firefox - 无法通过 Watir 连接到 Tor-Firefox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24305345/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com