-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[🚀 Feature]: Tor Browser support? #13092
Comments
@MatzFan, thank you for creating this issue. We will troubleshoot it as soon as we can. Info for maintainersTriage this issue by using labels.
If information is missing, add a helpful comment and then
If the issue is a question, add the
If the issue is valid but there is no time to troubleshoot it, consider adding the
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable
After troubleshooting the issue, please add the Thank you! |
The primary reason the previous issues were closed was that the Tor browser was not able to make use of geckodriver at that time. I think it is good for Selenium to be able to support Tor in all of the languages, it comes down to what all code is required, and what makes sense for Selenium to do and what makes sense for 3rd parties to do. The tor automation gem might be the right way to do it, depending. What all is needed from the profile? |
@titusfortner thanks for your reply. I'll investigate whether this is possible with prefs alone. The 'NoScript' extension would need to be added, but that ought to be straightforward. |
users can add extensions after the browser has started in Firefox, though it is being investigated how to do extensions in capabilities — mozilla/geckodriver#1476 |
Thanks. So it seems tor-specific prefs can't be set through the ...
profile = Selenium::WebDriver::Firefox::Profile.new
options.profile = profile
driver = Selenium::WebDriver.for :firefox, options: options
# the following are on TB's default home page
driver.find_element(:id, 'quickstartCheckbox').click # sets ['torbrowser.settings.quickstart.enabled'] = true
driver.find_element(:id, 'connectButton').click
wait = Selenium::WebDriver::Wait.new(timeout: 10)
wait.until { driver.find_elements(:class, 'title-text').empty? } # tor connection made, probably a better way to do this
... # as before |
And geckodriver can't set that before launch with |
OK so yes that does set the correct preference, which I verified in |
Update: Tor Browser can be supported without using a profile and by setting user prefs only. I've built a bare-bones Ruby gem to do just that: https://gitlab.com/matzfan/selenium-tor All that is needed is 7 TB-specific prefs to be set to make your Firefox code work with TB. The only other tweak required is to wait until the browser has connected to the network. I did that by parsing the Happy to close this issue if Selenium don't want to take this forward. |
Let me ping the other devs to see if we want to implement direct support in all of the languages. If you want to write an article for what preferences need to be set in a language agnostic way for our Blog? I'm sure there are Java devs and Python devs who are interested in working with Tor Browser. |
OK show me where that goes and I'll write something up. Python has its own library here, dunno about Java. |
You could PR a post here — https://github.com/SeleniumHQ/seleniumhq.github.io/tree/trunk/website_and_docs/content/blog/2023 Either way, I'm glad you got things sorted out. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Feature and motivation
I plan on writing a Ruby gem to support Tor Browser with Selenium and just wanted to check before I start that there are no plans or desire to have cross-language support for Tor Browser in this project. I see this has been requested before (#4239 and #7803 at least).
My motivation for raising the issue again now is the fix I have just submitted in #13090 which allows FF to use an existing profile model. This was broken in Ruby, at least on Linux. With this change merged Tor Browser can be supported relatively easily, for example, with the
tor-browser
package in your home dir this works:As you can see, Tor Browser-specific preferences can be set in the same way as regular FF preferences and the connection through the tor network is handled by the SOCKS server bundled with the browser install - no need to mess with FF proxy settings. Using the default profile means the 'NoScript' extension TB uses does not need to be separately installed.
I have also checked the browser fingerprint with the EFF's test tool to ensure the Selenium-driven browser retains TB's anonymity and there is one issue there, which I expect can be fixed. If it can be, Selenium-Tor would retain the anonymity of human Tor Browser users - a key requirement from prospective users of Selenium-Tor.
Usage example
You would do something like this (in Ruby):
There is a demand for Tor Browser support, though I confess its size is unknown.
The text was updated successfully, but these errors were encountered: