
py.test tbselenium/test/test_tbdriver.py.

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

You may disable Xvfb by exporting the following environment variable:Įxport NO_XVFB=1 Running individual testsįirst, export a TBB_PATH environment variable that points to the TBB version you want to use:Įxport TBB_PATH=/path/to/tbb/tor-browser_en-US/ run_tests.py /path/to/TorBrowserBundle/īy default, tests will be run using Xvfb, so the browser will not be visible. Install xvfb package by running apt-get install xvfb or using your distro's package manager. Install the Python packages that are needed for development and testing: If geckodriver is not on the system PATH, the binary location can be set programmatically: TorBrowserDriver ( executable_path = "/path/to/geckodriver" ) Test and development Setting geckodriver's location without using PATH You should download, extract TBB and provide its path when you initialize TorBrowserDriver. TorBrowserDriver does not download Tor Browser Bundle (TBB) for you. import mon 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. It will not use the tor installed on your system. The following will start a new tor process using Stem.

get ( '' ) Using with Stemįirst, make sure you have Stem installed ( pip install stem). from tbselenium.tbdriver import TorBrowserDriver with TorBrowserDriver ( "/path/to/TorBrowserBundle/" ) as driver : driver. Tor needs to be installed ( apt install tor) and running on port 9050. Make sure you install version v0.23.0 version or newer older versions may not be compatible with the current Tor Browser series. Install geckodriver from the geckodriver releases page. A Python library to automate Tor Browser with Selenium.
