A Python library to automate Tor Browser with Selenium.
Installation
Step 1:
Install Tor Browser Selenium Package.
pip install tbselenium
Step 2:
Install geckodriver in your ubuntu machine
You also need to install geckodriver v0.17.0 from the geckodriver releases page. Make sure you install the v0.17.0 version; newer or older versions will not be compatible with the current Tor Browser series.
Download the geckodriver and extract it. The driver should be move to /usr/local/bin/ directory and show the below command.
manivannan@manivannan-whirldatascience:~/pythonexamle/selenium_example$ tar -xvf geckodriver-v0.17.0-linux64.tar.gz
manivannan@manivannan-whirldatascience:~/pythonexamle/selenium_example$ sudo cp geckodriver /usr/local/bin/
Test your geckodriver installation by running the command below; it must return geckodriver 0.17.0:
geckodriver --version
OUTPUT


Step 3:
You should download and extract TBB and provide its path when you initialize TorBrowserDriver
manivannan@manivannan-whirldatascience:~/pythonexamle/selenium_example$ tar -xvJf tor-browser-linux64-7.5.4_en-US.tar.xz
The tar file is extracted and it is directory.
Step 4:
Install xvfb package by running apt-get install xvfb .
manivannan@manivannan-whirldatascience:~/pythonexamle/selenium_example$ sudo apt-get install xvfb
Now we started the program for take a screenshot from web browser.
Create the python file and paste the below code.
from tbselenium.tbdriver import TorBrowserDriver from os.path import dirname, join, realpath, getsizeout_img = join(dirname(realpath(__file__)), "screenshot.png") with TorBrowserDriver("/home/manivannan/pythonexamle/selenium_example/tor-browser_en-US") as driver: driver.load_url('https://check.torproject.org', wait_for_page_body=True) print("----"*100) driver.get_screenshot_as_file(out_img) print("----"*100) print("Screenshot is saved as %s (%s bytes)" % (out_img, getsize(out_img)))
— — — — — — — — — — — — — — -OR — — — — — — — — — — — — — — — –
Use my github repositary link here and i will post the advanced programs in future.
未经允许不得转载:萌萌Apprentissage » Selenium with Tor Browser using Python
Python batches to extract mainstream search engine pictures
Python's word crawling across 100 degrees.
PythonTaiichi Taipei Artificial Intelligence Tensoflow Graphic Processing
I'm gonna get you a new one, shell.cloud.google on the line.
run crontab with python selenium tor browser display in linux
Lineux Environment Use python to call the ter browser random browser web page