F
F
First Second2020-10-16 10:22:36
Python
First Second, 2020-10-16 10:22:36

Can't run TOR through Selenium using Python?

Hello. There was a following problem. When trying to start Tor Browser via Silenium, the following exception is thrown: selenium.common.exceptions.WebDriverException: Message: Permission denied. (os error 5)

5f8948d74fc83616423036.png

ps first start the tor, then I tried to run the code. Geckodriver is registered in PATH.

The code:

from selenium import webdriver
import time
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

BINARY = FirefoxBinary(r"C:\Users\user\Desktop\Tor Browser\Browser\firefox.exe")
PROFILE = FirefoxProfile(r"C:\Users\user\Desktop\Tor Browser\Browser\TorBrowser\Data\Browser\profile.default")

class TestTor:

    def test(self, driver):
        driver.get('https://duckduckgo.com/')
        time.sleep(5)

def main():
    driver_tor = webdriver.Firefox(firefox_binary=BINARY, firefox_profile=PROFILE)
    driver_tor.set_preference('network.proxy.type', 1)
    driver_tor.set_preference('network.proxy.socks', '127.0.0.1')
    driver_tor.set_preference('network.proxy.socks_port', 9150)
    test_tor = TestTor()
    test_tor.test(driver_tor)


help me pliz....

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question