All Projects → webfp → Tor Browser Selenium

webfp / Tor Browser Selenium

Tor Browser automation with Selenium.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Tor Browser Selenium

Qxf2 Page Object Model
Write Selenium and Appium tests in Python using the Page Object pattern. This Pythonic GUI and API test automation framework will help you get started with QA automation quickly. It comes with many useful integrations like - email, BrowserStack, Slack, TestRail, etc. This repository is developed and maintained by Qxf2 Services (https://qxf2.com).
Stars: ✭ 155 (-41.95%)
Mutual labels:  automation, selenium
Reporting
Zebrunner Reporting Tool
Stars: ✭ 198 (-25.84%)
Mutual labels:  automation, selenium
Instapy
📷 Instagram Bot - Tool for automated Instagram interactions
Stars: ✭ 12,473 (+4571.54%)
Mutual labels:  automation, selenium
Unium
Automation for Unity games
Stars: ✭ 132 (-50.56%)
Mutual labels:  automation, selenium
Pychromeless
Python Lambda Chrome Automation (naming pending)
Stars: ✭ 219 (-17.98%)
Mutual labels:  automation, selenium
Instagram Bot
An Instagram bot developed using the Selenium Framework
Stars: ✭ 138 (-48.31%)
Mutual labels:  automation, selenium
Python Scripts
Collection of Various Python Script's.💻
Stars: ✭ 195 (-26.97%)
Mutual labels:  automation, selenium
Frameworkium Core
Framework for writing maintainable Selenium and REST API tests in Java.
Stars: ✭ 107 (-59.93%)
Mutual labels:  automation, selenium
Pywhatsapp
Python Automation using selenium & Scheduling of messages and media
Stars: ✭ 257 (-3.75%)
Mutual labels:  automation, selenium
Splinter
splinter - python test framework for web applications
Stars: ✭ 2,476 (+827.34%)
Mutual labels:  automation, selenium
30 Days Of Python
Learn Python for the next 30 (or so) Days.
Stars: ✭ 1,748 (+554.68%)
Mutual labels:  automation, selenium
Nightwatch Cucumber
[DEPRECATED] Cucumber.js plugin for Nightwatch.js.
Stars: ✭ 243 (-8.99%)
Mutual labels:  automation, selenium
Instagram Profilecrawl
💻 Quickly crawl the information (e.g. followers, tags, etc...) of an instagram profile. No login required!
Stars: ✭ 110 (-58.8%)
Mutual labels:  automation, selenium
Qaf
Quality Automation Framework for web, mobileweb, mobile native and rest web-service using Selenium, webdrier, TestNG and Java Jersey
Stars: ✭ 150 (-43.82%)
Mutual labels:  automation, selenium
Netset
Operational Security utility and automator.
Stars: ✭ 110 (-58.8%)
Mutual labels:  automation, tor
Thirtyfour
Selenium WebDriver client for Rust, for automated testing of websites
Stars: ✭ 191 (-28.46%)
Mutual labels:  automation, selenium
Aet
AET - a system that detects visual changes on web sites and performs basic page health checks
Stars: ✭ 100 (-62.55%)
Mutual labels:  automation, selenium
Wdio Screenshot
A WebdriverIO plugin. Additional commands for taking screenshots with WebdriverIO.
Stars: ✭ 101 (-62.17%)
Mutual labels:  automation, selenium
Nvidia Sniper
🎯 Autonomously buy Nvidia Founders Edition GPUs as soon as they become available.
Stars: ✭ 193 (-27.72%)
Mutual labels:  automation, selenium
Cdp4j
cdp4j - Chrome DevTools Protocol for Java
Stars: ✭ 232 (-13.11%)
Mutual labels:  automation, selenium

tor-browser-selenium Build Status

A Python library to automate Tor Browser with Selenium.

Installation

pip install tbselenium

Install geckodriver from the geckodriver releases page. Make sure you install version v0.23.0 version or newer; older versions may not be compatible with the current Tor Browser series.

Basic usage

Using with system tor

tor needs to be installed (apt install tor) and running on port 9050.

from tbselenium.tbdriver import TorBrowserDriver
with TorBrowserDriver("/path/to/TorBrowserBundle/") as driver:
    driver.get('https://check.torproject.org')

Using with Stem

First, make sure you have Stem installed (pip install stem). The following will start a new tor process using Stem. It will not use the tor installed on your system.

import tbselenium.common as cm
from tbselenium.tbdriver import TorBrowserDriver
from tbselenium.utils import launch_tbb_tor_with_stem

tbb_dir = "/path/to/TorBrowserBundle/"
tor_process = launch_tbb_tor_with_stem(tbb_path=tbb_dir)
with TorBrowserDriver(tbb_dir, tor_cfg=cm.USE_STEM) as driver:
    driver.load_url("https://check.torproject.org")

tor_process.kill()

TorBrowserDriver does not download Tor Browser Bundle (TBB) for you. You should download, extract TBB and provide its path when you initialize TorBrowserDriver.

Setting geckodriver's location without using PATH

If geckodriver is not on the system PATH, the binary location can be set programmatically:

TorBrowserDriver(executable_path="/path/to/geckodriver")

Test and development

Install the Python packages that are needed for development and testing:

pip install -r requirements-dev.txt

Install xvfb package by running apt-get install xvfb or using your distro's package manager.

Run the following to launch the tests:

./run_tests.py /path/to/TorBrowserBundle/

By default, tests will be run using Xvfb, so the browser will not be visible. You may disable Xvfb by exporting the following environment variable:

export NO_XVFB=1

Running individual tests

First, export a TBB_PATH environment variable that points to the TBB version you want to use:

export TBB_PATH=/path/to/tbb/tor-browser_en-US/

Then, use py.test to launch the tests you want, e.g.:

  • py.test tbselenium/test/test_tbdriver.py
  • py.test tbselenium/test/test_tbdriver.py::TBDriverTest::test_should_load_check_tpo

Examples

Check the examples to discover different ways to use TorBrowserDriver

Compatibility

Tested with the following Tor Browser Bundle versions on Ubuntu:

  • 10.0.13
  • 10.5a11

Windows and macOS are not supported.

Troubleshooting

Solutions to potential issues:

  • Make sure you can run Firefox on the same system. This may help discover various issues such as missing libraries, displays etc..
  • Outdated (or incompatible) Python selenium package: This is the source of various obscure errors. Make sure you have selenium version 3.3 or above.
  • No display: When running on a cloud machine, follow the headless.py example to start a virtual display.
  • Outdated Tor Browser Bundle: Download and use a more recent TBB version.
  • Make sure you install the latest geckodriver version.
  • Port conflict with other (Tor) process: Pick a different SOCKS and controller port using socks_port argument.
  • Use tbb_logfile_path argument of TorBrowserDriver to debug obscure errors. This can help with problems due to missing display, missing libraries (e.g. when the LD_LIBRARY_PATH is not set correctly) or other errors that Tor Browser logs to standard output/error.
  • When you use LAUNCH_NEW_TBB_TOR option and get the following error message during the initialization, it's likely that Tor failed to bootstrap (due to network etc.):
Can't load the profile. Profile Dir: /tmp/tmpO7i1lL/webdriver-py-profilecopy If you specified a log_file in the FirefoxBinary constructor, check it for details
  • driver.get_cookies() returns an empty list. This is due to Private Browsing Mode (PBM), which Selenium uses under the hood. See #79 for a possible solution.
  • WebGL is not supported in the headless mode started with headless=True due to Firefox bug #1375585. To enable WebGL in a headless setting, use pyvirtualdisplay following the headless.py example.
  • set_security_level doesn't work with the current alpha (10.5a1).

Reference

Please don't forget to cite this repository if you use tor-browser-selenium in your academic publications.

@misc{tor-browser-selenium,
  author = {Gunes Acar and Marc Juarez and individual contributors},
  title = {tor-browser-selenium - Tor Browser automation with Selenium},
  year = {2020},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/webfp/tor-browser-selenium}}
}

Credits

We greatly benefited from the following two projects:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].